IPv6 Address Representation

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:

IPv4 IPv6
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.

Decimal Hexadecimal
0000 0
0001 1
0010 2
0011 3
0100 4
0101 5
0110 6
0111 7
1000 8
1001 9
1010 A
1011 B
1100 C
1101 D
1110 E
1111 F

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.

Example:

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 (::).

Example:

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!

Note 1

RFC5952 recommends that the rightmost set of :0: be replaced with :: for consistency.

Example:

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

Note 2

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

Prefix Representation

Representation of prefix is just like IPv4 CIDR. Like an IPv4 address: 198.10.0.0/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:

https://[2001:db8::c01d:c0:ffee:80]:8080/index.html

One Reply to “IPv6 Address Representation”

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.