Expanding the Embedded Universe: Migrating From IPv4 to IPv6
By Rex Smith
Embedded.com
(09/10/08, 12:15:00 AM EDT)
The Internet Protocol (IP) developed during the mid-1970s, is the backbone of a family of protocols that includes TCP, UDP, RIP, and virtually every other protocol used for Internet communications.

The current version, IP version 4 (IPv4), has been in use for more than 20 years. IPv4 has proven to be amazingly adaptable over the years; however, the demands placed upon the protocol at its inception pale in comparison to the demands of the millions of hosts that are now connected to the Internet today.

IPv4 is finally beginning to show some chinks in its armor. IP version 6 (IPv6), designed as a successor to IPv4 deals with many of IPv4's shortcomings. This article touches upon three of the major problems found in IPv4 and how IPv6 corrects each of these problems.

A few of the major problems currently found in IPv4 include:

#1. Depleted Address Space
The main motivation for replacing IPv4 with something better is that the IPv4 address space will ultimately be exhausted. Estimates for the total depletion of the IPv4 address space vary from 2005 until 2018.

Most estimates put the date around 2008 to 2010. Despite the disagreements on when the address space will be depleted, most agree that it will definitely happen unless something better is put in place. Compounding the problem is the uneven distribution of the IPv4 address space across the globe.

#2. Flawed Addressing Architecture
IPv4 addresses do not provide an efficient and scalable hierarchical address space. That is, it is impossible for a single high-level address to represent many lower-level addresses or networks.

To picture what a hierarchical address space looks like, think of the telephone numbering system. Just by looking at the area code, one can immediately determine what city or region to route the call. With IPv4 routing becomes increasingly complicated and expensive as the size of the Internet grows.

#3. High Cost
Another criticism of IPv4 is the high cost and maintenance requirements of networks. A significant percentage of the cost of administering an IPv4 network is incurred in the initial configuration of network hosts. IPv4's limitations also aggravate the task of renumbering network devices, which is cumbersome to network administrators.

IPv6 To The Rescue
One of the common myths associated with IPv6 is that the only reason to adopt IPv6 is the impending depletion of the IPv4 address space. The expanded address space of IPv6 is not the only improvement made in the protocol, however.

IPv6 also offers improvements in: addressing architecture, a stateless address autoconfiguration mechanism, a less expensive address resolution protocol, header format simplification, the ability to detect and recover from a failed forward route, and an improved method to join and leave multicast groups.

To the end user, IPv6 offers obvious advantages. Because of IPv6's larger address capacity, it allows greater flexibility in allocating addresses and routing traffic " freeing device users to use the Internet as they always have, but now with even higher levels of seamless integration between devices (Figure 1 below).

Figure 1. IPv6 allows users to display/talk/show/interact with each other from device to device

Dual Stack Approach Eases Transition
The Internet will consist of a combination of IPv4 and IPv6 nodes for a period of time during the transition. Therefore, compatibility between IPv4 and IPv6 nodes is critical for a successful transition.

Because IPv6 is not backwards compatible with IPv4, a dual stack approach is needed to enable nodes to communicate over both IPv4 and IPv6 simultaneously. This approach paves the way for transition mechanisms that will enable the Internet to move to IPv6.

Although the dual stack approach is the recommended transition mechanism for networks, under certain circumstances, such dual stack configurations can also be used in IPv6-only mode for isolated IPv6 networks.

This removes the additional overhead of the IPv4 stack for those devices that do not require IPv4 tunneling. Additional capabilities include Neighbor Discovery, Multicast Listener Discovery, Tunneling, DNS for IPv6, IPv6 Extension Headers, and Ancillary Data.

Let's take a look at each of these in a bit more detail.

Neighbor Discovery
Neighbor Discovery solves a set of problems related to the interaction between nodes attached to the same link. It defines mechanisms for solving each of the following problems:

Stateless Address Autoconfiguration. This is a new feature of IPv6 beneficial to network administrators, because it requires no manual configuration of hosts, minimal (if any) configuration of routers, and no additional servers. The stateless mechanism allows a host to generate its own addresses using a combination of locally available information and information advertised by routers and verifies that each generated address is unique on the link.

Stateless Address Autoconfiguration should greatly decrease the costs of administering an enterprise network. Also, the task of renumbering networks will be simplified since IPv6 can assign new addresses and gracefully time out existing addresses without manual reconfiguration or DHCP.

Router Discovery. This feature is used to locate neighboring routers as well as to learn prefixes and configuration parameters related to Stateless Address Autoconfiguration.

Router Advertisements. These allow routers to inform hosts how to perform Address Autoconfiguration and contain Internet parameters such as the hop limit which should use in outgoing packets and, optionally, link parameters such as the link Maximum Transmission Unit (MTU). This facilitates centralized administration of critical parameters that can be set on routers and automatically propagated to all attached hosts.

Prefix Discovery. Flags associated with the prefixes specify the intended uses of a particular prefix. Hosts use the advertised on-link prefixes to build and maintain a list that is used in deciding when a packet's destination is on-link or beyond a router.

Address Expiration. IPv6 addresses are leased to an interface for a fixed (possibly infinite) length of time. Each address has an associated lifetime that indicates how long the address is bound to an interface.

When a lifetime expires, the binding (and address) become invalid and the address may be reassigned to another interface elsewhere in the Internet. To handle the expiration of address bindings gracefully, an address goes through two distinct phases while assigned to an interface.

Initially, an address is "preferred," meaning that its use in arbitrary communication is unrestricted. Later, an address becomes "deprecated" in anticipation that its current interface binding will become invalid. While in a deprecated state, the use of an address is discouraged but not strictly forbidden.

