The IPv6 Problem, pt. 1
Borepatch asked a question (2, really) in comments to my last networking post that deserves a post of its own.
The Fed.Gov is making IPv6 a big deal. How long do you think until (a) large non-DoD migrations occur, or (b) we actually start to run out of IPv4 addresses?
That’s a good question, and the answer requires some understanding of the way internet addresses are numbered and assigned. I’ll go over a crash course on IP addressing and assignment here. Feel free to skip ahead if you know this, or just want the down low.
What do all these numbers mean?
IPv4 Addressing in a Nutshell
IPv4 addresses are 32-bit numbers that are commonly written in what’s known as the dotted-decimal format, which the address divided into four 8-bit numbers (called octets) separated by periods and converted to decimal format. Thus: the IPv4[1]address 11000000101010000110010000000001 is commonly written as 192.168.100.1[2]. A usable range of IP addresses is commonly noted with a subnet mask, netmask, or bitmask.
If you are on a Windows machine[3] you can find your subnet mask by looking at the details of the appropriate network connection (Start, Control Panel, Network Connections). Most people who check will be looking at a subnet mask that looks like this: 255.255.255.0. It looks like an IPv4 address in dotted-decimal notation, but isn’t. It does still represent a 32-bit number, in this case 11111111111111111111111100000000. The subnet mask denotes a group of addresses. For two addresses to be in the same group, they must meet these criteria:
- For each bit that is set to “1″ in the subnet mask the same bit in the IPv4 address must match. In the case of the example, the first 24 bits must match.
- For each bit that is set to “0″ in the subnet mask, the same bit in the IPv4 address can be set to any value.
- Subnet masks always consist of an uninterrupted string of 1s with the remaining bits 0, and will always be 32 bits long. In other words, a subnet mask will always look similar to the one above, and never like this: 11111111001111111111111100000000. If it does not follow this rule, it is called a wildcard mask, which does something completely different.
So for the example, if we have an IPv4 address of 192.168.100.1 and a subnet mask of 255.255.255.0, the entire group of addresses that this address belongs to (called a subnet or network) is 192.168.100.0 – 192.168.100.255 or 11000000101010000110010000000000 to 11000000101010000110010011111111 (interesting bits bolded). The address 192.168.101.1 would be outside of the group.
Subnet masks are also written in CIDR notation, which is an IPv4 address followed by the number of bits in the subnet mask that are set to “1″. The above address in CIDR notation is written as 192.168.100.1/24, because the first 24 bits in the subnet mask are 1s. Since we’re dealing with binary numbers, increasing the number of bits in the bitmask by 1 halves the number of addresses it represents, and reducingthe number by 1 doubles the number of addresses. So, since a /24 represents 256 addresses, a /23 represents 512 addresses, and so on. Shorter bitmasks represent larger blocks, and longer bitmasks match smaller blocks.
32 bits allows a grand total of 4294967296 (232) assignable addresses. In reality, far fewer of these are actually usable. I’ll go into why in the assignment section.
IPv6 Addressing
The IPv6 address space is 128 bits wide, 296 times the size of the IPv4 address space. To help you wrap your mind around how many addresses that is, that’s about 523 thousand trillion (523,000,000,000,000,000) addresses for every human brain cell on the planet[4]. IPv6 address assignment is a bit more complex than IPv4, so I’m just going to hit the basics. This is an IPv6 address:
2001:0db8:0000:130F:0000:0000:087C:140B
It consists of 8 16-bit hexadecimal numbers separated by colons. It’s long as hell, so there are two rules for shortening it.
- Any leading zeros in a segment can be dropped, i.e. :0001: can be written as just :1:
- Once (and only once) per address, the longest string of contiguous zeroes can be reduced to a pair of colons ‘::’
So the address above can also be written as:
2001:db8:0:130F::87C:140B
Most IPv6-capable machines will automatically truncate addresses using these rules. IPv6 addresses also use a bitmask to denote the size of the address group (network). It is most commonly written in CIDR notation, but it’s important to remember that there are 128 possible bits in an IPv6 bitmask, so while a /32 bitmask (all ones) represents a single address in IPv4, in v6 (32/128 ones) it represents about 7.9×1028 addresses.
How Addresses Get Assigned
Originally, when the internet was a young and wilder place, companies received IPv4 allocations directly from the Internet Assigned Numbers Authority, and a lot of organizations received large blocks of addresses. For example, Level 3 Communications owns the entire IPv4 address space with a 4 in the first octet. AT&T owns 12.0.0.0/8. MIT, IBM, Boeing, and other technology innovators also have similarly large allocations of 16 million or more IPv4 addresses. Then, as the internet grew, it became apparent that IANA couldn’t just go handing out millions of addresses to anyone that wanted them. Beginning in the early ’90s corporations began to form which would eventually hold the roles of “regional internet registries.” (RIRs)
In 1998 IANA became a part of ICANN as part of a US Government-sponsored initiative to improve internet address management, and in 1999 IANA began delegating IP address assignment to the RIRs. These RIRs (such as ARIN for North America and RIPE for Europe) are responsible for assigning addresses within their region and representing their customers to IANA to ensure fair address allocation worldwide. IANA currently allocates /8 blocks to RIRs, and the RIRs assign addresses in blocks of /12 or less to ISPs and end users. Current estimates indicate that IANA will have assigned all the IPv4 addresses to RIRs by mid-2011, and the RIRs will run out in December of 2012[5]. Likely these numbers will be pushed back as larger ISPs like Comcast begin rolling out IPv6, but that’s for another post.
I can really only speak to the way ARIN allocates addresses, the other RIRs have different prodecures. ARIN will currently only allocate addresses directly to an organization if they can prove a need for at least a /22 address block, which is about 1000 usable addresses. If an organization needs less than 1000 addresses then they need to get their addresses “reassigned” to them from their ISP[6]. Requesting an address assignment from ARIN involves a lot of paperwork and study in order to prove to the RIR that you have a need for so many public addresses. In the case of my organization, as an ISP we have to show ARIN that we have assigned at least 75% of the previous address space they allocated, and that at least 50% of it is in active use by customers in order to get new addresses from them.
On the v6 front, IANA is allocating /12 blocks to RIRs which are in turn assigning blocks of IPv6 addresses with a /32 bitmask to service providers (or more, if you can justify to your RIR having more than the entire IPv4 address space raised to the 3rd power). To be fair, IPv6 addresses are designed to be assigned in much larger blocks than v4 addresses[7], but a /32 is still a metric fuckton of addresses. In order to get an IPv6 allocation from ARIN a company has to not only show that they have use for public address space, but also to show that they have developed a plan to roll out IPv6 within the next five years.
So that’s kind of an abridged (ha!) version of IPv4 and v6 addressing and allocation. Stay tuned for the real answers to Borepatch’s questions as soon as I get a bit more time.
Update @ 21:06 4/18 for math fail and to add a bit more info.
- Most people also don’t add the “v4″ after “IP,” because v4 the only IP addressing format in common use. [↩]
- for advanced students, this is an RFC1918 private address and is not internet routable [↩]
- If you run *nix and need help with ifconfig, check your man pages. Or kill yourself. [↩]
- Based on 6.5 billion humans with 100 billion brain cells per person [↩]
- Maybe the Mayans are on to something. [↩]
- Or one of their ISPs, but BGP and ASN assignment is out of the scope of this series [↩]
- One of the major problems with the current system is that the internet routing tables are ginormous. During the IPv6 migration ISPs and other corporations are expected to deploy networks in overlarge aggregate blocks in order to reduce the size of the tables [↩]
