IPv6 Address Representation

The length of IPv6 addresses are 128 bits and represented as eight groups of four hexadecimal digits each, each group representing 16 bits. The address can be written both lowercase or in uppercase. The preferred format for writing an IPv6 address is x: x: x: x: x: x: x: x, where each “x” is the group of four hexadecimal digits and each group contains 16 bits. The term used for a group is a hextet.  So each “x” is a single hextet, 16 bits or four hexadecimal digits.

The range of IPv6 addresses are 0000:0000:0000:0000:0000:0000:0000:0000 to FFFF: FFFF: FFFF: FFFF: FFFF: FFFF: FFFF: FFFF. This expression is in hexadecimal. If we convert one hextet into binary it should be 16 bits, for example, we have a hextet “0000” it is equal to 0000000000000000 (16 time 0s) and hextet “FFFF” is equal to 1111111111111111 (16 tim1 1s). The basic relationship table of binary, decimal, and hexadecimal is following.

DecimalBinaryHexadecimal
000000
100011
200102
300113
401004
501015
601106
701117
810008
910019
101010A
111011B
121100C
131101D
141110E
151111F

The ideal method of representing IPv6 address is groups of eight hextet (32 hexadecimal digits). However, there are two rules we can apply to reduce the number of digits needed to represent an IPv6 address. The preferred format for representing an IPv6 address is following.

2001 : 0000 : 0000 : 1111 : 1234 : 1000 : A000 : 0100

2001 : 0DA1 : B111 : 0000 : 0000 : ABCD : 0BCD : 1245

FE80 : 0000 : 2BCD : 0000 : 1234 : 4567 : 89AB : CDEF

FE80 : 8BAB : 0000 : 0000 : 0000 : 0000 : 0000 : 0123

FF02 : 0000 : 0000 : 0000 : 0000 : 0000 : 0000 : 0001

FE02 : 0000 : ABBB: 0000 : 0000 : 0001 : FF00 : 0200

0000 : 0000 : 0000 : 0000 : 0000 : 0000 : 0000 : 0001

0000 : 0000 : 0000 : 0000 : 0000 : 0000 : 0000 : 0000

Omitting Leading 0s

Omitting leading 0 is the first rule to reduce the notation of IPv6 address.  Following are the examples to omit any leading 0s (zeros) in any 16-bit section or hextet:

  • 0100 can be represented as 100
  • 0DA1 can be represented as DA1
  • 0123 can be represented as 123
  • 0000 can be represented as 0

This rule only omits leading 0s, not trailing 0s, otherwise, the address would be ambiguous.  The table below shows the examples of omitting leading 0s from the IPv6 address.

IPv6 Address

Omit All 0 Segments

The second rule reduces the notation of IPv6 addresses using a double colon (::)  that can replace any single, contiguous string of one or more hextet containing all 0s. The double colon (::) can only be used once within an address, otherwise there would be more than one possible resulting address. For example, if we have an IPv6 address FE02: 0000 : ABBB: 0000: 0000: 0001: FF00: 0200 and we apply the technique like FE02:: ABBB:: 1: FF00: 200. It is not correct.  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.

IPv6 Address

Prefix Length Notation

The most left bits of the IPv6 address along with the network bits length represented in CIDR format is known as the network prefix. The prefixes in IPv6 are uses similar to the subnet mask of IPv4 addresses. In IPv6, we use a notation similar to CIDR mask representation in IPv4. The notation values are between 1 and 128 to represent the network bits.

For example, in IPv6 address 2001: ABC8: 1000: 000C: 0000: 0000: 0000: 0001/ 64, 2001: ABC8: 1000: 000C::/64 represents the network prefix and the range for this IP network is from 2001: ABC8: 1000: 000C: 0000: 0000: 0000: 0001/64to 2001: ABC8: 1000: 000C: ffff: ffff: ffff: ffff/64.

The first 3 hextet (48 bits ) 2001:ABC8:1000 are the IPv6 global routing prefix and the next 16 bits(hextet)  “000C ” are used for internal subnetting within an organization and the last 64 bits are used for internal hosts of the network. The Length of IPv6 prefix is used to recognize how many bits of a Global Unicast IPv6 Address are there in network part.