IP Addresses

IP Addresses

What exactly is an "IP address"? Is it the thing I type into a browser to go to a website (e.g. "www.sixscape.com")? No, that is called a domain name. If you include "http://" that is called a URI (Uniform Resource Indicator), or URL (Uniform Resource Locator). Those are for humans to use. Computers prefer numbers. The domain name does not go into the packets that actually go back and forth on the Internet. Each computer has a "computer number" that is like a "telephone number". Each computer on the Internet has one of these computer numbers, that other computer use to "call" it. The domain name is like a person's name, not their telephone number. On your phone, if you wanted to call your friend Alice, you don't dial A L I C E. You dial her telephone number. Or more likely, you look up her name in your phone's directory, where you previously stored her name and telephone number. What your phone dials though, is her telephone number, not her name. It is the same on the Internet. What gets "dialed" is the computer number of the node you want to contact, not its domain name.

When you want to connect to a given node (for example, the website of Sixscape Communications), you type the domain name www.sixscape.com into your browser. That is like the website's name, not its computer number. Your browser looks up that name in its directory (which is called DNS, for Domain Name System). Only you don't have to have stored the website's name and number in that directory yourself - the owner of that website (that would be me) put that domain name and IP address into DNS for you. Your browser says "Hey, DNS, what is the computer number for the computer whose name is www.sixscape.com?". DNS says back to your browser "That computer has two numbers: 184.105.238.120 and 2001:470:3d:100::120". Your browser then uses one or the other of those numbers to "dial" my website.

A friend of mine, Paul Mockapetris, invented DNS. Without his invention, not many people would be able to use the Internet today. I recently kidded him that the depletion of IPv4 addresses was all his fault, because without DNS, probably there would only be a few tens of thousands of people using the Internet, worldwide. DNS made the Internet so easy to use, that now billions of people are using it, and we are consequently running out of IP addresses. He laughed and said he would be happy to accept blame for that. Amazingly, his invention was so well thought out, that is only took some very minor changes for it to continue working on the new IPv6 Internet. Paul is truly one of the "fathers of the Internet", along with Vint Cerf, Bob Kahn, Bob Metcalfe, and Marc Andreesen.

These computer numbers are called "IP addresses". One of them happens to be the number you contact my website with from a node on the legacy IPv4 Internet. The other is the number you contact my website with from a node on the new IPv6 Internet. My website is available to nodes on both the old and the new Internet. New Internet? How many Internets are there? you ask. Well, right now there are two primary Internets living side by side, one that started in 1983 and uses IPv4 addresses, and one that started in 1995 and uses these funny looking new IPv6 addresses ("why are there letters in my computer numbers?"). There used to be yet another Internet before 1983, that used NCP addresses. That one is gone. It was called the ARPANET. Someday the IPv4 Internet will be gone too, but not for many years. Change happens.

When your computer sends packets to my website, those packets have what amounts to a shipping label on them (it's actually called a Packet Header). This shipping label has a "from address" (your computer's "number") and a "to address" (the "number" of the computer you are trying to contact). These computer numbers are called "IP addreses".

An IP address is like a telephone number. Just like every telephone in the world must have a unique telephone number (once you include the country code and area code), every computer connected to the Internet (that is accessible by anyone) must have a unique IP address. The domain name you type into your broswer (e.g. www.sixscape.com) is like a person's name. DNS is like an automated telephone directory. A telephone directory maps a person's name to their telephone number. DNS maps a computer's domain name to its IP address. Just like your telephone dials the number you are trying to call (not the person's name) over the line (as a series of tones), a computer sends the IP address of the computer you are trying to reach, in the header of each packet. The Internet uses that shipping label (and the destination IP address on it) to get your packets to the right computer out of the billions of computers on the Internet. Every packet your send also contains the IP address of your computer (similar to the "from" address on and actual shipping label), so the destination node can get its replies back to your computer, out of all the billions of computer on the Internet.

