8-2. IPv6 Addressing
It was previously mentioned that IPv6 uses a 128-bit address technique, as compared to IPv4’s 32-bit address structure. There is also a difference in the way the IP addresses are listed. IPv6 numbers are written in hexadecimal rather than dotted decimal, as with IPv4. For example, the following is an IPv6 address represented with 32 hexadecimal digits Note: 32 hex digits with 4 bits/hex digit = 128 bits):
This is classified as a full IPv6 address. The full means that all 32 hexadecimal positions contain a value other than 0.
Why doesn’t IPv6 use the “dotted decimal” format of IPv4? The answer is it would take many decimal numbers to represent the IPv6 address. Each decimal number takes at least seven binary bits in ASCII (American Standard Code for Information Interchange) code. For example, the decimal equivalent of the first eight hexadecimal characters in the previous full IPv6 address is
- 6789:ABCD = 126.96.36.199
The completed decimal equivalent number for the full IPv6 address is
The equivalent decimal number is 42 characters in length. In fact, the decimal equivalent number could be 48 decimal numbers long.
In terms of bits, one 4 hex bit group requires 4 x 4 = 16 bits. Assuming that 8 bits are used to represent the decimal numbers, it will take 12 x 8 = 72 bits to express one hex bit group in a decimal format. There is a significant bit savings obtained by expressing the IPv6 address in a hexadecimal format.
IPv6 uses seven colons (:) as separators to group the 32 hex characters into 8 groups of four. Some IPv6 numbers will have a 0 within the address. In this case, IPv6 allows the number to be compressed to make it easier to write the number. The technique for doing this is called double-colon notation. For example, assume that an IPv6 number is as follows:
Consecutive 0s can be dropped and a double-colon notation can be used as shown:
Recovering the compressed number in double-colon notation simply requires that all numbers left of the double notation be entered beginning with the leftmost slot of the IPv6 address. Next, start with the numbers to the right of the double colon.
Begin with the rightmost slot of the IPv6 address slots and enter the numbers from right to left until the double colon is reached. Zeros are entered into any empty slots:
- 6789 :0 :0 :EF98 :7654 :321F :EDCB :AF21
IPv4 numbers can be written in the new IPv6 form by writing the IPv4 number in hexadecimal and placing the number to the right of a double colon. Example 8-1 demonstrates how a dotted-decimal IP number can be converted to IPv6 hexadecimal.
Example 8-1. Convert the IPv4 address of 192.168.5.20 to an IPv6 hexadecimal address
Similar to IPv4 classless addresses, IPv6 addresses are fundamentally divided into a network portion followed by a host portion. The network portion is called the network prefix and the number of bits used is the prefix length. The prefix is represented with a slash followed by the prefix length. This is the same notation used to designate the CIDR in IPv4. For example, the IPv6 address of 2001:DB8:FEED:BEEF::12 has a 64-bits network prefix. It then can be represented as 2001:DB8:FEED:BEEF::12/64. However, the concept of a CIDR is not relevant in IPv6, because there is enough IP address space for everyone. So, in IPv6, the host portion of the address or what is called the interface identifier is always 64-bits in length. This automatically leaves 64 bits as the network prefix. In a typical IPv6 customer site, a network of /48 is usually allocated by IANA. This provides the site with 65,536 subnets, which is more than sufficient. This means that when a site is assigned a /48, the site is capable of having up to 65536 subnets and each subnet is capable of hosting more than 1.8x1019 IPv6 addresses.
There are three types of IPv6 addresses: unicast, multicast, and anycast. The unicast IPv6 address is used to identify a single network interface address and data packets are sent directly to the computer with the specified IPv6 address. There are several types of unicast addresses, including link-local addresses, global unicast addresses, and unique local addresses. Link-local addresses are designed to be used for and are limited to communications on the local link. Every IPv6 interface will have one link-local address.
Per RFC 4291, “IP Version6 Addressing Architecture,” the network prefix of link-local addresses, is defined as FE80::/10. Unique local unicast addresses are addresses for local use only, and they are similar to the private IP addresses used in IPv4. Unique local unicast addresses use the prefix of FD00::/8 and were designed to replace site-local addresses, which are being deprecated.
Global unicast addresses are equivalent to the public ip addresses in IPv4. They have unlimited scope, and they are routable on the Internet. IANA is responsible for allocating the IPv6 global unicast address space. Currently, the range of allocated IPv6 addresses starts from prefix 2000::/3.
IPv6 multicast addresses are defined for a group of networking devices. Data packets sent to a multicast address are sent to the entire group of networking devices such as a group of routers running the same routing protocol. Multicast addresses all start with the prefix FF00::/8. The next group of characters in the IPv6 multicast address (the second octet) are called the scope. The scope bits are used to identify which ISP should carry the data traffic.
The anycast IPv6 addresses might seem like a new type of address, but the concept was not new. Anycast addresses can be thought of as a cross between unicast and multicast addresses. While the unicast traffic sends information to one address and the multicast traffic sends information to every address in the group, the anycast traffic sends information to any one address of the group. The trick is which address of the group to send information to. The most logical and efficient answer is the nearest or the closet address. Similar to multicast where the nodes will join the multicast group, the anycast nodes share the same anycast address. The data will be sent to a node within the anycast group. This node is the nearest to the sender.
Actually, the anycast concept is used in the IPv4 environment today with the root DNS servers. There are 13 DNS root servers in the world, but the DNS query is only sent to one of those servers.
IPv6 addressing is being used in a limited number of network sites (e.g., the federal government); however, the Internet is still running IPv4 and will be for some time. But, there are transition strategies in place to help with the IPv4 to IPv6 transition.
One possible transition to IPv6 is called the 6to4 Prefix, which is essentially a technique that enables IPv6 sites to communicate over the IPv4 Internet. This requires the use of a 6to4 enabled router, which means that 6to4 tunneling has been enabled. This also requires the use of a 6to4 Relay router that forwards 6to4 data traffic to other 6to4 routers on the Internet.
Figure 8-3 illustrates the structure of the 6to4 prefix for hosts. The 32 bits of the IPv4 address fit into the first 48 bits of the IPv6 address.
Figure 8-3. The 6to4 prefix format
Note the following shown in Figure 8-3:
- FP is the Format Prefix, which is made up of the higher order bits. The 001 indicates that this is a global unicast address. The current list of the IPv6 address allocation can be viewed at www.iana.org/assignments/ipv6-unicast-address-assignments. Currently, IANA allocates 2000::/3 as an IPv6 global pool. 2000 can be written in binary as 0010 0000 0000 0000. 001 is the 3 highest order bits, which correspond to the FP.
- TLA ID (0x2002) are the top-level identifiers that are issued to local Internet registries. These IDs are administered by IANA (http://www.iana.org/). The TLA is used to identify the highest level in the routing hierarchy. The TLA ID is 13 bits long.
- V4ADDR is the IPv4 address of the 6to4 endpoint and is 32 bits long.
- SLA ID is the Site Level Aggregation Identifier that is used by individual organizations to identify subnets within their site. The SLA ID is 16 bits long.
- Interface ID is the Link Level Host Identifier and is used to indicate an interface on a specific subnet. The interface ID is equivalent to the host IP address in IPv4.
The 6to4 prefix format enables IPv6 domains to communicate with each other even if they don’t have an IPv6 ISP. Additionally, IPv6 can be used within the intranet, but access to the Internet is still available. The 6to4 provides unicast IPv6 connectivity between IPv6 host and via the IPv4 Internet.