IPv6 - a beginner's guide - Embedded.com

IPv6 – a beginner’s guide

The primary protocol used on the Internet is IP (Internet Protocol), which was developed in the 1970s. The version that has been used for many years is IPv4. The Internet has grown way beyond anything envisaged in those early days and with the advent of the Internet of Things (IoT), that rate of growth is not going to slow any time soon. It is unsurprising, therefore, that the original protocol is now rather stretched. Its address range is essentially exhausted and many of its ways of working are rather cumbersome. IPv6 was designed to address these and other issues. This article looks at the key features of IPv6 and the issues around its implementation in embedded systems.

IPv4 has been in use for well over 20 years and has proven to be amazingly adaptable over time. 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. With IoT, there are likely to be billions of connected devices in just a few years. IPv6 deals with many of the shortcomings of IPv4 and introduces some new features. This paper discusses three of the major problems addressed by IPv6.

Limitations of IPv4
There are three primary shortcoming of IPv4:

  • depleted address space
  • flawed addressing architecture
  • high cost

Depleted Address Space
The main motivation for replacing IPv4 is exhaustion of available address space. Although an IPv4 address appears to be a 32-bit number, offering the possibility of 4 billion unique addresses, the address structure does not allow this potential capacity to be realized. A number of techniques have been used to “stretch” the capacity, but exhaustion is still inevitable.

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 to. It is not possible to look at a portion of an IPv4 address and make such a judgment. Therefore, routing becomes increasingly complicated and expensive as the size of the Internet grows.

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.

Page 2

Article page index:

  1. Introduction
  2. Introducing IPv6
  3. Under the hood — Router discovery
  4. Under the hood — DNS for IPv6

Introducing IPv6
One of the myths associated withIPv6 is that the only reason to adopt IPv6 is the impending depletionof the IPv4 address space. The expanded address space of IPv6 is not theonly improvement made in the protocol, however. IPv6 does solve theIPv4 address problem, but it also improves upon the current InternetProtocol in other areas including: improved addressing architecture, astateless address autoconfiguration mechanism, a less expensive addressresolution protocol, header format simplification, the ability to detectand recover from a failed forward route, and an improved method to joinand leave multicast groups.

Dual Stacks
The Internet will consist of acombination of IPv4 and IPv6 nodes for an indefinite period. Therefore,compatibility between IPv4 and IPv6 nodes is critical for a successfultransition to IPv6. Because IPv6 is not backwards compatible with IPv4, adual stack approach is needed to enable nodes to communicate over bothIPv4 and IPv6 simultaneously. This approach paves the way for transitionmechanisms that will enable the Internet to move to IPv6.

Although the dual stack approach is the recommended transitionmechanism for networks, IPv6 implementations can also be used inIPv6-only mode for isolated IPv6 networks. This removes the additionaloverhead of the IPv4 stack for those devices that do not require IPv4tunneling.

IPv6 under the Hood
Here is just a brief overview of some of the IPv6 functionality.

Neighbor Discovery
Neighbor Discovery solves aset of problems related to the interaction between nodes attached to thesame link. Five different ICMPv6 packet types are defined. The messagesserve the following purposes:

  • Router solicitation : Hosts send out messages 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. Router advertisements contain prefixes that are used for onlink determination and/or address configuration, a suggested hop limit value, and so forth.
  • 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.

Stateless Address Autoconfiguration
Statelessaddress autoconfiguration is a new feature of IPv6 beneficial to networkadministrators, 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 addressesusing a combination of locally available information and informationadvertised by routers and verifies that each generated address is uniqueon the link.

Stateless address autoconfiguration should greatly decrease the costsof administering an enterprise network. Also, the task of renumberingnetworks will be simplified since IPv6 can assign new addresses andgracefully time out existing addresses without manual reconfiguration orDHCP.

Duplicate Address Detection
To ensure that allconfigured addresses are unique on a given link, nodes perform duplicateaddress detection on addresses before assigning them to an interface.

