IPv6 addresses are 128 bits in length and represented as eight groups of four hexadecimal digits each, each group representing 16 bits. The address can be written in either lowercase or uppercase.
As we know that IPv6 address is 128 bit and in 8 groups so the preferred format for writing an IPv6 address is x:x:x:x:x:x:x:x, where each “x” containing four hexadecimal values.
Each group of In IPv6 is consisting of 16 bit and the term used for a group is a hextet. So each “x” is a single hextet, 16 bits or four hexadecimal digits.
X : X : X : X : X : X : X : X
To : To : To : To : To : To : To : To
If we convert in hextet into binary it should be 16 bit, for example, we 0000 hextet is equal to 0000000000000000 and FFFF hextet is equal to 1111111111111111. Following is the basic relationship table of binary, decimal, and hexadecimal.
The IPv6 address is written using all 32 hexadecimal digits. It is the ideal method for representing the IPv6 address. But there are two rules which help to reduce the number of digits needed to represent an IPv6 address. Following is the preferred format for
Figure 2 is a review of the relationship between decimal, binary and hexadecimal. Figure 3 has examples of IPv6 addresses in the preferred format for representing the IPv6 addresses.
2001 : 0000 : 0000 : 1111 : 1234 : 0000 : 0000 : 0100
2001 : 0DA1 : B111 : 0000 : 0000 : ABCD : 0000 : 1245
FE80 : 0000 : 0000 : 0000 : 1234 : 4567 : 89AB : CDEF
FE80 : 0000 : 0000 : 0000 : 0000 : 0000 : 0000 : 0123
FF02 : 0000 : 0000 : 0000 : 0000 : 0000 : 0000 : 0001
FE02 : 0000 : 0000 : 0000 : 0000 : 0001 : FF00 : 0200
0000 : 0000 : 0000 : 0000 : 0000 : 0000 : 0000 : 0001
0000 : 0000 : 0000 : 0000 : 0000 : 0000 : 0000 : 0000
Rule 1 – Omit Leading 0s
Omit leading 0 is the first rule which helps to reduce the notation of IPv6 address. Following are the examples to omit any leading 0s (zeros) in any 16-bit section or hextet:
01BC can be represented as 1BC
07FA can be represented as 7FA
0F00 can be represented as F00
00A0 can be represented as A0
000A can be represented as A
This rule only applies to leading 0s, NOT to trailing 0s, otherwise, the address would be ambiguous. The table below shows the examples of omitting leading 0s from IPv6 address.
Rule 2 – Omit All 0 Segments
The second rule to reduce the notation of IPv6 addresses is that a use of double colon (::) that can replace any single, contiguous string of one or more 16-bit segments (hextets) consisting of all 0s.
The double colon (::) can only be used once within an address, otherwise there would be more than one possible resulting address. When used with the omitting leading 0s technique, the notation of IPv6 address can often be greatly reduced. This is commonly known as the compressed format.
- 2001 : : 1111 : 1234 : : 100
Possible expansions of ambiguous compressed addresses: