Shortening IPv6 Addresses

Hello Narad

For each hextet, you must either remove leading zeros or trailing zeros. If you remove both, then you will not have a unique address. For example, let’s sa you have the following:

2041:0010:140F::875B:131B

In that second hextet, we have 0010. If you remove both the leading and trailing zeros, you get this:

2041:1:140F::875B:131B

But how is a network device to know what that single “1” means? How many trailing and/or leading zeros were removed? It could be 1000, 0100, 0010, or 0001, there is no way to tell.

So, you must either remove leading zeros, OR trailing zeros not both. So by convention, they decided to remove only the leading zeros.

I don’t know the official reasoning behind the choice, but I can tell you why I think they decided to use hex. When dealing with IPv6 addresses, it is most useful to use binary. It’s easier to deal with prefixes, subnets, and so on. That’s how network devices see these addresses too, however, writing out 128 bits in binary becomes difficult to read for humans. An alternative had to be found.

Using hexadecimal becomes easier than decimal because it is base 16. This means that each hex digit corresponds to four bits exactly. Decimal digits however don’t correspond exactly to a certain number of bits. This makes subnetting and other calculations much easier with hex because you can subnet on the boundaries between the hex digits, and know what that prefix will be. With decimal, it’s not possible. Remember IPv4 subnetting? When you use dotted decimal format, it can become difficult to subnet.

I hope this has been helpful!

Laz