Article page index:

  1. Introduction
  2. Introducing IPv6
  3. Under the hood — Router discovery
  4. Under the hood — DNS for IPv6

Router Discovery
Router discovery is used tolocate neighboring routers as well as to learn prefixes andconfiguration parameters related to stateless address autoconfiguration.

Router advertisements allow routers to inform hosts how to performaddress autoconfiguration and contain Internet parameters such as thehop limit that hosts should use in outgoing packets and, optionally,link parameters such as the link MTU. This facilitates centralizedadministration of critical parameters that can be set on routers andautomatically propagated to all attached hosts.

Prefix Discovery
Router advertisements contain alist of prefixes used for on-link determination and/or stateless addressautoconfiguration. Flags associated with the prefixes specify theintended uses of a particular prefix. Hosts use the advertised on-linkprefixes to build and maintain a list that is used in deciding when apacket’s destination is on-link or beyond a router.

Address Expiration
IPv6 addresses are leased toan interface for a fixed (possibly infinite) length of time. Eachaddress has an associated lifetime that indicates how long the addressis bound to an interface. When a lifetime expires, the binding (andaddress) become invalid, and the address may be reassigned to anotherinterface elsewhere in the Internet. To handle the expiration of addressbindings gracefully, an address goes through two distinct phases whileassigned to an interface. Initially, an address is “preferred,” meaningthat its use in arbitrary communication is unrestricted. Later, anaddress becomes “deprecated” in anticipation that its current interfacebinding will become invalid. While in a deprecated state, the use of anaddress is discouraged but not strictly forbidden.

Address Resolution
Address resolution is theprocess through which a node determines the link-layer address (e.g.,Ethernet MAC address) of a neighbor given only its IP address. Addressresolution is redefined for IPv6 and does not use ARP (AddressResolution Protocol) packets, as is the case for IPv4.

Nodes accomplish address resolution of IPv6 neighbors by multicastinga request for the target node to return its link-layer address. Thetarget returns its link-layer address in a unicast response. By usingmulticast and unicast addresses instead of the broadcast address, thereare fewer needless interruptions of other nodes on the network.

Header Format Simplification
To simplify andoptimize processing of IP packets, a few changes were made to the formatof the IP header for IPv6. The length of the IPv6 header is fixed asopposed to the variable length IPv4 header. This helps to simplifyprocessing of IPv6 packets as certain assumptions in the IP processingcode can be made. Also, some IPv4 header fields have been dropped ormade optional. Most notable is the lack of a checksum field for the IPv6header. This greatly improves performance in routers. When an IPv4packet is forwarded by a router, the Time-to-Live (TTL) field must bedecremented, which forces the IPv4 header checksum to be recomputed;this is a CPU-intensive operation. Since this field is not present inthe IPv6 header, routers simply decrement the hop limit—TTL in IPv6—andforward the packet.

Neighbor Unreachability Detection
Neighborunreachability detection detects the failure of a neighbor or thefailure of the forward path to the neighbor. Once failure has beendetected, an alternate route can be found without interrupting the flowof data from the application’s point of view.

Multicast Listener Discovery
The purpose ofmulticast listener discovery is to enable each IPv6 router to discoverthe presence of multicast listeners (i.e., nodes wishing to receivemulticast packets) on its directly attached links, and to discoverspecifically which multicast addresses are of interest to thoseneighboring nodes. This information is then provided to whichevermulticast routing protocol is being used by the router, to ensure thatmulticast packets are delivered to all links with interested receivers.

Article page index:

  1. Introduction
  2. Introducing IPv6
  3. Under the hood — Router discovery
  4. Under the hood — DNS for IPv6

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, int , is defined to support lookups based on address.

IPv6 Extension Headers
Unlike in IPv4, the IPv6header is a fixed length. Any additional information that needs to beprovided to the IP layer is contained in extension headers appended tothe basic IPv6 header. The following extension headers are commonlysupported in IPv6 implementations: fragmentation, routing, destinationoptions, and hop-by-hop options.

