IP Addresses and DNS

IP Addresses

IP addresses are at the core of our internet (and most local networks). Every computer on the Internet has an IP address, and movies and TV shows frequently refer to them when characters try to find the location of a computer.
Even though they very recognizable, most people don't know what they mean, which makes them even more interesting for film makers. They are usually used to indicate that a character is tech savvy or geeky. Unfortunately, many film makers get them wrong themselves...
Just a few days ago, I found another incorrect use of IP addresses, which inspired me to write this post. The following screenshot is from Community S06E11 - Modern Espionage:

IP Log with bad IP addresses
 The IP Log contains the following entries:

  • 203.266.173.0/112
  • 172.266.214.174
  • 172.258.214.234
  • 203.256.94.0/24
  • 182.257.186.0/24
  • 192.591.27.0/24
  • 103.373.16.0/26
  • 213.273.17.0/26
  • 160.257.18.0/26
  • ...
All of them are invalid (which might be an indication that they actually knew what they were doing).

The reason none of these are valid, is because the individual numbers must be in the range 0 to 255. Each number represents a byte, which is composed of 8 bits. A bit can have two states: on (1) or off (0). As a consequence, a byte can only have 2^8 = 256 different values.
The first entry, has also a bad subnet-mask (CIDR notation). The "/112" is too big. The number following the "/" just says how many binary digits are the common prefix for the local network. Since an IP address only consists of 4 bytes = 32 bits (so 32 digits of 0 or 1), the number after the "/" can never be bigger than 31.

Here are some valid IP addresses. With and without subnets:
  • 127.0.0.1 - IPv4 loopback address
  • 8.8.8.8 - a Google DNS service address
  • 8.8.4.4 - another Google DNS service address
  • 192.168.0.254 - a typical local IP address (not visible from the Internet)
  • 10.0.0.101 - also a local address
  • 192.168.0.1/24 - local address with subnet mask
  • 208.128.0.0/11 - random address with subnet mask
  • 10.0.0.1/16 - local address with subnet mask
The loopback address is interesting in that it always resolves to the local machine from where the request originates. It is a convenient way of using a machine's services without knowing the public IP address of a machine. It's frequently used in memes, jokes or on T-shirts.

Addresses starting with "192.168" or "10" are local addresses. They are usually within the same building. That explains XKCD comic 742 - Campfire.

IPv6

The Internet wasn't designed for that many computers, and we are running out of IP addresses. For the last decades a huge effort has been undertaken to replace the old IPv4 addresses (with the four numbers) with longer IP addresses. These IPv6 addresses are not just longer but they also look a bit different because they are written in hexadecimal notation. They serve the exact same purpose, though. Many machines have both an IPv4 and IPv6 address.

Expect these addresses to appear more in the future.
Here are some valid IPv6 addresses:

  • 2a03:2880:2110:df07:face:b00c::1 - one of Facebook owned IPv6 addresses
  • 2001:4860:4860::8888 - Google DNS server
  • 2001:4860:4860::8844 - second Google DNS server
  • ::1 - localhost (equivalent to 127.0.0.1)
IPv6 addresses notation follows the following conventions:
  • they consist of eight 4-digit hexadecimal numbers separated by ":"
  • one or multiple 0000 numbers can be omitted and replaced by "::". Only one such replacement is allowed (as it would otherwise be ambiguous).
  • a trailing IPv4 equivalent may still be written in IPv4 notation
In the example above the "::1" address is hence equivalent to "0000:0000:0000:0000:0000:0000:0000:0001". Note that hexadecimal digits only allow for 0-9 and a-f. The following address is thus not valid: "abcd:efgh::" It would be legal, if the "g" and "h" were not present.

There is a special notation used during the transition period from IPv4 to IPv6 where the last 2 hexadecimal numbers are written in the customary decimal notation if they represented an IPv4 address: for example "::ffff:192.0.2.128". When this notation is used, then the last 4 digits must follow the usual IPv4 conventions and restrictions.

DNS

Every computer on the internet has an IP address. Since humans are very bad at remembering numbers, an additional service maps from human-understandable names (like "www.google.com" or "www.imgur.com") to the computers that serve these sites. The standard way of doing this translation is based on the Domain Name System (DNS).
DNS is a very interesting system (needing to be decentralized, easy to update by individuals, ...), but most users really just need to know that this is the service that maps names to IP addresses. When a name doesn't have an IP address associated with it, then the DNS service will respond with an "ERR_NAME_NOT_RESOLVED" (or a similar error). Chrome users can easily try this out, by trying to go to a non-existing address, like http://notexistingname.com:

This site can’t be reached

notexistingname.com’s server DNS address could not be found.

ERR_NAME_NOT_RESOLVED

Comments