When learning IPv6 addressing, one of the first things that people notice is that it is much more complex to look at than the previous IPv4 addresses; this is compounded by the fact that a single address can be notated in a number of different ways and still refers to the same device. This article takes a look at IPv6 notation, how a single IPv6 address can be notated in a number of different ways, and how to expand and compress them correctly.
Internet Protocol version 6 (IPv6) addresses consist of eight groups of hexadecimal quartets separated by colons.
IPv6 offers other networking advantages. In most cases, computers and applications will detect and take advantage of IPv6-enabled networks and services without requiring any action from the user. IPv6 also relieves other networking issues that can arise due to the limited number of addresses available on IPv4. For example, IPv6 reduces the need for Network Address Translation, a service that allows multiple clients to share a single IP address, but is not always reliable.
Fortunately, you can shorten IPv6 addresses by eliminating zeros. There are two rules that you must follow when condensing an IPv6 address.
First, you can use
:: to indicate you removed one or more groups of four consecutive zeros (0000). The final shorthand address can only contain one set of double colons. Using this rule alone, we can condense our example address to:
The second rule lets you make this address shorter. Now, you can remove any leading zeros in a group until the group starts with something other than zero, or is the final numeral left as a placeholder for the group. Starting with our previous example:
Notice that in each line we stripped away the leading zero from each section. The section of zeros that were separated from the other groups of zeros is now notated as a single zero (because IPv6 only allows a single set of double colons).