In: Computer Science
Implementing IPv4 and IPv6 Addressing
.
IPv4 Addressing
IPv4 addresses are 32 bits long; like all network-level addresses, they have a network portion and a host portion. The network portion uniquely identifies a physical or logical link and is common to all devices attached to that link. The host portion uniquely identifies a particular device attached to the link. The 32 bits of the address comprise four octets, each of which can be represented with a decimal number between 0 and 255, with dots between the decimal representations. The 32-bit address is mapped into a dotted-decimal representation;
An important distinction to remember when working with IPv4 addresses is that dotted decimal is just an easy way for humans to read and write IP addresses. Always remember that the router is not reading an address in terms of four octets; rather, the router sees a 32-bit binary string.
IP addresses may be analyzed using classful or classless logic,
depending on the situation.
Classful logic simply means that the main class A, B, and C rules
from RFC 791 are considered. With classful addressing, class A, B,
and C networks can be identified as such by their first several
bits or by the range of decimal values for their first octets.
There are three sizes of networks as measured by the number of hosts: big (Class A), medium (Class B), and small (Class C). Each class A, B, or C address has two parts (when not subnetted): a network part and a host part. The size of each is implied by the class, and can be stated explicitly using the default mask for that class of network.
Rule | Minimum and Maximum | Decimal Range |
Class A: First bit is always set to 011 |
00000000 = 0
01111111 = 127 |
1 – 126 |
Class B: First bit is always set to 101 |
10000000 = 128
10111111 = 191 |
128 – 191 |
Class C: First bit is always set to 110 |
11000000 = 192
11011111 = 223 |
192 – 223 |
The address mask is a 32-bit string, one bit for each bit of the IPv4 address. As a 32-bit string, the mask can be represented in dotted-decimal format just like an IPv4 address. The address mask can be written in dotted decimal as follows;
Private Addressing
Private IP addressing helps to mitigate from the problem of public IP address depletion by allowing computers that will never be directly connected to the Internet to not use public, Internet-routable addresses. For IP hosts that will purposefully have no direct Internet connectivity, you can use several reserved network numbers, as defined in RFC 1918.
Private Address Space;
Class A – 10.0.0.0 to 10.255.255.255
Class B – 172.16.0.0 to 172.31.255.255
Class C – 192.168.0.0 192.168.255.255
Features of IPv6
IPv6 is a powerful enhancement to IPv4 with features that better suit current and foreseeable network demands, including the following:
Larger address space—IPv6 addresses are 128 bits, compared to IPv4's 32 bits. This larger address space provides several benefits, including: improved global reachability and flexibility; the ability to aggregate prefixes that are announced in routing tables; easier multihoming to several Internet service providers (ISPs); autoconfiguration that includes link-layer addresses in the IPv6 addresses for "plug and play" functionality and end-to-end communication without network address translation (NAT); and simplified mechanisms for address renumbering and modification.
Simplified header—A simpler header provides several advantages over IPv4, including: better routing efficiency for performance and forwarding-rate scalability; no requirement for processing checksums; simpler and more efficient extension header mechanisms; and flow labels for per-flow processing with no need to examine the transport layer information to identify the various traffic flows.
Support for mobility and security—Mobility and security help ensure compliance with mobile IP and IP security (IPsec) standards.
Mobility enables people to move around in networks with mobile network devices, with many having wireless connectivity. Mobile IP is an Internet Engineering Task Force (IETF) standard available for both IPv4 and IPv6 that enables mobile devices to move without breaks in established network connections. Because IPv4 does not automatically provide this kind of mobility, supporting it requires additional configurations.
In IPv6, mobility is built in, which means that any IPv6 node can use it when necessary. The routing headers of IPv6 make mobile IPv6 much more efficient for end nodes than mobile IPv4 does.
IPsec is the IETF standard for IP network security, available for both IPv4 and IPv6. Although the functions are essentially identical in both environments, IPSec is mandatory in IPv6. IPSec is enabled and is available for use on every IPv6 node, making the IPv6 Internet more secure. IPSec also requires keys for each device, which implies global key deployment and distribution.
Transition richness—There are a variety of ways to transition IPv4 to IPv6.
One approach is to have a dual stack with both IPv4 and IPv6 configured on the interface of a network device.
Another technique uses an IPv4 tunnel to carry IPv6 traffic. One implementation is IPv6-to-IPv4 (6-to-4) tunneling. This newer method (defined in RFC 3056, Connection of IPv6 Domains via IPv4 Clouds) replaces an older technique of IPv4-compatible tunneling (first defined in RFC 2893, Transition Mechanisms for IPv6 Hosts and Routers, which has been made obsolete by RFC 4213, Basic Transition Mechanisms for IPv6 Hosts and Routers).
Cisco IOS Software Version 12.3(2)T (and later) also allows NAT protocol translation (NAT-PT) between IPv6 and IPv4, providing direct communication between hosts that are using the different protocol suites.
IPv6 Address Space
Key Point | IPv6 Addresses Are 128 bits |
---|---|
IPv6 increases the number of address bits by a factor of 4, from 32 to 128, providing a very large number of addressable nodes. |
IPv6 Provides Four Times as Many Address Bits as IPv4
With 32 bits, IPv4 allows for approximately 4,200,000,000 possible addressable nodes, with some 2 billion usable addresses. Current IPv4 address use is extended by applying techniques such as private-to-public address space NAT and temporary address allocations (such as addresses leased by the Dynamic Host Control Protocol [DHCP]). However, the manipulation of the packet by intermediate devices complicates the advantages of peer-to-peer communication, end-to-end security, and quality of service (QoS).
In contrast, the 128 bits in an IPv6 address allow for approximately 3.4 ∴ 1038 possible addressable nodes, which works out to approximately 5 ∴ 1028 addresses for every person on our planet!
Thus, IPv6 has enough address space such that every user could have multiple global addresses that can be used for a wide variety of devices; these addresses would be reachable without using IP address translation, pooling, or temporary allocation techniques.
Note, however, that increasing the number of bits for the address also increases the IPv6 header size. Because each IP header contains a source address and a destination address, the size of the header fields that contains the addresses is 256 bits for IPv6 compared to 64 bits for IPv4.
Note - For more information on IPv6 addressing details, refer to RFC 4291, IP Version 6 Addressing Architecture.
IPv6's larger address spaces allow for sizable address allocations to ISPs and organizations. As illustrated in Figure 10-2, an ISP can aggregate all the prefixes of its customers into a single prefix and announce the single prefix to the IPv6 Internet. The increased address space is also sufficient to allow organizations to define a single prefix for their entire network.
IPv6 Enables Large Address Allocations
Aggregation of customer prefixes results in an efficient and scalable routing table. Scalable routing is necessary for broader adoption of network functions. Improved network bandwidth and functionality for user traffic will accommodate Internet usage such as the following:
A huge increase in the number of broadband consumers with high-speed, "always-on" connections
Users who spend more time online and are generally willing to spend more money on communication services and high-value searchable offerings
Home networks with expanded network applications such as wireless Voice over IP (VoIP), home surveillance, and advanced services such as real-time video on demand (VoD)
Massively scalable games with global participants
Media-rich e-learning, providing learners with features such as on-demand remote labs or lab simulations
The Need for Larger Address Space
The Internet, with approximately 973 million users as of November 2005, will be transformed after IPv6 fully replaces its less versatile parent years from now. Nevertheless, IPv4 is in no danger of disappearing overnight. Rather, it will coexist with and then gradually be replaced by IPv6. This change has already begun, particularly in Europe, Japan, and the Asia Pacific.
These areas of the world are exhausting their allotted IPv4 addresses, which makes IPv6 all the more attractive. As noted, in addition to its technical and business potential, IPv6 offers a virtually unlimited supply of IP addresses—enough to allocate more than the entire IPv4 Internet address space to everyone on the planet. These addresses could be used for a variety of devices, including the following:
Personal digital assistants (PDAs), pen-tablets, notepads, and so forth, of which there were approximately 20 million in 2004.
Mobile/cell phones, of which there are already over 1 billion in existence.
Transportation, including IP-enabled automobiles (1 billion automobiles are forecast in 2008) and Internet access in airplanes.
Consumer devices, including billions of home and industrial appliances that will be "always-on."
Consequently, some countries, such as Japan, are aggressively adopting IPv6 today. Others, such as those in the European Union, are moving toward IPv6, and China is considering building pure IPv6 networks from the ground up. As of October 1, 2003, even in North America where Internet addresses are abundant, the U.S. DoD mandated that all new equipment purchased be IPv6-capable. As noted earlier, DoD intends to migrate to IPv6 by 2008. As these examples illustrate, IPv6 enjoys strong momentum.
IPv6 Addressing
This section explores the IPv6 packet header, address representation, address types, interface identifiers, unicast addresses, anycast addresses, multicast addresses, stateless autoconfiguration, and mobility.
IPv6 Packet Header
As shown in Figure 10-3, the IPv6 header has 40 octets, in contrast to the 20 octets in the IPv4 header. IPv6 has fewer fields, and the header is 64-bit aligned to enable fast, efficient, hardware-based processing. The IPv6 address fields are four times larger than in IPv4.
The IPv4 header contains 12 basic header fields, followed by an options field and a data portion (which usually includes a transport layer segment). The basic IPv4 header has a fixed size of 20 octets; the variable-length options field increases the size of the total IP header. IPv6 contains fields similar to 7 of the 12 IPv4 basic header fields (five plus the source and destination address fields), but does not require the other fields.
IPv4 and IPv6 Headers
The IPv6 header contains the following fields:
Version—A 4-bit field, the same as in IPv4. For IPv6, this field contains the number 6; for IPv4, this field contains the number 4.
Traffic class—An 8-bit field similar to the type of service (ToS) field in IPv4. This field tags the packet with a traffic class that it uses in differentiated services (DiffServ) QoS. These functionalities are the same for IPv6 and IPv4.
Flow label—This 20-bit field is new in IPv6. It can be used by the source of the packet to tag the packet as being part of a specific flow, allowing multilayer switches and routers to handle traffic on a per-flow basis rather than per-packet, for faster packet-switching performance. This field can also be used to provide QoS.
Payload length—This 16-bit field is similar to the IPv4 total length field.
Next header—The value of this 8-bit field determines the type of information that follows the basic IPv6 header. It can be a transport-layer packet, such as Transmission Control Protocol (TCP) or User Datagram Protocol (UDP), or it can be an extension header. The next header field is similar to the protocol field of IPv4.
Hop limit—This 8-bit field specifies the maximum number of hops that an IP packet can traverse. Similar to the time to live (TTL) field in IPv4, each router decreases this field by one. Because there is no checksum in the IPv6 header, an IPv6 router can decrease the field without recomputing the checksum; in IPv4 routers the recomputation costs processing time. If this field ever reaches 0, a message is sent back to the source of the packet and the packet is discarded.
Source address—This field has 16 octets or 128 bits. It identifies the source of the packet.
Destination address—This field has 16 octets or 128 bits. It identifies the destination of the packet.
Extension headers—The extension headers, if any, and the data portion of the packet follow the other eight fields. The number of extension headers is not fixed, so the total length of the extension header chain is variable.
Notice that the IPv6 header does not have a header checksum field. Because link-layer technologies perform checksum and error control and are considered relatively reliable, an IP header checksum is considered to be redundant. Without the IP header checksum, upper-layer checksums, such as within UDP, are mandatory with IPv6.