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. For example, doesn’t a :: (double colon) look better than a ..(double dot)? 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). Here’s a summary of what I just said:
|32 Bit||128 Bit|
|2^32 possible IPv4 addresses||2^128 possible IPv6 addresses|
|Represented in Decimal||Represented in Hexadecimal|
|Grouped in 8-bit Octet||Grouped in 16-bit Hextet. (Each Hextet actually has 4 Hexadecimal Digit also known as “Nibble“)|
|4 Octets separated by dot (.) hence called dotted decimal format||8 Hextets separated by colon (:) hence called coloned hexadecimal format|
IPv6 Address Representation
- 4-bits represent a hexadecimal digit (known as a Nibble)
- 4 nibbles (16-bits) make a hextet
- 8 hextets makes the complete IPv6 Address
- Hextets are separated by a colon (:)
Let’s have a quick recap of Decimal and Hexadecimal conversion.
Now, we’ll describe two methods to abbreviate large IPv6 address into a possible smaller look.
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
All the acceptable format is mentioned in the initial part of the RFC4291. Have a look!
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/64 represents the same address as 2001:db8:2f:b::a/64
Representation of prefix is just like IPv4 CIDR. Like an IPv4 address: 220.127.116.11/16, IPv6 address is represented in the same way: 2001:db8:12::/40
URL Access using IPv6 Address
To access an website using IPv6 address, you need to write the IPv6 address of the server within the square brackets. It’s just to avoid confusion while using port number after the colon. For example: