IPv6 addresses are 128 bit binary numbers (represented in hexadecimal format), which are so lengthy and difficult handle in our day-to-day life. Consider a situation where you need to ping to an IPv6 address 2001:0db8:0000:000b:0000:0000:0000:001A to check the network connectivity. Think about the pain in typing all those IPv6 address hexadecimal characters in any shell prompt.
Somehow we need to shorten and simplify IPv6 addresses to use it with more ease in our day-to-day life. IPv6 addresses often contain consecutive zeros.
We can further simplify shorten and compress IPv6 Addresses using following methods.
Consider the IPv6 Address 2001:0db8:0000:000b:0000:0000:0000:001A as an example.
• Omit leading zeros: For simplifying and shortening lengthy IPv6 Address, we can omit the leading zeros in any 16-bit IPv6 Address blocks.
For example, in IPv6 address 2001:0db8:0000:000b:0000:0000:0000:001A the leading zeros are marked as 2001:0db8:0000:000b:0000:0000:0000:001A.
After removing the leading zeros, the IPv6 Address quoted above can be written as 2001:db8:0:b:0:0:0:1A
• Compress consecutive hexadecimal fields of zeros using Double colon: IPv6 addresses can be further simplified by using double colons (::) in place of a series of consecutive hexadecimal zeros.
For above example 2001:db8:0:b:0:0:0:1A, we have a series of three consecutive fields of hexadecimal zeros as marked 2001:db8:0:b:0:0:0:1A.
We can further simplify and shorten the above IPv6 Address as 2001:db8:0:b::1A.
Note that compressing and shortening a series of consecutive fields of hexadecimal zeros in an IPv6 Address is possible ONLY once. If you compress a series of consecutive fields of hexadecimal zeros twice in an IPv6 Address, it will be impossible to identify how many zeros and compressed in each double colon (::).