Ancillary Data
Ancillary data is used to transferIPv6 extension headers and additional control information between theapplication and the network stack via socket options and the “sendmessage” and “receive message” routines. This additional data is used bythe local IPv6 stack, intermediate IPv6 stacks responsible for packetrouting, and the destination IPv6 stack to properly process the IPv6packet as is required by the sending application.

Ancillary data can be used to send/receive the following control information to the stack:

  • Hop-by-hop options
  • Destination options
  • Routing header
  • The interface index of the outgoing/incoming packet
  • The source address of the outgoing/incoming packet
  • The next-hop address to use for the outgoing/incoming packet
  • The traffic class of the outgoing/incoming packet

In most deployment scenarios, the IPv6routing infrastructure will be built up over time. While the IPv6routing infrastructure is being deployed, the existing IPv4 routinginfrastructure can remain functional and can be used to carry IPv6traffic. Tunneling provides a way to utilize the existing IPv4 routinginfrastructure to carry IPv6 traffic.

IPv6/IPv4 hosts and routers can tunnel IPv6 datagrams over regions ofIPv4 routing topology by encapsulating them within IPv4 packets.

Tunneling operates as follows:

  1. The entry node of the tunnel (the encapsulating node) creates an encapsulating IPv4 header and transmits the encapsulated packet.
  2. The exit node of the tunnel (the decapsulating node) receives the encapsulated packet, reassembles the packet if needed, removes the IPv4 header, updates the IPv6 header, and processes the received IPv6 packet as usual.

IPv6 defines numerous techniques to accomplish tunneling. Two of the most common tunneling techniques are configured tunneling and 6to4 tunneling .

Configured Tunneling
In configured tunneling, thetunnel endpoint address is determined from configuration information inthe encapsulating node. For each tunnel, the encapsulating node muststore the tunnel endpoint address. When an IPv6 packet is transmittedover a tunnel, the tunnel endpoint configured for that tunnel is used asthe destination address for the encapsulating IPv4 header. Configuredtunneling uses IPv6 native addresses as the source and destinationaddresses of the IPv6 packet.

6to4 Tunneling
The IANA (Internet Assigned Numbers Authority) 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 6to4address is used as the source address of all communications via the 6to4tunnel.

IPv6 packets from a 6to4 site are encapsulated in IPv4 packets when they leave the site via its external IPv4 connection. V4ADDR must be configured on the IPv4 device.

The original Internet protocol, IPv4,has been remarkably resilient and has remained in wide use long afterthe date that all predictions suggested that it would become non-viable.However, its replacement, IPv6, has steadily taken hold but has awaiteda significant change in the way that the Internet is used to becomevital. Maybe the Internet of Things is that change.

In a future article, we will look at some of the implementation details of networking in the IoT and how IPv6 plays its part.

About the authors
Colin Walls
has over thirty years experience in the electronicsindustry, largely dedicated to embedded software. A frequent presenterat conferences and seminars and author of numerous technical articlesand two books on embedded software, Colin is an embedded softwaretechnologist with Mentor Embedded [the Mentor Graphics Embedded SoftwareDivision], and is based in the UK. His regular blog is located at: http://blogs.mentor.com/colinwalls. He may be reached by email at

Tammy Leino is a Senior Software Development Engineer for theEmbedded Systems Division of Mentor Graphics. Tammy has over 15 yearsexperience in the industry as a developer in the networking andmulticore fields. She holds a BS in Computer Science and lives inAsheville, North Carolina.

Article page index:

  1. Introduction
  2. Introducing IPv6
  3. Under the hood — Router discovery
  4. Under the hood — DNS for IPv6

4 thoughts on “IPv6 – a beginner’s guide

  1. “Thanks for the review of IPv6. I first ran into it in a book, TCP/IP by Douglas Comer, 1995. At the time, I thought it would have been implemented long before now but I guess things like this take “time”.”

    Log in to Reply
  2. “Embedded developers tend to be conservative and take an “if it ain't broke, don't fix it” kind of attitude. In this case, breakage did occur a while back.”

    Log in to Reply

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.