In the previous articles covering the neighbor discovery protocol for IPv6, we have discussed eight of the nine functions performed by this protocol. In this article, we will be looking at the final function, which deals with how nodes configure interface addresses.
In actual fact, we have seen address autoconfiguration in previous articles, or I can at least say we have seen part of it. When we looked at Prefix Discovery, we saw that our hosts automatically configured addresses using the prefix advertised by our router. This is an example of stateless address autoconfiguration. The other type of address autoconfiguration is through the use of DHCPv6. A host may also use both stateless and DHCPv6 simultaneously.
Note: DHCPv6 can be stateful or stateless, therefore it may be confusing to say that the two distinctions of address autoconfiguration are stateless and stateful. Therefore, in this article, we will use stateless and DHCPv6 to differentiate between the two.
Address Autoconfiguration Process
Without requiring any external help, nodes can automatically configure link-local addresses for their IPv6-enabled interfaces. We have already seen this in previous articles. By using the link-local prefix fe80::/64 and an interface identifier, nodes can generate link-local addresses that are unique to a high degree of probability. Furthermore, Duplicate Address Detection performed by the ND protocol helps to check that generated (or assigned) addresses are indeed unique.
Note: Routers also generate link-local addresses automatically and perform duplicate address detection on all configured or generated addresses as described above; however the remainder of the address autoconfiguration process applies only to hosts, because other types of addresses are expected to be manually configured on routers.
After a host has confirmed the uniqueness of its link-local address, it then begins to listen for (or request) router advertisement messages. If addresses are available through DHCPv6, the Managed address configuration flag in the router advertisement message will be set. If other configuration information, such as DNS settings, is available through DHCPv6, then the Other configuration flag will be set (this flag is ignored if the managed address configuration flag is set). DHCPv6 address configuration may still be available even if there are no routers present on the link.
The snapshot below shows both flags in a router advertisement message:
In those previous articles, we also saw that router advertisements can contain prefix information options. If the autonomous address-configuration flag is set in that prefix information option, it means hosts can use the prefix to automatically configure addresses. This is known as stateless address autoconfiguration because it does not involve a stateful configuration protocol like DHCPv6. Routers that advertise these prefixes do not need to keep track of the state of addresses configured by hosts.
Address Autoconfiguration Through DHCPv6
Let us now take a brief look at DHCPv6. I have added a DHCPv6 server to our network scenario as shown below.
Hint: It is actually just a router acting as a DHCPv6 server.
The DHCPv6 pool from which hosts will be assigned addresses and other configuration options is shown below:
I have also configured the router to advertise that hosts should use DHCPv6 for address configuration by setting the managed address configuration flag in its router advertisements.
Therefore, hosts on the link will receive this router advertisement and begin requesting DHCPv6 information. The messages exchanges in DHCPv6 is beyond the scope of this article, but you can read more about it here.
After getting the DHCPv6 replies with the necessary information, hosts can configure their interface addresses automatically. As you can see below, my host has configured an address based on the prefix it obtained from the DHCPv6 server and it has also set other configuration parameters, such as the domain name and DNS server.
Other Configurations Through DHCPv6
DHCPv6 is used not only for stateful address autoconfiguration, as we have just seen in the previous section; it can also be used to deliver only stateless information, such as DNS settings. This is done by setting the other configuration flag in router advertisements.
For example, let me remove my DHCPv6 server and then configure R1 to act as a DHCPv6 server with only domain name and DNS settings. I will also configure R1 with the prefix 2001:db8:1000::/64 so that the host can use stateless address autoconfiguration to generate an address in that prefix. Finally, I will set R1 to inform hosts that other configuration options are available through DHCPv6.
Notice from the screenshot below that not only has my host used the prefix advertised by R1 for stateless address autoconfiguration (highlighted in green), it has also received other stateless information through DHCPv6 (highlighted in red). This tells us that both forms of address autoconfiguration can be used simultaneously.
Autoconfigured Address States
Before we end this article, let us talk about the different states which autoconfigured addresses can be in:
An address is in the tentative state when it is being verified for uniqueness through duplicate address detection. A node cannot accept packets destined to a tentative address except for neighbor discovery messages related to duplicate address detection.
A valid address is one that has been verified to be unique and, as such, has been assigned to an interface. An address remains valid as long as its valid lifetime has not expired. The valid lifetime is specified in the prefix information option of a router advertisement message or DHCPv6 setting as shown below:
Furthermore, a valid address can either be Preferred or Deprecated. A preferred address is one which can be used without restriction by protocols. For example, a TCP connection can use a preferred address as its source or destination address. A deprecated address, on the other hand, should be used with caution: its use for new communications is discouraged but existing connections may continue to use it. A preferred address becomes deprecated when its preferred lifetime expires.
A valid address becomes invalid when its valid lifetime expires. Invalid addresses cannot be used as source or destination address for traffic.
This brings us to the end of the IPv6 series that we began 12 articles ago. We have learned about IPv6 in a vendor-independent manner, as detailed in RFCs. We have discussed topics like IPv6 addressing, IPv6 scoped address architecture, ICMPv6, and so on. Armed with this knowledge, we can now go on to vendor-specific implementations of IPv6. The next series will focus on Cisco’s implementation of IPv6.
In this article, we have wrapped up on the ninth function performed by ND, which is the address autoconfiguration. We also looked briefly at DHCPv6 and went on to discuss the states of autoconfigured addresses.
I hope you have found this article and the entire series insightful. Now I (and hopefully you also) don’t need to shy away from an IPv6 discussion.
References and Further Reading
RFC 4861: Neighbor Discovery for IP version 6 (IPv6): http://tools.ietf.org/html/rfc4861
Introduction to IPv6: http://technet.microsoft.com/library/bb726944.aspx
RFC 4862: IPv6 Stateless Address Autoconfiguration: http://tools.ietf.org/html/rfc4862