IPv6 Addressing Format
IPv6 Address is ridiculously 128-bit or 16-byte long compared to the 32-bit IPv4 address. We all know that and it actually scares many of us. Good news is IPv6 is represented in hexadecimal number format whereas IPv4 is in decimal number format. Hence, each four bit in an IPv6 address is shrunken to a single hex digit, which means 128 binary bits are reduced down to 32 hex digits. Not only that, I think there were a group of artists 😉 in the IETF IPv6 WG who thought it would look beautiful if we use semi-colon (:) instead of dot (.) used in IPv4. So, they chose to represent IPv6 addresses as “Coloned Hex” format: X:X:X:X:X:X:X:X (X = 16 bit field but represented by 4 hex digit).
IPv6 Address Representation
Rule 1: Leading zeroes within a 4-hex digit (16-bit) field may be omitted.
2031:0000:130F:0000:0000:09C0:876A:130B can be represented as 2031:0:130F:0:0:9C0:876A:130B
Rule 2: Only a single occurrence of consecutive groups of zeroes may be replaced by a double colon (::).
2031:0:130F:0:0:9C0:876A:130B can be represented either as 2031:0:130F::9C0:876A:130B or as 2031::130F:0:0:9C0:876A:130B but not as as 2031::130F::9C0:876A:130B
FF02:0000:0000:0000:0000:0000:0000:1 can be represented as FF02::1
2001:0000:0000:51F4:0000:00C8:C0A8:6420 can be represented either as 2001::51F4:0:C8:C0A8:6420 or as 2001:0:0:51F4::C8:C0A8:6420 but not as 2001::51F4::C8:C0A8:6420
3FFE:0501:0008:0000:0260:97FF:FE40:EFAB can be represented as 3FFE:501:8::260:97FF:FE40:EFAB
RFC5952 recommends that the rightmost set of :0: be replaced with :: for consistency.
2001:db8:0:2f::5 rather than 2001:db8::2f:0:0:0:5
2001:db8:0:0:15::5 rather than 2001:db8::15:0:0:5
The hexadecimal digits A-F are case-insensitive in IPv6 address representation. Life saved, isn’t it!
2001:DB8:2F:B::A represents the same address as 2001:db8:2f:b::a
Representation of prefix is just like IPv4 CIDR. Like an IPv4 address: 184.108.40.206/16, IPv6 address is represented in the same way: 2001:db8:12::/40