Articles

IPv6 cheat-sheet, part 2: the IPv6 address space

The IPv6 address pool is impossibly large. Here's a handy reference to make it more manageable.

Oct 11th, 2019

Now that we know how an IPv6 packet header looks, let’s take a look at where it goes.


To find out more about how to get more IP information through the APIs, check out this video.


A word (or 2^128) on IP addresses

One of the primary advantages of IPv6 is that its address space is vastly larger than IPv4.

IPv4 has about 4 billion addresses available (mathematically, the practical limit is of course lower) and we’re running out of them, fast. Granted, who would’ve thought back in the day that people would want to assign IP addresses to their toasters. (And even if they didn't, 4 billion addresses don't even cover one device per human being on the planet right now by a long shot.)

IPv6, on the other hand, has a mathematical limit of 2^128 IP addresses. That’s a lot. To be exact, it’s 340,282,366,920,938,463,463,374,607,431,768,211,456 (340 undecillion, 282 decillion, 366 nonillion, 920 octillion, 938 septillion, 463 sextillion, 463 quintillion, 374 quadrillion, 607 trillion, 431 billion, 768 million, 211 thousand and 456.

Say that four times fast!)

To put that into perspective: if you took all the atoms on the surface of Earth, you could assign about a hundred(!) IPv6 addresses to each(!).

Okay, it’s a lot. Is there a point to this math trivia?

Yes!

The IPv6 address pool is impossibly large. Even with the reservations and practical limits, it’s mind-blowingly huge. And smart people at IETF came up with some navigation shortcuts to help our brains cope with managing it, as well as reserving a bunch for specific purposes.

Let’s have a look at those.

Common & reserved prefixes in IPv6 addresses

Because of the huge amount of possible IPv6 addresses, and since the format of IPv6 is 16 hexadecimal values (grouped in eight 16-bit groups) instead of IPv4’s more simple 4 decimal groups, developers of the standard came up with ways to shorten them.

One way is to use ‘::’ when a 16-bit group is all zeroes. Note that when there are multiple groups with zeroes, only the first group will get shorthanded to ‘::’. (Reason for this is the need for shortened IPv6 addresses to be reproduced in their full forms.)

Another useful “trick” is the reservation of special structures for specific purposes:

::/0 default route
::/128 unspecified address All 128 bits are set to zero. (Like 0.0.0.0 in IPv4.) Used only when a device is first looking for an IP address assignment.
::1/128 loopback address Equivalent to 127.0.0.1 in IPv4. When set as a destination the packet will get immediately routed back to its source and never exits the host. Loopback is useful for testing.
::ffff:0:0/96 IPv4-mapped address Used to help the deployment of IPv6. The last 32 bits contain the IPv4 address, with FFFF (following 5 groups of zeroes) in the preceding group.
2001:1::1/128 port-control-protocol anycast Using this will route the packet to the closest device for address translation. (Such as NAT64 or NAT44.)
2001:1::2/128 Traversal Using Relays around NAT (TURN) anycast The IPv6 address block for use with TURN (a protocol allowing host behind NAT to receive data over TCP or UDP). Known as 192.0.0.10/32 in IPv4.
2001:db8::/32 documentation prefix Used to indicate resources such as RFCs, documentation, books, etc.
2620:4f:8000::/48 AS112 DNS sinkhole servers Used in environments where private IP addresses (ie, not globally unique) may originate DNS reverse lookups to these addresses. While best practices dictate to resolve these queries locally, sometimes they are directed at public DNS, which cannot answer the queries. To resolve this issue, and relieve pressure on the authoritative servers, the AS112 project was created, and this reservation ensures its compatibility with IPv6.
fc00::/7 Unique-Local Addresses (ULA) Prefix to local IPv6 unicast addresses generated with a pseudo-random global ID.
fe80::/10 link-local unicast Equivalent to the 169.254.0.0/16 block in IPv4. Used when the host doesn’t have an IPv6 address assigned either manually or through DHCP.
fec0::/10 site-local addresses (deprecated)

While not an exhaustive list by far, it covers the most often used cases.

More IPv6 coming up!

For sake of simplicity, we’ve split this topic into two parts. The second part, common multicast IPv6 addresses, will be out next week. (And if you thought there were too many acronyms in this one, you’re in for a surprise!)

After that, we have one last post to cover the remaining sections on our cheat-sheet, including IPv4-IPv6 tunneling, and covering useful Linux commands.

In the meantime, let us know if there’s a particular part of IPv6 you’d like to know more about!