|Date||Feb. 25th 2011|
|Next||Compass and Straightedge|
Nanobots is the 865th xkcd comic. This comic was accompanied by the news "xkcd.com now has IPv6 connectivity. If you can't reach it, you or your ISP have misconfigured equipment. Sadly, I now have no way to tell you."
The comic is set in a world where the earth is being devoured by nanobots (robots the size of a few microns) that use the earth's material to replicate indefinitely. This is a hypothetical end-of-the-world scenario called grey goo. In the comic, however, the nanobots are only able to devour 40% of the earth. The joke is that the comic assumes that the nanobots need to communicate, and thus need IP addresses, but they run out of possible IP addresses and can't replicate further.
IP addresses are addresses that are used to send information to computers on the Internet. They are a fixed size: a fixed number of bits (0-1 values). Just like a telephone number is, say, 8 digits (depends on the country), IPv4 addresses (the current standard) are 32 bits, and IPv6 addresses (not so new standard that's still not really in place) are 128 bits. For an 8 digit telephone number, there are 10 to the power of 8 possible telephone numbers, because each digit can take 10 different values and there are 8 of them. For IPv4 addresses there are 2 to the power of 32 possible addresses, because each bit can take 2 values, and there are 32 of them. 2 to the power of 32 is about 4.3 billion. In the real world, we ran out of IPv4 addresses and we need to move to IPv6 addresses pretty quickly, which is something we should have done a long time ago since this problem was anticipated very early and the IPv6 standard was published in 1998. For IPv6 addresses, there are 2 to the power of 128 possibilities, which is about 3.4 x 1038 (3 followed by 38 zeros). In a situation similar to us, the nanobots are running out of addresses, so they can no longer replicate, and say that they should have moved to longer addresses a long time ago.
According to Wikipedia, the volume of the earth is 1,083,210,000,000 km3 = 1.09 x 1012 km3. One meter is 106 microns, so one kilometer is 109 microns. One cubic kilometer is (109)3 = 109 x 3 = 1027 cubic microns. So, in cubic microns, the volume of the earth is 1.08321 x 1012 x 1027 = 1.08321 x 1012+27 = 1.08321 x 1039 cubic microns.
Let's assume that one nanobot is 1.2 cubic microns. If they replicate until they reach the IPv6 limit (2128), their total volume will be 1.2 x 2128 = 4.1 x 1038 cubic microns. What percentage of the earth's volume does that represent? Volume of nanobots/volume of earth = (4.1 x 1038) / (1.09 x 1039) = (4.1 x 1038) / (10.8321 x 1038) = 4.1/10.9 = 0.41, so about 40%.
(Note: You may be wondering where the 1.2 cubic microns for a nanobot figure came from. Well, there was a bit of cheating here since this size was chosen so that we would end up with 40% of the earth's volume. However, it is a sensible size for a nanobot.)
"I think the IETF hit the right balance with the 128 bits thing. We can fit MAC addresses in a /64 subnet, and the nanobots will only be able to devour half the planet."
The IETF is the Internet Engineering Task Force that develops and promotes Internet standards. They were the ones to publish the IPv6 standard in 1998.
IP addresses are addresses that are used to send information to computers on the internet. MAC addresses are a different type of address: they're 64 bits and are assigned by the manufacturer of a network interface card (Wi-Fi card, ethernet card) and are stored in its hardware. They're used to address packets at the physical level. The MAC address of your Wi-Fi card is used on your Wi-Fi network but is not known outside.
Each computer on the Internet is given a 32 bit (IPv4) or 128 bit (IPv6) address, but to simplify routing (the process of directing a packet towards the right router so that it will eventually reach you), some addresses can be grouped together. Basically it's like saying: "all addresses that start with these 16 bits are this way", or "all addresses that start with these 18 bits are that way". In CIDR notation, that's written like 192.168.1.0/18. First comes the IP (not written in binary but in the form of four decimal numbers since it's more compact), and then a slash and the number of bits that must be identical. A computer in the 192.168.1.0/18 subnet might have the address 192.168.1.32. The last number (32) will identify the computer in this subnet. It is chosen either by the router when IP addresses are given dynamically (with DHCP) or by the administrator.
In IPv4, the size of the part of the address that identifies the computer can be anything, but in IPv6, it was fixed to 64 bits. That's really a lot, since it means you could fit 264 = about 2 x 1019 computers on a subnet, but the idea was that instead of using arbitrary numbers to identify computers, you could use the MAC address of the network interface. That way you can be sure that no two computers on a network will have the same IP (causing a conflict), and that the IP will never change. All this simplifies the lives of network administrators.