IPv6 neighbor discovery protocol

The IPv6 Neighbor Discovery (ND) protocol uses five types of ICMPv6 messages to implement the following functions:

Table 8: ICMPv6 messages used by ND

ICMPv6 message

Type

Function

Neighbor Solicitation (NS) message

135

Acquires the link-layer address of a neighbor.

Verifies whether a neighbor is reachable.

Detects duplicate addresses.

Neighbor Advertisement (NA) message

136

Responds to an NS message.

Notifies the neighboring nodes of link layer changes.

Router Solicitation (RS) message

133

Requests an address prefix and other configuration information for autoconfiguration after startup.

Router Advertisement (RA) message

134

Responds to an RS message.

Advertises information such as the Prefix Information options and flag bits.

Redirect message

137

Informs the source host of a better next hop on the path to a particular destination when certain conditions are satisfied.

Address resolution

This function is similar to the ARP function in IPv4. An IPv6 node acquires the link-layer addresses of neighboring nodes on the same link through NS and NA message exchanges. Figure 54 shows how Host A acquires the link-layer address of Host B on a single link.

Figure 54: Address resolution

The address resolution operates in the following steps:

  1. Host A multicasts an NS message. The source address of the NS message is the IPv6 address of the sending interface of Host A and the destination address is the solicited-node multicast address of Host B. The NS message contains the link-layer address of Host A.

  2. After receiving the NS message, Host B determines whether the destination address of the packet is its solicited-node multicast address. If yes, Host B learns the link-layer address of Host A, and then unicasts an NA message containing its link-layer address.

  3. Host A acquires the link-layer address of Host B from the NA message.

Neighbor reachability detection

After Host A acquires the link-layer address of its neighbor Host B, Host A can use NS and NA messages to check whether Host B is reachable.

  1. Host A sends an NS message whose destination address is the IPv6 address of Host B.

  2. If Host A receives an NA message from Host B, Host A decides that Host B is reachable. Otherwise, Host B is unreachable.

Duplicate address detection

After Host A acquires an IPv6 address, it performs Duplicate Address Detection (DAD) to check whether the address is being used by any other node (similar to the gratuitous ARP function in IPv4). DAD is accomplished through NS and NA message exchanges. Figure 55 shows the DAD process.

Figure 55: Duplicate address detection

  1. Host A sends an NS message whose source address is the unspecified address and whose destination address is the corresponding solicited-node multicast address of the IPv6 address to be detected. The NS message contains the IPv6 address.

  2. If Host B uses this IPv6 address, Host B returns an NA message. The NA message contains the IPv6 address of Host B.

  3. Host A learns that the IPv6 address is being used by Host B after receiving the NA message from Host B. If receiving no NA message, Host A decides that the IPv6 address is not in use and uses this address.

Router/prefix discovery and address autoconfiguration

Router/prefix discovery enables a node to locate the neighboring routers and to learn from the received RA message configuration parameters such as the prefix of the network where the node is located.

Stateless address autoconfiguration enables a node to generate an IPv6 address automatically according to the information obtained through router/prefix discovery.

Router/prefix discovery is implemented through RS and RA messages in the following steps:

  1. At startup, a node sends an RS message to request the address prefix and other configuration information for autoconfiguration.

  2. A router returns an RA message containing information such as Prefix Information options. (The router also periodically sends an RA message. In addition to an address prefix, the Prefix Information option also contains the preferred lifetime and valid lifetime of the address prefix. Nodes update the preferred lifetime and valid lifetime accordingly through periodic RA messages.)

  3. The node automatically generates an IPv6 address and other configuration information according to the address prefix and other configuration parameters in the RA message. (The automatically generated address is applicable within the valid lifetime and is removed when the valid lifetime expires.)

Redirection

A newly started host may contain only a default route to the gateway in its routing table. When certain conditions are satisfied, the gateway sends an ICMPv6 Redirect message to the source host, so the host can select a better next hop to forward packets (similar to the ICMP redirection function in IPv4).

The gateway sends an ICMPv6 Redirect message when the following conditions are satisfied.