#### IPv6 Addressing

Okay folks, get out your scientific
calculators. It is time to do some binary, decimal, and hexadecimal
conversions. Fun! With the expanded address space associated with IPv6,
the developers of IPv6 decided to leverage the hexadecimal numbering
system to simplify and reduce the number of characters to identify the
IPv6 address. IPv6 addresses are 128 bits in length and much longer
than the 32-bit IPv4 address. But before we can dive deeper, the bit
count is actually derived from the binary numbering system, which uses
only 0s and 1s to represent any number. Binary numbering is also called
base-2, because it uses only two numeric values, 0 and 1. Decimal uses
base-10 numbering that ranges from 0 to 9, and hexadecimal uses base-16
numbering that ranges from 0 to f, as shown in Table 1.

Table 1. Number Conversions

From our well-known
decimal system to convert to and from binary and hexadecimal, you need
to learn how to add in each of the three systems. Figure 1 shows the representation of 165 in all three systems and may help explain how addition works in each system.

Figure 1. Counting in binary, decimal and hexadecimal.

By now, you are probably building a base of
information about hexadecimal numbering, and so we will continue with
an actual example of an IPv6 IP address.

Network addressing for IPv4 is broken down
into four 8-bit groups, totaling 32 bits and divided by periods. Each
group can range from 0 to 255 and is represented in three decimal
digits, such as the IP address 192.168.101.101. It is common with IPv4
addresses to drop leading 0s. For example, the IP address
192.168.100.010 is normally written as 192.168.100.10. IPv6 addresses,
being 128 bits in length, are broken down into eight 16-bit boundaries
or groups and are separated by colons. With IPv6 addresses, it is also
common to drop leading 0s, but because the addresses are so long, other
actions are often taken to shorten the address. The following IPv6
address is written using different forms of character reduction to
simplify the notation of the full address, which is listed first:

• 2001:0dba:1234:aaaa:0000:0000:3a5f:0456

• 2001:dba:1234:aaaa:0000:0000:3a5f:456 (leading 0 dropped from last two groups)

• 2001:dba:1234:aaaa:0:0:3a5f:456 (0 groups compressed)

• 2001:dba:1234:aaaa::3a5f:456 (consecutive 0 groups replaced with ::)

Reducing the address as much as possible is
highly preferred and now considered the correct way to notate an IPv6
address. You can find more information about notation standards for
IPv6 in RFCs 4291, 5952, and 6052. One important point with character
reduction, particularly with 0 groups, is that there can only be one
set of double colons; if there happens to be more than one consecutive
set of 0 groups, the double colon should be used to compress the larger
of the two groups to make the biggest character reduction as possible.

Note

The IPv6 network prefix of 2001:db8 has been
designated as the range to use for IPv6 documentation examples only as
detailed in RFC 3849. Do not use this address range on any production
IPv6 deployments.