Address Format¶
An IPv6 address consists of 32 hexadecimal digits, in 8 sections of 4 digits
each, separated by colons. It looks something like this:
1234:5678:90ab:cdef:1234:5678:90ab:cdef
IPv6 addresses have several shortcuts that allow them to be compressed into smaller strings following certain rules.
If there are any leading zeroes in a section, they may be left off.
0001:0001:0001:0001:0001:0001:0001:0001
could be written as
1:1:1:1:1:1:1:1
.
Any number of address parts consisting of only zeroes may be compressed by using
::
but this can only be done once in an IPv6 address to avoid ambiguity. A
good example of this is local host, compressing
0000:0000:0000:0000:0000:0000:0000:0001
to ::1
. Any time ::
appears
in an IPv6 address, the values between are all zeroes. An IP address such as
fe80:1111:2222:0000:0000:0000:7777:8888
, can be represented as
fe80:1111:2222::7777:8888
. However,
fe80:1111:0000:0000:4444:0000:0000:8888
cannot be shortened using ::
more than once. It would either be fe80:1111::4444:0:0:8888
or
fe80:1111:0:0:4444::8888
but it cannot be fe80:1111::4444::8888
because there is no way to tell how many zeroes have been replaced by either
::
operator.
Determining an IPv6 Addressing Scheme¶
Because of the increased length of the addresses, the vast space provided in even a basic /64 subnet, and the ability to use hexadecimal digits, there is more freedom to design device network addresses.
On servers using multiple IP address aliases for virtual hosts, jails, etc, a
useful addressing scheme is to use the seventh section of the IPv6 address to
denote the server. Then use the eighth section for individual IPv6 aliases. This
groups all of the IPs into a single recognizable host. For example, the server
itself would be 2001:db8:1:1::a:1
, and then the first IP alias would be
2001:db8:1:1::a:2
, then 2001:db8:1:1::a:3
, etc. The next server would be
2001:db8:1:1::b:1
, and repeats the same pattern.
Some administrators like to have fun with their IPv6 addresses by using
hexadecimal letters and number/letter equivalents to make words out of their IP
addresses. Lists of hexadecimal words around the web can be used to create
more memorable IP addresses such as 2001:db8:1:1::dead:beef
.
Decimal vs. Hexadecimal Confusion¶
Creating consecutive IPv6 addresses with a hexadecimal base may cause confusion.
Hexadecimal values are base 16 unlike decimal values which are base 10. For
example, the IPv6 address 2001:db8:1:1::9
is followed by
2001:db8:1:1::a
, not 2001:db8:1:1::10
. By going right to
2001:db8:1:1::10
, the values a-f
have been skipped, leaving a gap.
Consecutive numbering schemes are not required and their use is left to the
discretion of the network designer. For some, it is psychologically easier to
avoid using the hexadecimal digits.
Given that all IPv4 addresses can be expressed in IPv6 format, this issue will arise when designing a dual stack network that keeps one section of the IPv6 address the same as its IPv4 counterpart.