IPv6 is becoming a hotter and hotter topic as more and more folks realize its necessity. I know this for several reasons, not the least of which is an ever increasing flow of requests for solid IPv6 information. In trying to find a way to fill this gap, without dedicating all of my off-hours time, I am pursuing multiple avenues. This 4-part series Introducing IPv6 is one of them.

The content I’ll be posting here is adapted from the first chapter of my first book; Day One: Exploring IPv6. This series will provide a quick, vender-agnostic look at the IPv6 protocol, from address length to packet format, and more in between. With it, I hope to provide you with a solid foundation for you to build your IPv6 configuration and operation knowledge on top of. So why don’t you dive right in to part 1:

Understanding IPv6 Addresses

One of the first things you notice when digging into IPv6 is that the addresses look quite different than IPv4 addresses.

The primary difference between IPv4 and IPv6 addresses is length. IPv4 addresses are 32 bits long and IPv6 addresses are 128 bits long. This means that an IPv4 address is made up of 32 1s and 0s while an IPv6 address is made up of 128 of them – 128 binary digits. This massive length forces IPv6 addresses to be written using a different notation than IPv4 addresses and thus makes them very easy to distinguish from IPv4 addresses.

This length and new notation can also make them not so easy to understand though. Here’s a 128-bit IPv6 address in binary notation, the way that they are written inside of IPv6 packets:

0010000000000001000011011011100000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000001

 

If you were to use the dotted-decimal notation that is familiar to us in IPv4 (e.g. 192.0.2.1), you would need to break this 128-bit address into 16, 8-bit sections and the resulting address would look something like this: 32.1.13.184.0.0.0.0.0.0.0.0.0.0.0.1. That is a little unwieldy to say the least!

Instead, flip that on it’s head and break the address into 8, 16-bit sections as illustrated here:

0010000000000001 0000110110111000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000001

 

It’s still unwieldy, so since hexadecimal (HEX) notation symbolizes 4 bits in each digit, it is used to compress the address into a more human-readable format. The example below uses the second 16-bits (2nd block) of the IPv6 address above, and shows the binary to hexadecimal conversion.

0000110110111000 --> 0000  1101  1011  1000 --> 0  d  b  8

 

A 128-bit IPv6 address uses a maximum of 48 digits when written in decimal notation but only 32 digits or less are needed when hex notation is used.

Once converted to hex, each 16-bit segment is delimited by colons (:), this is of course different from IPv4 addresses which use periods (.) to delimit each 8-bit segment when written in decimal format.

When an IPv6 address is written in hex notation, you have the flexibility to shorten the address considerably by reducing the number of zeros displayed. This can be accomplished in two ways:

  • Zero Suppression: Because it is known that all 8 segments consist of 16 bits it is possible to remove leading zeros from each section without making the address ambiguous. For example – 0db8 can be written as db8. You (and your routers) know that only leading zeros (not zeros in the middle or end of a segment) can be suppressed and that there must be 4 hex digits in each segment. You can therefore conclude that db8 is the same as 0db8.
  • Zero Compression: Similarly, because it is known that each address must be made up of 8 segments, it is possible to compress multiple contiguous segments of all zeros without confusing the address, as long as it is only done once within a single address. When compressing segments a double colon (::) is used. For example, if we were to see 2001:0db8::3f6c, we would know that the :: represents 5 contiguous segments of all zeros, since the address must contain 8 segments in total.

 

This idea of zero suppression is really not all that foreign; in IPv4 the same method is used. You don’t write 192.000.002.001, but rather 192.0.2.1 – all of the leading zeros are suppressed.

The next example shows our IPv6 address both directly converted to hex and also after all possible zero suppression and compression. You can see how much easier the address is to read after removing the unneeded zeros:

2001:0db8:0000:0000:0000:0000:0000:0001 --> 2001:db8::1

IPv6 Prefixes

Much like IPv4 with CIDR (Classless Inter-Domain Routing), one of the great advantages of IPv6 addressing is its hierarchical structure. IPv6 addresses can be broken into prefixes of varying length and these subnet prefixes are represented with the same ip-address/prefix-length notation used for IPv4 CIDR prefixes. In the case of IPv6:

  • ip-address is an IPv6 address in any of the hex notations listed above.
  • prefix-length is a decimal value specifying the number of the leftmost bits in the address that make up the prefix.

 

For example, assuming that the IPv6 address used above is part of a 64-bit prefix, it could be represented in the following ways:

  • 2001:0db8:0000:0000:0000:0000:0000:0001/64
  • 2001:db8:0:0:0:0:0:1/64
  • 2001:db8::1/64

 

The prefix itself is represented as 2001:db8::/64. And yes, the double colon is required.

Stay Tuned!

I really hope you found this information useful! Now you can dig into the various types of IPv6 addresses in Part 2: Classifying IPv6 Addresses (Hint: There’s more than just Multicast and Unicast). Plus you can always go read the whole book!

13 Comments

  1. Fred Bovy 4 February 2012 at 08:33 - Reply

    Very nice post and cool site !
    A model to get inspired from…
    Congrats colleague!

  2. […] his first post in the 4-part series, Understanding IPv6 Addresses, Chris goes down to a bit level to explain exactly why we wound up writing IPv6 addresses in […]

  3. Anoop 8 May 2016 at 01:15 - Reply
  4. […] you’ve read the entire series (you have haven’t you?), than you have already learned to understand and classify IPv6 addresses as well as all about IPv6 headers. That means it’s time for you […]

  5. […] in part 1 of this series, you learned the basics of IPv6 address construction and format. Now you can complement that […]

  6. dude 8 April 2017 at 23:08 - Reply

    just curious here. are there such ipv6 addresses that look like:

    1111:1111:1111:1111:1111:1111:1111:1111

    or

    aaaa:aaaa:aaaa:aaaa:aaaa:aaaa:aaaa:aaaa

    or is there a certain range that won’t or can’t be used due to security reasons or being reserved(owned)?

  7. Ken 14 August 2017 at 14:41 - Reply

    I went through quite a few google results before I found your article. My goodness, your explanation is simply the best! As far as I can see, you are the only one who is willing to go through the trouble of typing out 128 binary digits, and that not only helped me understand the concept much more quickly, it also imprinted a visual in my memory. The only part I struggled a little with was the conversion from binary to hexadecimal. I wished you had included the conversion table too. And the other thing I realized as I am typing this is why are my words grey in the comment box it is so hard to read against the dark teal background! But still, thanks for your explanation I really appreciate it.

  8. […] that you’re up to speed on IPv6 addresses (you did read Part 1: Understanding IPv6 Addresses and Part 2: Classifying IPv6 Addresses, right?), it’s time for you to dig a little bit deeper […]

  9. Said Bakr 7 March 2020 at 07:36 - Reply

    I wonder, they need more IPs, so why not the representation keeps the backward compatibility?! i.e. instead of four triplets, it is going to be four quadrlets like 2048.2048.2048.2048 or even 8192.8192.8192.8192. By this way an easy to represent, memorable and backward compatible with IP4. Indeed I don’t know the technical barrier the cease doing such idea.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.