You may have heard that we are "running out of IP addresses". We are not running out of domain names - we can make up as many of those as we want, just by using longer and longer domain names, like "www.thisisareallylongdomainname.com" (believe it or not, someone owns this name, and is willing to sell it). So what are we running out of? We are running out of IP addresses - these things that are like the telephone number of a computer. But there is no limit to the number of numbers, there are an infinite number of integers, right? Well, for technical reasons, IPv4 addresses can only have values of 0 to 4,294,967,295. Or in IPv4-speak, from 0.0.0.0 to 255.255.255.255.

We are running out of a particular kind of IP address called public IPv4 addresses. These are like real telephone numbers that anyone in the world can call directly. There are also something called private IPv4 addreses. These are more like the extension numbers found on phones in a big company. You know, the kind of telephone system on which you have to "dial 9 for an outside line"? If the IP address of your computer starts with a 10, or anything from 172.16 to 172.31, or 192.168, then you have a private IP address. If so, then you are very much a second class citizen in the Internet world. The web servers that anyone can connect to (like www.sixscape.com) have real (public) IP addresses. That website happens to have a public IPv4 address of 184.105.238.120. No other computer in the world has that IP address. It is globally unique. These are what we are running out of.

For technical reasons, these IP addresses are of a fixed length. The fields in the old "shipping labels" (IPv4 headers) have exactly 32 bits to represent a source address, and another 32 bits to represent a destination address. The old IPv4 addresses happen to be 32 bits long (and look like 123.45.67.89 to humans). The fields in the new "shipping labels" (IPv6 headers) have 128 bits to represent a source address, and another 128 bits to represent a destination address. The new IPv6 addresses are 128 bits long (and look like 2001:db8:1:2::14 to humans). They can have any value from 0 to 340,282,366,920,938,463,463,374,607,431,768,211,455. The number of numbers goes up very rapidly with the number of bits used to represent them. Each additional bit doubles the number of numbers. The bottom line is we don't have to worry about running out of IP addresses ever again. Famous last words? No - we really don't have to worry this time. 340 trillion, trillion, trillion really is a big number.

Why didn't they provide more bits for IP addresses when they created IPv4 in 1981? Well, the old scheme (NCP from ARPANET) had only 8 bits for a node address (maximum of 256 nodes), and those lasted from 1969 to 1983. 4.3 billion sounded like an awful lot at the time. Vint Cerf likes to accept blame for the choice:

One of the decisions his team needed to make was the size of the address space in the packets.

Some researchers wanted a 128-bit space for the binary address, Cerf (recalled) ... But others said, "That's crazy," because it's far larger than necessary, and they suggested a much smaller space. Cerf finally settled on a 32-bit space that was incorporated into IPv4 and provided a respectable 4.3 billion separate addresses.

"It's enough to do an experiment," he said. "The problem is the experiment never ended."

Bad Vint! But we will forgive you given that your contribution to humanity is one of the biggest ever made by one man. His brainchild has created trillions of dollars in real wealth, and expanded opportunities and personal freedoms for billions of people. He is now "VP and Chief Internet Evangelist" at Google, and is a tireless campaigner for IPv6.

vin cerf bus card

It must be a lot of fun to be able to hire someone like that - kind of like hiring Hippocrates at your hospital. Technology moves a lot faster today than it used to. Many of the founding fathers of the Internet are still with us. I definitely don't qualify as a "founding father", but I was graduating from High School when the 1G Internet (ARPANET) started (1969). I was 32 years old and had been working for an entire decade when the 2G Internet (IPv4) started (1983). And now the 3G Internet (IPv6) is off and running. Exciting times.

If these new IPv6 addresses are four times as long as IPv4 addresses, does that mean there are four times as many addresses? One of the books I own on IPv6 (published in 2009) says so:

