Nibbles & Bits

IPv6 Compression Rules: All You Need to Know but Were Afraid to Ask

by | July 6, 2022

For years, the internet and the devices that connect to it have steadily been working toward IPv6 from the previous version of the internet protocol, IPv4. As the world was quickly running out of IP address options due to the proliferation of digital devices, it became important to upgrade to IPv6 to open up trillions of more potential IP addresses. This vast expansion in capacity is due to the use of 128-bit addresses in IPv6 as opposed to just 32-bit addresses in IPv4. 

Of course, it follows that IPv6 addresses will be much longer than their predecessors, due to all of those extra bits. In its natural state, an IPv6 address uses eight fields that are separated by colons, and within each of those eight fields is 16 bits. To make this new protocol easier to use, it’s helpful to compress the address into something a little more manageable. However, there are rules that must be followed to perform the compression correctly and still point to the correct address. Let’s take a closer look at how the compression rules work below. 

Following the Three Rules of IPv6 Compression
To properly compress an IPv6 address down into something more manageable and easier to use, there are three rules that you must follow. Properly adhering to these three rules means the address you are left with will correspond properly to the full-length version that you started with. The three rules are as follows –

Rule One – Zero Compression
To start with, a run of continuous zeroes can be eliminated when compressing an IPv6 address. In the place of those zeroes, you simply use a double colon or “::” symbol. Rather than the single colon that typically breaks up the eight fields of the address, this double colon is an indication that a segment of continuous zeroes has been removed. For example, consider the two versions of an IPv6 address below –

  • Before: 1111 : 0000 : 0000 : 0000 : 1234 : abcd : abcd : abcd
  • After: 1111 :: 1234 : abcd : abcd : abcd

The double-colon has removed the block of 12 zeroes in the middle of the address, and the compressed version is significantly smaller as a result.

Rule Two – Leading Zero Compression
In this rule, you are still getting rid of zeroes, but in this case, it’s the leading zeroes in each field that will be eliminated. So, if any of the eight fields in the address starts with a zero, or multiple zeroes, you can remove those zeroes without impacting the resulting address. In this case, you would not use the “::” symbol, and would instead just stick with the standard single colon divider between fields. Again, we’ll look at an example –

  • Before: 1111 : 0123 : 0012 : 0001 : abcd : 0abc : 9891 : abcd
  • After: 1111 : 123: 12 : 1 : abcd : abc : 9891 : abcd

In this case, the compression pulls out the leading zeroes in each segment, accounting for a total of seven fewer characters being used in the address.

Rule Three – Discontinuous Zero Compression
Finally, the third rule allows you to deal with an address that has a discontinuous pattern of zeroes. To compress such an address, the first section of zeroes is replaced with the “::” symbol. Then, for the next zero fields, you can simply shorten them to one zero each and divide them with a single colon. One last example will help make this point rule clearer –

  • Before: 1111 : 0 : 0 : abcd : 0 : 0 : 1234 : abcd
  • After: 1111 :: abcd : 0 : 0 : 1234 : abcd

Here, the first joining of zeroes has been dropped in favor of a double colon, while the second set of consecutive zeroes was left in its original state.

It’s much more appealing to work with IPv6 addresses when you have a quick and easy way to compress them down into a more manageable length. Now that you know the rules for compression, it will be easy to deploy these rules any time you need to handle these longer IP address forms. Also, there are several free compression tools available online to automate the process of shortening such an address. You may see this in action here IPv6 Calculator. If you are in the process of converting to IPv6, or have recently completed such a conversion and are trying to get used to the new system, knowing how to compress addresses properly will make life a little easier.

“We decided to move our rather complex IP address and DHCP management process to ProVision and it has worked out great for us!! The team at 6connect were very flexible and went above and beyond to accommodate our requirements and helped to make the migration as smooth and hitch free as possible. Kudos to the team @ 6connect!”

Premkumar Subramaniam
Head of R&D
viewquest

“We are excited to be partnering with 6connect to leverage their technology and talent. We particularly admire their long-standing IPv6 contributions and their ability to service and support customers in this area, some who are the largest service provider in the world. The 6connect executive leadership team and technical team are great to work with and we look forward to many partnered projects to help customers address their Cloud, IoT and Security needs with IPv6. Automation, workflow and orchestration are critical to the success of most of these projects and 6connect is well positioned to help our mutual customers in those areas.”

Ed Horley
Co-Founder & CEO
HexaBulid

“Enterprises can struggle managing purposefully segmented DDI architectures with any agility. Our partnership with 6connect empowers customers with complex infrastructures to move faster to service the business while consolidating visibility and control over their estate.”

Andrew Wertkin
Chief Strategy Officer,
BlueCat

“6connect’s approach to automation addresses quite a few challenges with physical and virtual networks – how to improve the agility of your current network infrastructure without sacrificing reliability and adoption of future network technologies.”

Pär Lange
Investment Director
SwissCom

“A customer is looking for an integrated solution from a single vendor for both IPAM and DNS. Through the 6connect reseller program, Secure64 is able to offer the most secure DNS solutions married to a unique combination of IPAM and resource provisioning that customers want. It’s a marriage made in heaven.”

Mark Beckett
VP of Marketing
Secure64

“A huge benefit of working with the 6connect team is that they devoted a lot of resources to get our products integrated so we had the turnkey solution that we could take to market. It was very easy to work with their team to get product integrated and successfully launched.”

Mark Beckett
VP of Marketing
Secure64

You have IPv6!

You’re on IPv4.

Explore ProVision Suite

Resource Controller

DNS/DNSSEC

IPAM

DHCP Controller

Peering Controller

REST API

Talk to one of our Engineers

6connect