IPv4 addresses are represented in dotted decimal format. The 32-bit
address is divided along 8-bit boundaries. Each set of 8 bits is
converted to its decimal equivalent and separated by periods. In
contrast, IPv6 addresses are 128 bits divided along 16-bit boundaries.
Each 16-bit block is converted to a 4-digit hexadecimal number and
separated by colons. The resulting representation is called colon-hexadecimal.
The following forms are the three conventional forms for representing
IPv6 addresses as text strings:
- The preferred form is x:x:x:x:x:x:x:x, where the x's are the hexadecimal
values of the eight 16-bit pieces of the address. For example:
2001:DB8:7654:3210:FEDC:BA98:7654:3210
2001:DB8:0:0:8:800:200C:417A
Guideline: You do not need to write the leading
zeros in an individual field, but there must be at least one numeral
in every field (except for the case described in the following item).
- As a result of some methods of allocating certain styles of IPv6
addresses, sometimes addresses contain long strings of zero bits.
To make writing addresses containing zero bits easier, a special
syntax is available to compress the zeros. A double colon (::) indicates
multiple groups of 16 bits of zeros and can appear only once in an
address. The double colon can also be used to compress both leading
and trailing zeros in an address.
For example the following addresses:
Table 1. Address typesAddress type |
Long form |
Compressed form |
---|
Unicast |
2001:DB8:0:0:8:800:200C:417A |
2001:DB8::8:800:200C:417A |
Multicast |
FF01:0:0:0:0:0:0:101 |
FF01::101 |
Loopback |
0:0:0:0:0:0:0:1 |
::1 |
Unspecified |
0:0:0:0:0:0:0:0 |
:: |
- An alternative form that is sometimes more convenient
when dealing with a mixed environment of IPv4 and IPv6 nodes is x:x:x:x:x:x:d.d.d.d,
where the x's are the hexadecimal values of the six high-order 16-bit
pieces of the address, and the d's are the decimal values of the four
low-order 8-bit pieces of the address (standard IPv4 representation).
This form is used for IPv4-mapped IPv6 addresses. This type of address
is used to hold an embedded IPv4 address. The address can be expressed
in the following manner:
0:0:0:0:0:FFFF:129.144.52.38
The
address can also be expressed in compressed form:
::FFFF:129.144.52.38