"Besides its inherent capabilities to overcome the aforementioned limitations, IPv6 also supports an address space quadruple that of IPv4, by supporting 128-bit instead of 32-bit addresses (RFC 3513)." (name of book and authors withheld to prevent embarrassment, and other than this whopper, it's actually a very good book).

Quadrupling the IPv4 address space would help, but we would fairly quickly use those up too. That would only yield 17 billion addresses, and Cisco is already predicting 50 billion devices in only a few years. Fortunately that's not the way numbers work. Quadrupling the size of the IP address space would only require 34 bit addresses.

There are one thousand three digit decimal numbers (from 000 to 999), but there are ten thousand four digit numbers (from 0000 to 9999). Every additional digit increases the number of possible numbers by a factor of 10. There are one million six digit numbers, and one billion nine digit numbers. Even the nine billion names of God only require 10 digits to enumerate. You can think of an IPv6 address as a 38 digit phone number. That's enough to provision devices for every being in every observable galaxy. Maybe someday some of those beings will offer to connect our tiny Earth Internet to the pan-galactic HyperNet. I hope they have solved that pesky speed of light thing, otherwise latency is going to be a serious problem.

IP addresses are binary (base 2 numbers). Each digit is either 0 or 1. There are 8 possible 3 bit addresses, from 000 to 111. There are 16 possible 4 bit addresses, from 0000 to 1111. Every additional bit doubles the total number of possible addresses.

Well, the address length of IPv6 is definitely "quadruple that of IPv4" (128 = 4 x 32), but the address space (the number of distinct addresses) is 296 (79,228,162,514,264,337,593,543,950,336) times as large as that of IPv4 (confession: I was a math major in college). I think we are safe this time.

Remember the old story about the wiseguy that did something for some king, and asked only a "few grains of rice" in return? He told the king to put one grain of rice on the first square of a chessboard, two on the next, four on the next, eight on the next, and so on. The king readily agreed because it sounded like this would be a really cheap way to pay the guy back. Long before they got to the 64th square, it would have taken all the rice in the world to satisfy the wiseguy's simple sounding request. The total amount of rice would be 265 minus 1, or 36,893,488,147,419,103,232 grains of rice. An average grain of rice weighs about 0.028 grams. So that would be 1,033,017,668,127,734 kilograms of rice, or about 1.033 x 1018 kilograms. The entire Earth weighs about 5.972 x 1024 kilograms, so the rice would weigh about 1/200,000 of the weight of the entire Earth. That's a lot of rice. The moral of the story is that doubling things many times can make for some gigantic numbers. With IPv4, you could have stopped halfway through the chessboard (32 squares), for a total of about 120 metric tons of rice. The king might could have afforded that, if his kingdom was very large and successful. Well, with IPv6 you have to do all 64 squares on that chessboard and a second chessboard on top of that (a total of 128 doublings). If you think there was a lot of rice on the first chessboard, you should see how much is on the second. In only 17 more squares, the rice now weighs more than the earth, and we've still got 47 more squares to go...

Princess Leia: "Well more rice than you can imagine."

Hans Solo: "I dunno - I can imagine a lot of rice."

I think even Hans solo would have troubling imagining that much rice.

With 32 bits, there are 232 or about 4.3 billion addresses. With 33 bits it would be 8.6 billion. With 34 bits addresses there would be 17.2 billion. How many addresses are there with 128 bit addresses? The quick answer is there are 2128. If you write out that number it is 340,282,366,920,938,463,463,374,607,431,768,211,456. In scientific notation, it is about 3.40 x 1038, or 3.40E+38. Just how big is that? Well, if the IPv4 address space were the size of a billiard ball, the IPv6 address space would a sphere whose diameter is 63 times the diameter of our sun. It would reach nearly to the orbit of Venus (55 million mile radius). That's a big billiard ball.

Another, more practical way to visualize it has to do with "allocation blocks" - the chunk of addresses you get when you sign up for IPv6 ISP service. A company gets a "/48" (read "slash forty eight") block, which is really more than enough for all the computers we will ever have on Earth. There are enough IPv6 addresses for every one of the 7 billion or so humans alive today (including infants) to get over 5,000 of these /48 allocation blocks.