Address Resolution. This capability is the process through which a node determines the link-layer address (Ethernet MAC address, for example) of a neighbor given only its IP address. Address Resolution is redefined for IPv6 and does not use Address Resolution Protocol (ARP) packets, as is the case for IPv4.

Nodes accomplish Address Resolution of IPv6 neighbors by multicasting a request for the target node to return its link-layer address. The target returns its link-layer address in a unicast response. By using multicast and unicast addresses instead of the broadcast address, there are fewer needless interruptions of other nodes on the network.

Neighbor Unreachability Detection. This detects the failure of a neighbor or the failure of the forward path to the neighbor. Once failure has been detected, an alternate route can be found without interrupting the flow of data from the application's point of view.

Duplicate Address Detection. To insure that all configured addresses are unique on a given link, nodes perform Duplicate Address Detection on addresses before assigning them to an interface.

Header Format Simplification. In order to simplify and optimize processing of IP packets, a few changes were made to the format of the IP header for IPv6. The length of the IPv6 header is fixed as opposed to the variable length IPv4 header.

This helps to simplify processing of IPv6 packets as certain assumptions in the IP processing code can be made. Also, some IPv4 header fields have been dropped or made optional.

Most notable is the lack of a checksum field for the IPv6 header. This greatly improves performance in routers. When an IPv4 packet is forwarded by a router the Time-to-Live (TTL) field must be decremented, which forces the IPv4 header checksum to be recomputed; a CPU intensive operation. Since this field is not present in the IPv6 header routers simply decrement the Hop Limit, TTL in IPv6, and forward the packet.

Further, Neighbor Discovery defines five different ICMPv6 packet types. The messages serve the following purpose:

* Router Solicitation: Hosts send out Router Solicitations that request routers to generate Router Advertisements.

* Router Advertisement: Routers advertise their presence together with various link and Internet parameters either periodically, or in response to a Router Solicitation message.

* Neighbor Solicitation: Sent by a node to determine the link-layer address of a neighbor, or to verify that a neighbor is still reachable via a cached link-layer address.

* Neighbor Advertisement: A response to a Neighbor Solicitation message. A node may also send unsolicited Neighbor Advertisements to announce a link-layer address change.

* Redirect: Used by routers to inform hosts of a better first hop for a destination.

Multicast Listener Discovery
The purpose of Multicast Listener Discovery is to enable each IPv6 router to discover the presence of multicast listeners (that is, nodes wishing to receive multicast packets) on its directly attached links, and to discover specifically which multicast addresses are of interest to those neighboring nodes.

This information is then provided to whichever multicast routing protocol is being used by the router, in order to ensure that multicast packets are delivered to all links where there are interested receivers.

Tunneling
In most deployment scenarios, the IPv6 routing infrastructure will be built up over time. While the IPv6 routing infrastructure is being deployed, the existing IPv4 routing infrastructure can remain functional and can be used to carry IPv6 traffic.

Tunneling provides a way to utilize the existing IPv4 routing infrastructure to carry IPv6 traffic. IPv6/IPv4 hosts and routers can tunnel IPv6 datagrams over regions of IPv4 routing topology by encapsulating them within IPv4 packets.

IPv6 defines numerous techniques to accomplish tunneling. Based on usability, flexibility, and perceived popularity, many implementations (Nucleus IPv6) have been designed to support two such tunneling techniques: Configured Tunneling and 6to4 Tunneling.

Configured Tunneling. In configured tunneling, the tunnel endpoint address is determined from configuration information in the encapsulating node. For each tunnel, the encapsulating node must store the tunnel endpoint address.

When an IPv6 packet is transmitted over a tunnel, the tunnel endpoint configured for that tunnel is used as the destination address for the encapsulating IPv4 header. Configured tunneling uses IPv6 native addresses as the source and destination addresses of the IPv6 packet.

6to4 Tunneling. The IANA has permanently assigned the prefix 2002::/16 for the 6to4 scheme. The subscriber site is then deemed to have the address prefix 2002:V4ADDR::/48, where V4ADDR is the globally unique 32-bit IPv4 address.

Within the subscriber site, this prefix is used exactly like any other IPv6 prefix. The 6to4 address is used as the source address of all communications via the 6to4 tunnel.

DNS For IPv6
To support the storage of IPv6 addresses, the following extensions have been defined:

* A new resource record type, AAAA, is defined to map a domain name to an IPv6 address
* A new domain, ip6.int, is defined to support lookups based on address

IPv6 Extension Headers
Unlike in IPv4, the IPv6 header is a fixed length. Any additional information that needs to be provided to the IP layer is contained in extension headers appended to the basic IPv6 header.

Ancillary Data
Ancillary data is used to transfer IPv6 Extension Headers and additional control information between the application and the network stack via socket options and the SendMessage/RecieveMessage routines provided by the IPv6 networking provider. This additional data is used by the local IPv6 stack, intermediate IPv6 stacks responsible for packet routing and the destination IPv6 stack to properly process the IPv6 packet as is required by the sending application.

In Conclusion
With the imminent exhaustion of the IPv4 address space, and a mounting number of embedded devices pushing the limits, the need for a new protocol is upon us. Fortunately, IPv6 has the necessary prerequisites to move the industry forward, enabling new and innovative functionality on a variety of devices that just a few years ago were unimaginable.

Rex Smith is a Product Manager for the Embedded Systems Division of Mentor Graphics where he is responsible for Nucleus OS and related products. Rex has spent more than 12 years working with embedded systems. Smith earned a Bachelors of Science in Electrical Engineering from University of Alabama. You can email Rex at: rex_smith@mentor.com.