RFC 1970

Neighbor Discovery for IP Version 6 (IPv6)

๐Ÿ“… published August 1996, from ietf

RFC 1970: Neighbor Discovery for IP Version 6 (IPv6) ๐Ÿฆ‹

okay bestie, this is RFC 1970 and it's literally the rulebook for how IPv6 devices find each other on the same link ๐Ÿ’…

Quick title-block tea ๐Ÿต It's from the Network Working Group and it's an official Standards Track doc, dated August 1996. The authors are T. Narten (IBM), E. Nordmark (Sun Microsystems), and W. Simpson (Daydreamer). The header doesn't list any RFCs that it obsoletes or updates, so nothing is being replaced or patched here ๐ŸŒธ

Status of this Memo โœจ

This doc is an Internet standards track protocol spec for the Internet community, and it's basically asking everyone to talk about it and send suggestions for making it better ๐Ÿ’ฌ If you want to know where this protocol stands on the standardization front, check the current edition of the "Internet Official Protocol Standards" (STD 1) ๐Ÿ“‹ And the best part? Distribution of this memo is unlimited, so share away ๐Ÿซถ

Abstract ๐Ÿ”ฅ

This spec is all about the Neighbor Discovery protocol for IP Version 6. IPv6 nodes on the same link use it to figure out each other's presence and each other's link-layer addresses, to find routers, and to keep track of reachability info for the paths to active neighbors. It's the whole social network of a link, honestly ๐Ÿ‘‘

Table of Contents ๐Ÿ“š

1.  INTRODUCTION.............................................    3
2.  TERMINOLOGY..............................................    4
   2.1.  General.............................................    4
   2.2.  Link Types..........................................    7
   2.3.  Addresses...........................................    8
   2.4.  Requirements........................................    9
3.  PROTOCOL OVERVIEW........................................   10
   3.1.  Comparison with IPv4................................   14
   3.2.  Supported Link Types................................   16
4.  MESSAGE FORMATS..........................................   17
   4.1.  Router Solicitation Message Format..................   17
   4.2.  Router Advertisement Message Format.................   18
   4.3.  Neighbor Solicitation Message Format................   21
   4.4.  Neighbor Advertisement Message Format...............   23
   4.5.  Redirect Message Format.............................   25
   4.6.  Option Formats......................................   27
      4.6.1.  Source/Target Link-layer Address...............   28
      4.6.2.  Prefix Information.............................   29
      4.6.3.  Redirected Header..............................   31
      4.6.4.  MTU............................................   31
5.  CONCEPTUAL MODEL OF A HOST...............................   32
   5.1.  Conceptual Data Structures..........................   33
   5.2.  Conceptual Sending Algorithm........................   35
   5.3.  Garbage Collection and Timeout Requirements.........   36
6.  ROUTER AND PREFIX DISCOVERY..............................   37
   6.1.  Message Validation..................................   38
      6.1.1.  Validation of Router Solicitation Messages.....   38
      6.1.2.  Validation of Router Advertisement Messages....   38
   6.2.  Router Specification................................   39
      6.2.1.  Router Configuration Variables.................   39
      6.2.2.  Becoming An Advertising Interface..............   43
      6.2.3.  Router Advertisement Message Content...........   43
      6.2.4.  Sending Unsolicited Router Advertisements......   45
      6.2.5.  Ceasing To Be An Advertising Interface.........   45
      6.2.6.  Processing Router Solicitations................   46
      6.2.7.  Router Advertisement Consistency...............   47
      6.2.8.  Link-local Address Change......................   48
   6.3.  Host Specification..................................   48
      6.3.1.  Host Configuration Variables...................   48
      6.3.2.  Host Variables.................................   48
      6.3.3.  Interface Initialization.......................   50
      6.3.4.  Processing Received Router Advertisements......   50
      6.3.5.  Timing out Prefixes and Default Routers........   52
      6.3.6.  Default Router Selection.......................   53
      6.3.7.  Sending Router Solicitations...................   54
7.  ADDRESS RESOLUTION AND NEIGHBOR UNREACHABILITY DETECTION.   55
   7.1.  Message Validation..................................   55
      7.1.1.  Validation of Neighbor Solicitations...........   55
      7.1.2.  Validation of Neighbor Advertisements..........   56
   7.2.  Address Resolution..................................   57
      7.2.1.  Interface Initialization.......................   57
      7.2.2.  Sending Neighbor Solicitations.................   57
      7.2.3.  Receipt of Neighbor Solicitations..............   58
      7.2.4.  Sending Solicited Neighbor Advertisements......   59
      7.2.5.  Receipt of Neighbor Advertisements.............   59
      7.2.6.  Sending Unsolicited Neighbor Advertisements....   61
      7.2.7.  Anycast Neighbor Advertisements................   62
      7.2.8.  Proxy Neighbor Advertisements..................   62
   7.3.  Neighbor Unreachability Detection...................   63
      7.3.1.  Reachability Confirmation......................   63
      7.3.2.  Neighbor Cache Entry States....................   64
      7.3.3.  Node Behavior..................................   66
8.  REDIRECT FUNCTION........................................   68
   8.1.  Validation of Redirect Messages.....................   68
   8.2.  Router Specification................................   69
   8.3.  Host Specification..................................   70
9.  EXTENSIBILITY - OPTION PROCESSING........................   71
10.  PROTOCOL CONSTANTS......................................   72
11.  SECURITY CONSIDERATIONS.................................   73
REFERENCES...................................................   75
AUTHORS' ADDRESSES...........................................   76
APPENDIX A: MULTIHOMED HOSTS.................................   77
APPENDIX B: FUTURE EXTENSIONS................................   78
APPENDIX C: STATE MACHINE FOR THE REACHABILITY STATE.........   78
APPENDIX D: IMPLEMENTATION ISSUES............................   80
   Appendix D.1: Reachability confirmations..................   80

1. INTRODUCTION โœจ

So this spec defines the Neighbor Discovery (ND) protocol for Internet Protocol Version 6 (IPv6) ๐ŸŒˆ Nodes (that's hosts and routers) use ND to work out the link-layer addresses of neighbors that live on their attached links, and to quickly purge cached values once they stop being valid ๐Ÿงน Hosts also use it to find neighboring routers that are willing to forward packets for them ๐Ÿš€ And nodes use the protocol to actively keep tabs on which neighbors are reachable and which aren't, and to notice when a link-layer address changes ๐Ÿ‘€ When a router (or the path to one) dies, a host goes hunting for a working alternate. Main character energy, no notes ๐Ÿ’…

Unless a doc says otherwise (one that covers running IP over a particular link type), this spec applies to all link types ๐Ÿฆ‹ BUT here's the twist: ND uses link-layer multicast for some of its services, so on some link types (like NBMA links, e.g.) other protocols or mechanisms might get specified to do those jobs instead. Those specs would live in the right document for running IP over that particular link type ๐Ÿ“š The services in this doc that don't depend directly on multicast, like Redirects, Next-hop determination, Neighbor Unreachability Detection, etc., are expected to work exactly as specified here ๐Ÿ’– And how you actually use ND on NBMA links? That's still an area for further study, so stay tuned ๐Ÿ”ฎ

The authors want to shout out the contributions of the IPNGWG working group, and especially (in alphabetical order) Ran Atkinson, Jim Bound, Scott Bradner, Alex Conta, Stephen Deering, Francis Dupont, Robert Elz, Robert Gilligan, Robert Hinden, Allison Mankin, Dan McDonald, Charles Perkins, Matt Thomas, and Susan Thomson ๐Ÿซถ๐ŸŽ€

2. TERMINOLOGY ๐Ÿ’…

2.1. General ๐ŸŽ€

Okay bestie, let's go through the vocab, because these terms are the foundation of everything else ๐Ÿ’–

IP ๐ŸŒธ means Internet Protocol Version 6. The terms IPv4 and IPv6 are only used where they're needed to avoid ambiguity.

ICMP ๐Ÿ’… stands for Internet Message Control Protocol for the Internet Protocol Version 6. The terms ICMPv4 and ICMPv6 are only used where they're needed to avoid ambiguity.

node ๐Ÿงš is a device that implements IP.

router ๐Ÿšฆ is a node that forwards IP packets that aren't explicitly addressed to itself.

host ๐Ÿ  is any node that isn't a router.

upper layer ๐Ÿฆ‹ is a protocol layer sitting immediately above IP. Examples are transport protocols like TCP and UDP, control protocols like ICMP, routing protocols like OSPF, and internet or lower-layer protocols that get "tunneled" over (i.e., encapsulated in) IP, like IPX, AppleTalk, or IP itself.

link ๐Ÿ”— is a communication facility or medium over which nodes can communicate at the link layer, which is the layer immediately below IP. Examples are Ethernets (simple or bridged), PPP links, X.25, Frame Relay, or ATM networks, plus internet (or higher) layer "tunnels", like tunnels over IPv4 or IPv6 itself.

interface ๐ŸŽง is a node's attachment to a link.

neighbors ๐Ÿ‘ฏ are nodes attached to the same link.

address ๐Ÿ“ฌ is an IP-layer identifier for an interface or a set of interfaces.

anycast address ๐ŸŒˆ is an identifier for a set of interfaces, typically belonging to different nodes. A packet sent to an anycast address is delivered to one of the interfaces identified by that address (the "nearest" one, according to the routing protocol's measure of distance). See [ADDR-ARCH].

Note that an anycast address is syntactically indistinguishable from a unicast address. So nodes sending packets to anycast addresses generally don't know an anycast address is being used. Throughout the rest of this document, references to unicast addresses also apply to anycast addresses in those cases where the node is unaware that a unicast address is actually an anycast address.

prefix ๐Ÿฐ is a bit string made up of some number of initial bits of an address.

link-layer address ๐Ÿท๏ธ is a link-layer identifier for an interface. Examples include IEEE 802 addresses for Ethernet links and E.164 addresses for ISDN links.

on-link โœ… describes an address that is assigned to an interface on a specified link. A node considers an address to be on-link if:

  • it is covered by one of the link's prefixes, or
  • a neighboring router specifies the address as the target of a Redirect message, or
  • a Neighbor Advertisement message is received for the (target) address, or
  • any Neighbor Discovery message is received from the address.

off-link ๐Ÿšช is the opposite of "on-link": an address that is not assigned to any interfaces on the specified link.

longest prefix match ๐Ÿ” is the process of figuring out which prefix (if any) in a set of prefixes covers a target address. A target address is covered by a prefix if all of the bits in the prefix match the left-most bits of the target address. When multiple prefixes cover an address, the longest prefix is the one that matches. Literally the main character of the routing table ๐Ÿ‘‘

reachability ๐Ÿ“ก is whether or not the one-way "forward" path to a neighbor is functioning properly. In particular, it's about whether packets sent to a neighbor are reaching the IP layer on the neighboring machine and being processed properly by the receiving IP layer. For neighboring routers, reachability means that packets sent by a node's IP layer are delivered to the router's IP layer, and the router is indeed forwarding packets (i.e., it's configured as a router, not a host). For hosts, reachability means that packets sent by a node's IP layer are delivered to the neighbor host's IP layer.

packet ๐Ÿ“ฆ is an IP header plus payload.

link MTU ๐Ÿ“ is the maximum transmission unit, i.e., the maximum packet size in octets that can be conveyed in one piece over a link.

target ๐ŸŽฏ is an address about which address resolution information is sought, or an address that is the new first-hop when being redirected.

proxy ๐Ÿซถ is a router that responds to Neighbor Discovery query messages on behalf of another node. A router acting on behalf of a mobile node that has moved off-link could potentially act as a proxy for the mobile node.

ICMP destination unreachable indication ๐Ÿšซ is an error indication returned to the original sender of a packet that can't be delivered, for the reasons outlined in [ICMPv6]. If the error occurs on a node other than the node originating the packet, an ICMP error message is generated. If the error occurs on the originating node, an implementation is NOT REQUIRED to actually create and send an ICMP error packet to the source, as long as the upper-layer sender is notified through an appropriate mechanism (e.g., a return value from a procedure call). Note, however, that an implementation MAY find it convenient in some cases to return errors to the sender by taking the offending packet, generating an ICMP error message, and then delivering it (locally) through the generic error handling routines.

random delay ๐ŸŽฒ happens when sending out messages. It's sometimes necessary to delay a transmission for a random amount of time, either to stop multiple nodes from transmitting at exactly the same time, or to stop long-range periodic transmissions from synchronizing with each other [SYNC]. When a random component is REQUIRED, a node calculates the actual delay in such a way that the computed delay forms a uniformly-distributed random value that falls between the specified minimum and maximum delay times. The implementor MUST take care to insure that the granularity of the calculated random component and the resolution of the timer used are both high enough to insure that the probability of multiple nodes delaying the same amount of time is small.

random delay seed ๐ŸŒฑ comes into play if a pseudo-random number generator is used in calculating a random delay component. The generator SHOULD be initialized with a unique seed prior to being used. It's not sufficient to use the interface token alone as the seed, since interface tokens will not always be unique. To reduce the probability that duplicate interface tokens cause the same seed to be used, the seed SHOULD be calculated from a variety of input sources (e.g., machine components) that are likely to be different even on identical "boxes". For example, the seed could be formed by combining the CPU's serial number with an interface token.


Different link layers have different properties ๐ŸŒธ These are the ones Neighbor Discovery cares about:

multicast ๐Ÿ“ฃ is a link that supports a native mechanism at the link layer for sending packets to all (i.e., broadcast) or a subset of all neighbors.

point-to-point ๐Ÿค is a link that connects exactly two interfaces. A point-to-point link is assumed to have multicast capability and have a link-local address.

non-broadcast multi-access (NBMA) ๐Ÿ•ธ๏ธ is a link that more than two interfaces can attach to, but that doesn't support a native form of multicast or broadcast (e.g., X.25, ATM, Frame Relay, etc.). Note that all link types (including NBMA) are expected to provide multicast service for IP (e.g., using multicast servers), but it is an issue for further study whether ND SHOULD use such facilities or an alternate mechanism that provides the equivalent ND services.

shared media ๐Ÿ™๏ธ is a link that allows direct communication among a number of nodes, but attached nodes are configured in such a way that they don't have complete prefix information for all on-link destinations. That means at the IP level, nodes on the same link may not know that they are neighbors, and by default, they communicate through a router. Examples are large (switched) public data networks such as SMDS and B-ISDN. Also known as "large clouds". See [SH-MEDIA].

variable MTU ๐ŸŽข is a link that doesn't have a well-defined MTU (e.g., IEEE 802.5 token rings). Many links (e.g., Ethernet) have a standard MTU defined by the link-layer protocol or by the specific document describing how to run IP over the link layer.

asymmetric reachability ๐Ÿ™ƒ is a link where non-reflexive and/or non-transitive reachability is part of normal operation. (Non-reflexive reachability means packets from A reach B but packets from B don't reach A. Non-transitive reachability means packets from A reach B, and packets from B reach C, but packets from A don't reach C.) Many radio links show these properties ๐Ÿ“ป

2.3. Addresses

okay bestie, so Neighbor Discovery leans on a bunch of different addresses that get defined over in [ADDR-ARCH] ๐Ÿฆ‹ let's see the main ones ๐Ÿ’…

all-nodes multicast address

  • the link-local scope address to reach all nodes. โœจ It's FF02::1 ๐ŸŒธ

all-routers multicast address

  • the link-local scope address to reach all routers ๐Ÿ’œ It's FF02::2 ๐Ÿซถ

solicited-node multicast address

  • this one is a link-local scope multicast address that gets computed from the address of the solicited target ๐Ÿงš Like, you take the low-order 32 bits of the target IP address and tack those bits onto the 96-bit prefix FF02:0:0:0:0:1 ๐Ÿ”ฅ That gives you a multicast address somewhere in the range FF02::1:0:0 to FF02::1:FFFF:FFFF ๐ŸŒˆ For example, the solicited node multicast address for the IP address 4037::01:800:200E:8C6C is FF02::1:200E:8C6C ๐Ÿ’– Here's the iconic part: IP addresses that only differ in the high-order bits (like when you've got multiple high-order prefixes from different providers) all map to the same solicited-node address ๐Ÿฆ‹ So a node doesn't have to join a bajillion multicast addresses, which is seriously so smart ๐Ÿ˜ญ๐Ÿ‘‘

link-local address

  • a unicast address with link-only scope that can be used to reach neighbors ๐ŸŽ€ All interfaces on routers MUST have a link-local address ๐Ÿ”ฅ And [ADDRCONF] says interfaces on hosts MUST also have one too (it says it requires it, so yes, same vibe) ๐Ÿ’…
Quick reminder: the unspecified address is kinda like the "I don't know my address yet" address ๐Ÿ™ˆ

unspecified address

  • a reserved address value that means there's no address (like, the address is unknown) ๐ŸŒธ It is never used as a destination address ๐Ÿ’€ But it may be used as a source address if the sender doesn't (yet) know its own address ๐Ÿงš This happens e.g. while verifying an address is unused during address autoconfiguration [ADDRCONF] ๐Ÿซถ The unspecified address has a value of 0:0:0:0:0:0:0:0 โœจ

2.4. Requirements

okay so this section is where the key words live, and they're all capitalized on purpose ๐ŸŽ€ Like, these words are what tell you how strict something is ๐Ÿ’… The words are:

MUST

  • this word or the adjective "REQUIRED" means the item is an absolute requirement of this spec ๐Ÿ”ฅ

MUST NOT

  • this phrase means the item is an absolute prohibition of this spec ๐Ÿ™…โ€โ™€๏ธ

SHOULD

  • this word or the adjective "RECOMMENDED" means there may be valid reasons in particular circumstances to ignore this item ๐Ÿฆ‹ But the full implications should be understood and the case carefully weighed before picking a different course ๐Ÿ’œ

SHOULD NOT

  • this phrase means there may be valid reasons in particular circumstances when the listed behavior is acceptable or even useful ๐ŸŒˆ But the full implications should be understood and the case carefully weighted before implementing any behavior described with this label ๐Ÿง 

MAY

  • this word or the adjective "OPTIONAL" means this item is truly optional ๐ŸŒธ One vendor may choose to include it because a particular marketplace requires it or because it enhances the product ๐ŸŽ€ Another vendor may omit the same item, and that's totally fine ๐Ÿ’…

This document also makes use of internal conceptual variables to describe protocol behavior ๐Ÿงš It also uses external variables that an implementation must let system administrators change ๐Ÿ”ฅ The specific variable names, how their values change, and how their settings influence protocol behavior are given to demonstrate the behavior โœจ An implementation doesn't have to have them in the exact form described here, as long as its external behavior matches what this document describes ๐Ÿ’– Lowkey the main point is: match the behavior, not the exact variable names ๐Ÿ‘‘

3. PROTOCOL OVERVIEW โœจ

okay so this protocol is solving a whole set of problems that come up when nodes are chilling on the same link ๐ŸŽ€ it has a mechanism for each of these:

  • Router Discovery ๐Ÿงš: How hosts locate routers that reside on an attached link.
  • Prefix Discovery ๐ŸŒธ: How hosts discover the set of address prefixes that define which destinations are on-link for an attached link. (Nodes use prefixes to distinguish destinations that reside on-link from those only reachable through a router.)
  • Parameter Discovery ๐Ÿ’…: How a node learns such link parameters as the link MTU or such Internet parameters as the hop limit value to place in outgoing packets.
  • Address Autoconfiguration ๐Ÿฆ‹: How nodes automatically configure an address for an interface.
  • Address resolution ๐Ÿ”: How nodes determine the link-layer address of an on-link destination (e.g., a neighbor) given only the destination's IP address.
  • Next-hop determination ๐Ÿ“: The algorithm for mapping an IP destination address into the IP address of the neighbor to which traffic for the destination should be sent. The next-hop can be a router or the destination itself.
  • Neighbor Unreachability Detection ๐Ÿ’€: How nodes determine that a neighbor is no longer reachable. For neighbors used as routers, alternate default routers can be tried. For both routers and hosts, address resolution can be performed again.
  • Duplicate Address Detection ๐Ÿ‘ฏ: How a node determines that an address it wishes to use is not already in use by another node.
  • Redirect ๐Ÿงญ: How a router informs a host of a better first-hop node to reach a particular destination.

Neighbor Discovery defines five different ICMP packet types ๐Ÿ”ฅ: a pair of Router Solicitation and Router Advertisement messages, a pair of Neighbor Solicitation and Neighbor Advertisements messages, and a Redirect message. Here's what each one is for:

  • Router Solicitation ๐Ÿ™‹: When an interface becomes enabled, hosts may send out Router Solicitations that request routers to generate Router Advertisements immediately rather than at their next scheduled time.
  • 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 on-link determination and/or address configuration, a suggested hop limit value, etc.
  • 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 Solicitations are also used for Duplicate Address Detection.
  • 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.

On multicast-capable links, each router periodically multicasts a Router Advertisement packet announcing its availability ๐Ÿ“ก. A host receives Router Advertisements from all routers, building a list of default routers. Routers generate Router Advertisements frequently enough that hosts will learn of their presence within a few minutes, but not frequently enough to rely on an absence of advertisements to detect router failure. A separate Neighbor Unreachability Detection algorithm provides failure detection, so the vibe is "we've got backup" ๐Ÿซถ

Router Advertisements contain a list of prefixes used for on-link determination and/or autonomous address configuration. 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. Note that a destination can be on-link even though it is not covered by any advertised on-link prefix. In such cases a router can send a Redirect informing the sender that the destination is a neighbor. ๐Ÿง 

Plot twist: a destination can be on-link even when no advertised on-link prefix covers it. Routers can handle that case by sending a Redirect.

Router Advertisements (and per-prefix flags) allow routers to inform hosts how to perform Address Autoconfiguration โš™๏ธ. For example, routers can specify whether hosts should use stateful (DHCPv6) and/or autonomous (stateless) address configuration. The exact semantics and usage of the address configuration-related information is specified in [ADDRCONF].

Router Advertisement messages also contain Internet parameters such as the hop limit that hosts should use in outgoing packets and, optionally, link parameters such as the link MTU. This facilitates centralized administration of critical parameters that can be set on routers and automatically propagated to all attached hosts. Routers are basically the group leader here ๐Ÿ‘‘

Nodes accomplish address resolution by multicasting a Neighbor Solicitation that asks the target node to return its link-layer address. Neighbor Solicitation messages are multicast to the solicited-node multicast address of the target address. The target returns its link-layer address in a unicast Neighbor Advertisement message. A single request-response pair of packets is sufficient for both the initiator and the target to resolve each other's link-layer addresses, because the initiator includes its link-layer address in the Neighbor Solicitation. Efficient and no notes ๐Ÿ”ฅ

Neighbor Solicitation messages can also be used to determine if more than one node has been assigned the same unicast address. The use of Neighbor Solicitation messages for Duplicate Address Detection is specified in [ADDRCONF].

Neighbor Unreachability Detection detects the failure of a neighbor or the failure of the forward path to the neighbor. Doing so requires positive confirmation that packets sent to a neighbor are actually reaching that neighbor and being processed properly by its IP layer. Neighbor Unreachability Detection uses confirmation from two sources:

  • Upper-layer hints ๐Ÿงƒ: When possible, upper-layer protocols provide a positive confirmation that a connection is making "forward progress", that is, previously sent data is known to have been delivered correctly (e.g., new acknowledgments were received recently).
  • Solicited probes ๐Ÿ›Ž๏ธ: When positive confirmation is not forthcoming through such "hints", a node sends unicast Neighbor Solicitation messages that solicit Neighbor Advertisements as reachability confirmation from the next hop.

To reduce unnecessary network traffic, probe messages are only sent to neighbors to which the node is actively sending packets. Efficiency bestie ๐Ÿ’–

In addition to addressing the above general problems, Neighbor Discovery also handles the following situations โœจ:

  • Link-layer address change ๐Ÿ”„: A node that knows its link-layer address has changed can multicast a few (unsolicited) Neighbor Advertisement packets to all nodes to quickly update cached link-layer addresses that have become invalid. Note that the sending of unsolicited advertisements is a performance enhancement only (e.g., unreliable). The Neighbor Unreachability Detection algorithm ensures that all nodes will reliably discover the new address, though the delay may be somewhat longer.
  • Inbound load balancing โš–๏ธ: Nodes with replicated interfaces may want to load balance the reception of incoming packets across multiple network interfaces on the same link. Such nodes have multiple link-layer addresses assigned to the same interface. For example, a single network driver could represent multiple network interface cards as a single logical interface having multiple link-layer addresses. Load balancing is handled by allowing routers to omit the source link-layer address from Router Advertisement packets, thereby forcing neighbors to use Neighbor Solicitation messages to learn link-layer addresses of routers. Returned Neighbor Advertisement messages can then contain link-layer addresses that differ depending on who issued the solicitation. Big brain move ๐Ÿง 
  • Anycast addresses ๐Ÿ“: Anycast addresses identify one of a set of nodes providing an equivalent service, and multiple nodes on the same link may be configured to recognize the same Anycast address. Neighbor Discovery handles anycasts by having nodes expect to receive multiple Neighbor Advertisements for the same target. All advertisements for anycast addresses are tagged as being non-Override advertisements. This invokes specific rules to determine which of potentially multiple advertisements should be used.
  • Proxy advertisements ๐ŸŽญ: A router willing to accept packets on behalf of a target address that is unable to respond to Neighbor Solicitations can issue non-Override Neighbor Advertisements.

There is currently no specified use of proxy, but proxy advertising could potentially be used to handle cases like mobile nodes that have moved off-link. However, it is not intended as a general mechanism to handle nodes that, e.g., do not implement this protocol. So don't try to use it as a catch-all, periodt ๐Ÿ™…โ€โ™€๏ธ

3.1. Comparison with IPv4 โœจ

Okay bestie, so IPv6 Neighbor Discovery is basically doing the jobs of three IPv4 things rolled into one: ARP [ARP], ICMP Router Discovery [RDISC], and ICMP Redirect [ICMPv4]. ๐Ÿ’… In IPv4 there's no generally agreed upon protocol or mechanism for Neighbor Unreachability Detection, though Hosts Requirements [HR-CL] does specify some possible algorithms for Dead Gateway Detection (which is a subset of the stuff Neighbor Unreachability Detection tackles). ๐Ÿฅบ

Neighbor Discovery gives us a whole pile of upgrades over the IPv4 crew ๐Ÿ”ฅ:

  • Router Discovery is part of the base protocol set, so hosts don't have to "snoop" the routing protocols. ๐Ÿ‘€
  • Router advertisements carry link-layer addresses, so no extra packet exchange is needed to resolve the router's link-layer address. ๐Ÿ™Œ
  • Router advertisements carry prefixes for a link, so there's no need for a separate mechanism to configure the "netmask". ๐ŸŽ€
  • Router advertisements enable Address Autoconfiguration. โœจ
  • Routers can advertise an MTU for hosts to use on the link, which makes sure all nodes use the same MTU value on links that don't have a well-defined MTU. ๐ŸŒˆ
  • Address resolution multicasts are "spread" over 4 billion (2^32) multicast addresses, which hugely cuts down on address resolution interruptions for nodes other than the target. Plus, non-IPv6 machines should not be interrupted at all. ๐Ÿฆ‹
  • Redirects contain the link-layer address of the new first hop, so you don't need separate address resolution when you receive a redirect. ๐Ÿ’–
  • Multiple prefixes can be associated with the same link. By default, hosts learn all on-link prefixes from Router Advertisements. Routers can be configured to leave some or all prefixes out of their Router Advertisements, though. In that case hosts assume destinations are off-link and send traffic to routers. ๐Ÿงš
  • A router can then issue redirects as appropriate. ๐Ÿ”
  • Unlike IPv4, the recipient of an IPv6 redirect assumes the new next-hop is on-link. In IPv4, a host ignores redirects specifying a next-hop that isn't on-link according to the link's network mask. The IPv6 redirect mechanism is analogous to the XRedirect facility specified in [SH-MEDIA], and it's expected to be useful on non-broadcast and shared media links where it's undesirable or impossible for nodes to know all prefixes for on-link destinations. ๐Ÿซถ
  • Neighbor Unreachability Detection is part of the base, and it significantly improves the robustness of packet delivery when routers fail, links or nodes partially fail or get partitioned, and nodes change their link-layer addresses. For example, mobile nodes can move off-link without losing any connectivity because of stale ARP caches. ๐Ÿƒโ€โ™€๏ธ
  • Unlike ARP, Neighbor Discovery detects half-link failures (using Neighbor Unreachability Detection) and avoids sending traffic to neighbors you don't have two-way connectivity with. ๐Ÿ™…โ€โ™€๏ธ
  • Unlike IPv4 Router Discovery, Router Advertisement messages don't contain a preference field. The preference field isn't needed to handle routers of different "stability", because Neighbor Unreachability Detection will detect dead routers and switch to a working one. ๐Ÿ’€
  • Using link-local addresses to uniquely identify routers (for Router Advertisement and Redirect messages) lets hosts keep their router associations even when the site gets renumbered to use new global prefixes. ๐Ÿ‘‘
  • Using the Hop Limit equal to 255 trick, Neighbor Discovery is immune to off-link senders that accidentally or intentionally send ND messages. In IPv4, off-link senders can send both ICMP Redirects and Router Advertisement messages. ๐Ÿ›ก๏ธ
  • Putting address resolution at the ICMP layer makes the protocol more media-independent than ARP, and it makes it possible to use standard IP authentication and security mechanisms as appropriate [IPv6-AUTH, IPv6-ESP]. ๐Ÿ”

Neighbor Discovery works on links with different properties. When certain properties are present, only a subset of the ND protocol mechanisms are fully specified in this document, so keep that in mind ๐Ÿง:

  • point-to-point - Neighbor Discovery handles these links just like multicast links. (Multicast can be trivially provided on point to point links, and interfaces can be assigned link-local addresses.) Neighbor Discovery should be implemented as described in this document. ๐Ÿ’œ
  • multicast - Neighbor Discovery should be implemented as described in this document. ๐ŸŒธ
  • non-broadcast multiple access (NBMA) - Redirect, Neighbor Unreachability Detection and next-hop determination should be implemented as described in this document. Address resolution, and the mechanism for delivering Router Solicitations and Advertisements on NBMA links, is not specified in this document. Also, if hosts support manual configuration of a list of default routers, hosts can dynamically acquire the link-layer addresses for their neighbors from Redirect messages. ๐Ÿ“
  • shared media - The Redirect message is modeled after the XRedirect message in [SH-MEDIA] to simplify using the protocol on shared media links.

This specification doesn't address shared media issues that only relate to routers, such as:

  • How routers exchange reachability information on a shared media link.
  • How a router determines the link-layer address of a host, which it needs in order to send redirect messages to the host.
  • How a router determines that it is the first-hop router for a received packet.

The protocol is extensible (through the definition of new options), so other solutions might be possible in the future. ๐Ÿงš

  • variable MTU - Neighbor Discovery lets routers specify an MTU for the link, which all nodes then use. All nodes on a link must use the same MTU (or Maximum Receive Unit) for multicast to work properly. Otherwise, when a sender multicasts, it can't know which nodes will receive the packet, so it couldn't determine a minimum packet size that all receivers can process. ๐Ÿ“
  • asymmetric reachability - Neighbor Discovery detects the absence of symmetric reachability, and a node avoids paths to a neighbor it doesn't have symmetric connectivity with.

The Neighbor Unreachability Detection will typically identify such half-links, and the node will refrain from using them.

The protocol can presumably be extended in the future to find viable paths in environments that lack reflexive and transitive connectivity. ๐Ÿ”ฎ


4. MESSAGE FORMATS ๐Ÿ“

4.1. Router Solicitation Message Format ๐ŸŽ€

Hosts send Router Solicitations to prompt routers to generate Router Advertisements quickly. โšก

   0                   1                   2                   3
   0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  |     Type      |     Code      |          Checksum             |
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  |                            Reserved                           |
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  |   Options ...
  +-+-+-+-+-+-+-+-+-+-+-+-

IP Fields: ๐ŸŒ

  • Source Address - An IP address assigned to the sending interface, or the unspecified address if no address is assigned to the sending interface.
  • Destination Address - Typically the all-routers multicast address.
  • Hop Limit - 255
  • Priority - 15
  • Authentication Header - If a Security Association for the IP Authentication Header exists between the sender and the destination address, then the sender SHOULD include this header. ๐Ÿ”

ICMP Fields: ๐Ÿงพ

  • Type - 133
  • Code - 0
  • Checksum - The ICMP checksum. See [ICMPv6].
  • Reserved - This field is unused. It MUST be initialized to zero by the sender and MUST be ignored by the receiver. ๐Ÿ™ˆ

Valid Options: โœ…

  • Source link-layer address - The link-layer address of the sender, if known.

Future versions of this protocol may define new option types. Receivers MUST silently ignore any options they do not recognize and continue processing the message. ๐Ÿ’…

4.2. Router Advertisement Message Format ๐Ÿ“ก

Routers send out Router Advertisement messages periodically, or in response to a Router Solicitation. ๐Ÿฆ‹

   0                   1                   2                   3
   0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  |     Type      |     Code      |          Checksum             |
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  | Cur Hop Limit |M|O|  Reserved |       Router Lifetime         |
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  |                         Reachable Time                        |
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  |                          Retrans Timer                        |
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  |   Options ...
  +-+-+-+-+-+-+-+-+-+-+-+-

IP Fields: ๐ŸŒ

  • Source Address - MUST be the link-local address assigned to the interface from which this message is sent.
  • Destination Address - Typically the Source Address of an invoking Router Solicitation or the all-nodes multicast address.
  • Hop Limit - 255
  • Priority - 15
  • Authentication Header - If a Security Association for the IP Authentication Header exists between the sender and the destination address, then the sender SHOULD include this header. ๐Ÿ”

ICMP Fields: ๐Ÿ’–

  • Type is 134 โœจ
  • Code is 0
  • Checksum is the ICMP checksum, so go check [ICMPv6] for the deets ๐Ÿงš
  • Cur Hop Limit is an 8-bit unsigned integer ๐Ÿฆ‹. It's the default value that should be placed in the Hop Count field of the IP header for outgoing IP packets. A value of 0 means unspecified (by this router).
  • M is the 1-bit "Managed address configuration" flag ๐ŸŽ€. When it's set, hosts use the administered (stateful) protocol for address autoconfiguration in addition to any addresses they autoconfigure with stateless address autoconfiguration. The [ADDRCONF] doc explains how this flag works.
  • O is the 1-bit "Other stateful configuration" flag ๐ŸŒธ. When it's set, hosts use the administered (stateful) protocol to autoconfigure other information that isn't an address. The [ADDRCONF] doc covers this one too.
  • Reserved is a 6-bit unused field ๐Ÿซถ. It MUST be initialized to zero by the sender and MUST be ignored by the receiver.
  • Router Lifetime is a 16-bit unsigned integer โณ. It's the lifetime of the default router, in seconds. The max value is 18.2 hours. A Lifetime of 0 means the router is not a default router, and it SHOULD NOT appear on the default router list. The Router Lifetime only applies to the router's usefulness as a default router. It doesn't apply to info in other message fields or options. Options that need time limits for their info have their own lifetime fields, so no mixing those up ๐Ÿ’…
  • Reachable Time is a 32-bit unsigned integer ๐Ÿ“. It's the time, in milliseconds, that a node assumes a neighbor is reachable after getting a reachability confirmation. The Neighbor Unreachability Detection algorithm uses it (see Section 7.3). A value of 0 means unspecified (by this router).
  • Retrans Timer is a 32-bit unsigned integer ๐ŸŒˆ. It's the time, in milliseconds, between retransmitted Neighbor Solicitation messages. Address resolution and the Neighbor Unreachability Detection algorithm both use it (see Sections 7.2 and 7.3). A value of 0 means unspecified (by this router).

Possible options: ๐ŸŒŸ

  • Source link-layer address: This is the link-layer address of the interface the Router Advertisement is sent from. It only gets used on link layers that have addresses. A router MAY omit this option so it can enable inbound load sharing across multiple link-layer addresses. Smart move ๐Ÿง 
  • MTU: This SHOULD be sent on links that have a variable MTU (as specified in the document that describes how to run IP over that particular link type). It MAY be sent on other links ๐Ÿ’œ
  • Prefix Information: These options specify the prefixes that are on-link and/or used for address autoconfiguration. A router SHOULD include all its on-link prefixes (except the link-local prefix) so multihomed hosts have complete prefix info about on-link destinations for the links they attach to. If the info is incomplete, a multihomed host may not be able to choose the correct outgoing interface when it sends traffic to its neighbors. Big yikes ๐Ÿ˜ญ

Future versions of this protocol may define new option types. Receivers MUST silently ignore any options they don't recognize and keep processing the message. Chill ๐Ÿซถ


4.3. Neighbor Solicitation Message Format ๐Ÿฆ‹

Nodes send Neighbor Solicitations to ask for the link-layer address of a target node, and they include their own link-layer address so the target knows who's asking ๐Ÿ’Œ Neighbor Solicitations are multicast when a node needs to resolve an address, and unicast when a node wants to check that a neighbor is still reachable.

      0                   1                   2                   3
      0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     |     Type      |     Code      |          Checksum             |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     |                           Reserved                            |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     |                                                               |
     +                                                               +
     |                                                               |
     +                       Target Address                          +
     |                                                               |
     +                                                               +
     |                                                               |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     |   Options ...
     +-+-+-+-+-+-+-+-+-+-+-+-

IP Fields: ๐ŸŒธ

  • Source Address: This is either an address assigned to the interface the message is sent from, or (if Duplicate Address Detection is in progress [ADDRCONF]) the unspecified address.
  • Destination Address: This is either the solicited-node multicast address that matches the target address, or the target address itself.
  • Hop Limit is 255
  • Priority is 15
  • Authentication Header: If a Security Association for the IP Authentication Header exists between the sender and the destination address, then the sender SHOULD include this header ๐Ÿ”

ICMP Fields: ๐ŸŽ€

  • Type is 135
  • Code is 0
  • Checksum is the ICMP checksum. See [ICMPv6].
  • Reserved is unused ๐Ÿ™ˆ. It MUST be initialized to zero by the sender and MUST be ignored by the receiver.
  • Target Address is the IP address of the target of the solicitation. It MUST NOT be a multicast address ๐Ÿšซ

Possible options: ๐Ÿงš

  • Source link-layer address: This is the link-layer address for the sender. On link layers that have addresses, this option MUST be included in multicast solicitations and SHOULD be included in unicast solicitations.

Future versions of this protocol may define new option types. Receivers MUST silently ignore any options they don't recognize and keep processing the message. ๐Ÿซถ


4.4. Neighbor Advertisement Message Format ๐ŸŒˆ

A node sends Neighbor Advertisements in response to Neighbor Solicitations. It also sends unsolicited Neighbor Advertisements to (unreliably) spread new info quickly ๐Ÿš€

      0                   1                   2                   3
      0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     |     Type      |     Code      |          Checksum             |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     |R|S|O|                     Reserved                            |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     |                                                               |
     +                                                               +
     |                                                               |
     +                       Target Address                          +
     |                                                               |
     +                                                               +
     |                                                               |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     |   Options ...
     +-+-+-+-+-+-+-+-+-+-+-+-

IP Fields: ๐Ÿฆ„

  • Source Address: An address assigned to the interface the advertisement is sent from.
  • Destination Address: For solicited advertisements, this is the Source Address of the invoking Neighbor Solicitation or, if that solicitation's Source Address is the unspecified address, the all-nodes multicast address. For unsolicited advertisements, it's typically the all-nodes multicast address.
  • Hop Limit is 255
  • Priority is 15
  • Authentication Header: If a Security Association for the IP Authentication Header exists between the sender and the destination address, then the sender SHOULD include this header ๐Ÿ”

ICMP Fields: ๐Ÿ’…

  • Type is 136
  • Code is 0
  • Checksum is the ICMP checksum. See [ICMPv6].
  • R is the Router flag ๐Ÿ‘‘. When it's set, the R-bit says the sender is a router. Neighbor Unreachability Detection uses the R-bit to spot a router that has turned into a host.
  • S is the Solicited flag โœจ. When it's set, the S-bit says the advertisement was sent in response to a Neighbor Solicitation from the Destination address. Neighbor Unreachability Detection uses the S-bit as a reachability confirmation. It MUST NOT be set in multicast advertisements or in unsolicited unicast advertisements. Not it. ๐Ÿ™…โ€โ™€๏ธ
  • O is the Override flag ๐Ÿ”ฅ. When it's set, the O-bit says the advertisement should override an existing cache entry and update the cached link-layer address. When it's not set, the advertisement won't update a cached link-layer address. It will still update an existing Neighbor Cache entry for which no link-layer address is known. It SHOULD NOT be set in solicited advertisements for anycast addresses and in solicited proxy advertisements. It SHOULD be set in other solicited advertisements and in unsolicited advertisements.
  • Reserved is a 29-bit unused field ๐Ÿ™ˆ. It MUST be initialized to zero by the sender and MUST be ignored by the receiver.
  • Target Address: For solicited advertisements, this is the Target Address field from the Neighbor Solicitation message that prompted this advertisement. For an unsolicited advertisement, it's the address whose link-layer address has changed. The Target Address MUST NOT be a multicast address ๐Ÿšซ

Possible options: ๐ŸŒท

  • Target link-layer address: This is the link-layer address for the target, meaning the sender of the advertisement. It MUST be included on link layers that have addresses.

Future versions of this protocol may define new option types. Receivers MUST silently ignore any options they don't recognize and keep processing the message. ๐Ÿ’–

4.5. Redirect Message Format ๐Ÿฆ‹

okay so routers send Redirect packets to tell a host there's a better first-hop node on the path to a destination ๐Ÿงญ hosts can get redirected to a better first-hop router, but a redirect can also say "hey, the destination is literally your neighbor" ๐Ÿ™ˆ that's done by setting the ICMP Target Address equal to the ICMP Destination Address.

      0                   1                   2                   3
      0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     |     Type      |     Code      |          Checksum             |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     |                           Reserved                            |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     |                                                               |
     +                                                               +
     |                                                               |
     +                       Target Address                          +
     |                                                               |
     +                                                               +
     |                                                               |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     |                                                               |
     +                                                               +
     |                                                               |
     +                     Destination Address                       +
     |                                                               |
     +                                                               +
     |                                                               |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     |   Options ...
     +-+-+-+-+-+-+-+-+-+-+-+-

IP Fields:

Source Address โœจ The Source Address MUST be the link-local address assigned to the interface from which this message is sent.

Destination Address ๐ŸŽฏ This is the Source Address of the packet that triggered the redirect.

Hop Limit ๐Ÿ”ข The value is 255.

Priority ๐Ÿ”ข The value is 15.

Authentication Header ๐Ÿ” If a Security Association for the IP Authentication Header exists between the sender and the destination address, then the sender SHOULD include this header.

ICMP Fields:

Type ๐Ÿท๏ธ The value is 137.

Code ๐Ÿท๏ธ The value is 0.

Checksum โž• This is the ICMP checksum. See [ICMPv6].

Reserved ๐Ÿซ™ This field is unused. It MUST be initialized to zero by the sender and MUST be ignored by the receiver.

Target Address ๐ŸŽฏ This is an IP address that is a better first hop to use for the ICMP Destination Address. When the target is the actual endpoint of communication, i.e., the destination is a neighbor, the Target Address field MUST contain the same value as the ICMP Destination Address field. Otherwise the target is a better first-hop router and the Target Address MUST be the router's link-local address so that hosts can uniquely identify routers. ๐Ÿงš

Destination Address ๐Ÿ’Œ This is the IP address of the destination which is redirected to the target.

Possible options:

Target link-layer address ๐Ÿ”— This is the link-layer address for the target. It SHOULD be included (if known). Note that on NBMA links, hosts may rely on the presence of the Target Link-Layer Address option in Redirect messages as the means for determining the link-layer addresses of neighbors. In such cases, the option MUST be included in Redirect messages. ๐Ÿ’…

Redirected Header ๐Ÿ“ฆ As much as possible of the IP packet that triggered the sending of the Redirect, without making the redirect packet exceed 576 octets.


4.6. Option Formats ๐ŸŽ€

Neighbor Discovery messages include zero or more options, and some of them can show up multiple times in the same message ๐ŸŒธ All options look like this:

      0                   1                   2                   3
      0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     |     Type      |    Length     |              ...              |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     ~                              ...                              ~
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Fields:

Type ๐Ÿท๏ธ This is an 8-bit identifier of the type of option. The options defined in this document are:

                      Option Name                             Type

                   Source Link-Layer Address                    1
                   Target Link-Layer Address                    2
                   Prefix Information                           3
                   Redirected Header                            4
                   MTU                                          5

Length ๐Ÿ“ This is an 8-bit unsigned integer. It is the length of the option in units of 8 octets. The value 0 is invalid. Nodes MUST silently discard an ND packet that contains an option with length zero. ๐Ÿ™…โ€โ™€๏ธ


      0                   1                   2                   3
      0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     |     Type      |    Length     |    Link-Layer Address ...
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Fields:

Type ๐Ÿท๏ธ The value is 1 for Source Link-layer Address, and 2 for Target Link-layer Address.

Length ๐Ÿ“ This is the length of the option in units of 8 octets. For example, the length for IEEE 802 addresses is 1 [IPv6-ETHER].

Link-Layer Address ๐Ÿชช This is the variable length link-layer address. The content and format of this field (including byte and bit ordering) is expected to be specified in specific documents that describe how IPv6 operates over different link layers. For instance, [IPv6-ETHER].

Description:

The Source Link-Layer Address option contains the link-layer address of the sender of the packet. It is used in the Neighbor Solicitation, Router Solicitation, and Router Advertisement packets. ๐Ÿ“จ

The Target Link-Layer Address option contains the link-layer address of the target. It is used in Neighbor Advertisement and Redirect packets. ๐ŸŽฏ

These options MUST be silently ignored for other Neighbor Discovery messages. ๐Ÿ™ˆ


4.6.2. Prefix Information ๐ŸŒˆ

      0                   1                   2                   3
      0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     |     Type      |    Length     | Prefix Length |L|A| Reserved1 |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     |                         Valid Lifetime                        |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     |                       Preferred Lifetime                      |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     |                           Reserved2                           |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     |                                                               |
     +                                                               +
     |                                                               |
     +                            Prefix                             +
     |                                                               |
     +                                                               +
     |                                                               |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Fields:

Type ๐Ÿท๏ธ The value is 3.

Length ๐Ÿ“ The value is 4.

Prefix Length ๐Ÿ”ข This is an 8-bit unsigned integer. It is the number of leading bits in the Prefix that are valid. The value ranges from 0 to 128.

L ๐Ÿ  This is a 1-bit on-link flag. When set, it indicates that this prefix can be used for on-link determination. When not set, the advertisement makes no statement about on-link or off-link properties of the prefix. For instance, the prefix might be used for address configuration with some of the addresses belonging to the prefix being on-link and others being off-link.

A ๐Ÿ› ๏ธ This is a 1-bit autonomous address-configuration flag. When set, it indicates that this prefix can be used for autonomous address configuration as specified in [ADDRCONF].

Reserved1 ๐Ÿซ™ This is a 6-bit unused field. It MUST be initialized to zero by the sender and MUST be ignored by the receiver.

Valid Lifetime โณ This is a 32-bit unsigned integer. It is the length of time in seconds (relative to the time the packet is sent) that the prefix is valid for the purpose of on-link determination. A value of all one bits (0xffffffff) represents infinity. The Valid Lifetime is also used by [ADDRCONF].

Preferred Lifetime โŒ› This is a 32-bit unsigned integer. It is the length of time in seconds (relative to the time the packet is sent) that addresses generated from the prefix via stateless address autoconfiguration remain preferred [ADDRCONF]. A value of all one bits (0xffffffff) represents infinity. See [ADDRCONF].

Reserved2 ๐Ÿซ™ This field is unused. It MUST be initialized to zero by the sender and MUST be ignored by the receiver.

Prefix ๐Ÿ—บ๏ธ This is an IP address or a prefix of an IP address. The Prefix Length field contains the number of valid leading bits in the prefix. The bits in the prefix after the prefix length are reserved and MUST be initialized to zero by the sender and ignored by the receiver. A router SHOULD NOT send a prefix option for the link-local prefix, and a host SHOULD ignore such a prefix option. ๐Ÿšซ

Description:

The Prefix Information option provides hosts with on-link prefixes and prefixes for Address Autoconfiguration. ๐Ÿ’–

The Prefix Information option appears in Router Advertisement packets and MUST be silently ignored for other messages. ๐Ÿ™ˆ

4.6.3. Redirected Header ๐ŸŽ€

      0                   1                   2                   3
      0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     |     Type      |    Length     |            Reserved           |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     |                           Reserved                            |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     |                                                               |
     ~                       IP header + data                        ~
     |                                                               |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

okay so this option is the Redirected Header ๐Ÿฆ‹ and it's giving "here's the packet that got redirected, look at it" energy ๐Ÿ’…

Fields:

  • Type 4 ๐Ÿ’–
  • Length is the length of the option, measured in units of 8 octets โœจ
  • Reserved is unused ๐Ÿ™ˆ The sender has to set these to zero ๐Ÿซถ and the receiver has to ignore them ๐Ÿ’€ They're basically decoration, but they're still required decoration, so keep them zeroed out! Specifically, they MUST be initialized to zero by the sender and MUST be ignored by the receiver.
  • IP header + data is the original packet, chopped down so the whole redirect message doesn't go over 576 octets ๐ŸŒธ

Description

The Redirected Header option shows up in Redirect messages and carries all or part of the packet that's getting redirected ๐Ÿ‘‘

This option MUST be silently ignored for other Neighbor Discovery messages. No drama, just ignore it ๐Ÿซ 

4.6.4. MTU ๐ŸŒˆ

      0                   1                   2                   3
      0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     |     Type      |    Length     |           Reserved            |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     |                              MTU                              |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Fields:

  • Type 5 โœจ
  • Length 1 ๐Ÿงš
  • Reserved is unused ๐Ÿฅบ The sender MUST initialize it to zero, and the receiver MUST ignore it, same vibe as before ๐Ÿ’œ
  • MTU is a 32-bit unsigned integer, and it's the recommended MTU for the link ๐Ÿ“

Description

The MTU option gets used in Router Advertisement messages so that every node on a link ends up using the same MTU value. This matters most when the link MTU isn't well known ๐ŸŽ€

This option MUST be silently ignored for other Neighbor Discovery messages. ๐Ÿ™ƒ

Here's the lowkey tricky part ๐Ÿ‘€ When heterogeneous technologies are bridged together, the maximum supported MTU can be different from one segment to the next. If the bridges don't generate ICMP Packet Too Big messages, communicating nodes can't use Path MTU to figure out the right MTU for each neighbor. In that situation, routers use the MTU option to advertise an MTU value that every segment supports. It's giving "we all agree on one number so nobody gets left out" ๐Ÿซถ๐ŸŒˆ

5. CONCEPTUAL MODEL OF A HOST โœจ

This section lays out a conceptual model of one possible data structure organization that hosts (and to some extent routers) keep track of while they talk to neighboring nodes ๐Ÿฆ‹ The point of the model is just to make it easier to explain how the Neighbor Discovery protocol should behave. This document doesn't force implementations to follow this model, as long as their external behavior matches what's described here ๐Ÿ’…

This model only cares about the parts of host behavior that are directly related to Neighbor Discovery. So it doesn't get into stuff like source address selection or picking an outgoing interface on a multihomed host. Not its job, bestie ๐Ÿ’โ€โ™€๏ธ

5.1. Conceptual Data Structures ๐ŸŒธ

Hosts need to keep track of the following information for each interface:

Neighbor Cache

  • Okay so this is a set of entries about individual neighbors that traffic has been sent to recently ๐Ÿ’– Entries are keyed on the neighbor's on-link unicast IP address, and they hold stuff like its link-layer address, a flag saying whether the neighbor is a router or a host (called IsRouter in this document), and a pointer to any queued packets waiting for address resolution to finish, etc. โœจ

A Neighbor Cache entry also holds info for the Neighbor Unreachability Detection algorithm, including the reachability state, the number of unanswered probes, and the time the next Neighbor Unreachability Detection event is scheduled to happen ๐Ÿ”ฅ

Destination Cache

  • This is a set of entries about destinations that traffic has been sent to recently ๐Ÿงš It covers both on-link and off-link destinations, and it gives you a level of indirection into the Neighbor Cache. Basically, the Destination Cache maps a destination IP address to the IP address of the next-hop neighbor ๐Ÿฆ‹ It gets updated with info learned from Redirect messages. Implementations can also stash extra stuff that isn't directly Neighbor Discovery related in these entries, like the Path MTU (PMTU) and the round trip timers that transport protocols keep ๐Ÿ“

Prefix List

  • This is a list of prefixes that define a set of addresses that are on-link ๐ŸŒˆ Prefix List entries get created from info in Router Advertisements. Each entry has an invalidation timer value (pulled from the advertisement) that's used to expire prefixes once they become invalid โฐ There's a special "infinity" timer value that means a prefix stays valid forever, unless a new finite value shows up in a later advertisement โ™พ๏ธ

The link-local prefix is treated as being on the prefix list with an infinite invalidation timer, no matter whether routers are advertising a prefix for it ๐Ÿ‘‘ Received Router Advertisements SHOULD NOT modify the invalidation timer for the link-local prefix. Hands off, the link-local timer is untouchable ๐Ÿ™…โ€โ™€๏ธ

Default Router List

  • This is a list of routers that packets can be sent to ๐Ÿซถ Router list entries point to entries in the Neighbor Cache, and the algorithm for picking a default router prefers routers known to be reachable over ones whose reachability is suspect โœจ Each entry also has an invalidation timer value (pulled from Router Advertisements) that's used to delete entries that aren't being advertised anymore ๐Ÿ’€
Real talk: these conceptual data structures can be built in a bunch of different ways ๐ŸŽ€ One option is a single longest-match routing table for all of the above. Whatever approach you pick, it's critical that the Neighbor Cache entry for a router is shared by all Destination Cache entries that use that router, so you don't end up sending redundant Neighbor Unreachability Detection probes ๐Ÿ˜ญ

Also, other protocols (like IPv6 Mobility) might add their own conceptual data structures ๐Ÿฆ‹ An implementation is totally free to build those however it wants. For example, it could merge every conceptual data structure into one routing table ๐Ÿ’œ

The Neighbor Cache holds the info maintained by the Neighbor Unreachability Detection algorithm. The key piece is a neighbor's reachability state, and there are five possible values ๐ŸŒธ

The definitions below are informal, so if you want the precise ones, check Section 7.3.2 ๐Ÿ“–

INCOMPLETE Address resolution is in progress and the link-layer address of the neighbor hasn't been determined yet. ๐Ÿฅบ

REACHABLE Roughly speaking, the neighbor was known to be reachable recently (within tens of seconds ago). ๐Ÿ’–

STALE The neighbor is no longer known to be reachable, but until traffic is sent to it, no attempt should be made to verify its reachability. ๐ŸŒ™

DELAY The neighbor is no longer known to be reachable, and traffic was recently sent to it. Instead of probing right away, the node waits a short while so upper layer protocols get a chance to confirm reachability on their own โณ

PROBE The neighbor is no longer known to be reachable, and unicast Neighbor Solicitation probes are being sent to verify reachability ๐Ÿ”

5.2. Conceptual Sending Algorithm ๐Ÿ“จ

Okay bestie, so when a node wants to send a packet somewhere, it mixes together the Destination Cache, the Prefix List, and the Default Router List to figure out the IP address of the right next hop ๐Ÿ’… This is called "next-hop determination" and it's giving main character energy โœจ Once the node knows the next hop's IP address, it checks the Neighbor Cache for the link-layer info about that neighbor ๐Ÿฆ‹

For a unicast destination, next-hop determination goes like this ๐ŸŒธ The sender does a longest prefix match against the Prefix List to find out whether the destination is on-link or off-link. If it's on-link, the next-hop address is just the packet's destination address, super simple ๐Ÿซถ If it's off-link, the sender picks a router from the Default Router List (following the rules in Section 6.3.6). And if the Default Router List is empty? The sender just assumes the destination is on-link ๐Ÿ™ˆ

Now, doing this math for every single packet would be a lot, so for efficiency reasons, next-hop determination isn't run on every packet ๐Ÿ’œ Instead, the results get saved in the Destination Cache, which also picks up updates learned from Redirect messages ๐Ÿงš So when a node has something to send, it checks the Destination Cache first. If there's no entry for that destination, next-hop determination gets invoked to make one ๐ŸŽ€

Once the next-hop IP is known, the sender checks the Neighbor Cache for that neighbor's link-layer info. If there's no entry yet, the sender makes one, sets its state to INCOMPLETE, starts Address Resolution, and queues the data packet until resolution finishes ๐Ÿ˜ญ On multicast-capable interfaces, Address Resolution means sending a Neighbor Solicitation message and waiting for a Neighbor Advertisement. When the Neighbor Advertisement comes back, the link-layer address is entered into the Neighbor Cache entry and the queued packet gets sent ๐Ÿ”ฅ The full details of address resolution are in Section 7.2.

For multicast packets, the next hop is always the (multicast) destination address, and it's considered on-link ๐ŸŒˆ How to figure out the link-layer address for a given IP multicast address is covered in a separate document about running IP over a particular link type (for example, [IPv6-ETHER]) ๐Ÿ“

Every time a Neighbor Cache entry is accessed while sending a unicast packet, the sender checks the Neighbor Unreachability Detection info according to the Neighbor Unreachability Detection algorithm in Section 7.3 โœจ This check might lead the sender to transmit a unicast Neighbor Solicitation just to confirm the neighbor is still reachable ๐Ÿ‘‘

Next-hop determination happens the first time traffic is sent to a destination ๐Ÿ’– As long as later communication to that destination keeps working, the Destination Cache entry keeps getting used. But if communication stops working, as the Neighbor Unreachability Detection algorithm decides, next-hop determination may need to happen again ๐Ÿ’€ For example, traffic going through a failed router should be switched over to a working router. It may also be possible to reroute traffic meant for a mobile node to a "mobility agent" ๐Ÿฆ‹

Here's a fun bit ๐Ÿ’… When a node redoes next-hop determination, it doesn't have to throw away the whole Destination Cache entry. It's generally beneficial to keep cached stuff like the PMTU and round trip timer values that may also live in that entry ๐ŸŒธ

Routers and multihomed hosts have multiple interfaces ๐Ÿงš The rest of this document assumes that all sent and received Neighbor Discovery messages refer to the interface of the appropriate context. For example, when a router responds to a Router Solicitation, the Router Advertisement goes out the interface the solicitation came in on โœจ

5.3. Garbage Collection and Timeout Requirements ๐Ÿ—‘๏ธ

Okay so the conceptual data structures above each use different ways of getting rid of info that might be stale or unused ๐Ÿงน

From a correctness point of view, there's no need to periodically purge Destination and Neighbor Cache entries ๐Ÿ’œ Stale info can technically hang around forever, but the Neighbor Unreachability Detection algorithm makes sure stale info gets purged quickly if it's actually being used ๐Ÿซถ

To limit the storage needed for the Destination and Neighbor Caches, a node may need to garbage-collect old entries ๐ŸŽ€ But be careful! Enough space must always be there to hold the working set of active entries ๐Ÿ˜ญ A tiny cache can cause a ton of Neighbor Discovery messages if entries keep getting discarded and rebuilt in quick succession ๐Ÿ’€ Any LRU-based policy that only reclaims entries not used in a while (for example, ten minutes or more) should be adequate for garbage-collecting unused entries ๐ŸŒˆ

A node should keep entries in the Default Router List and the Prefix List until their lifetimes expire ๐Ÿ“ However, a node may garbage collect entries early if it's low on memory. If not all routers are kept on the Default Router List, a node should keep at least two entries in the Default Router List (and preferably more) so it can stay robustly connected to off-link destinations ๐Ÿ‘‘

When removing an entry from the Prefix List, there's no need to purge any entries from the Destination or Neighbor Caches ๐Ÿฆ‹ Neighbor Unreachability Detection will efficiently purge any entries in those caches that have become invalid โœจ Removing an entry from the Default Router List is different, though ๐Ÿšจ Any entries in the Destination Cache that go through that router must do next-hop determination again to select a new default router ๐Ÿ’…

6. ROUTER AND PREFIX DISCOVERY ๐Ÿ›ฐ๏ธ

This section is all about router and host behavior for the Router Discovery part of Neighbor Discovery ๐Ÿ’– Router Discovery is how nodes find neighboring routers, and how they learn prefixes and configuration parameters for address autoconfiguration ๐Ÿงš

Prefix Discovery is how hosts learn the ranges of IP addresses that sit on-link and can be reached directly, without going through a router ๐ŸŒธ Routers send Router Advertisements that say whether the sender is willing to be a default router. Router Advertisements also carry Prefix Information options that list the prefixes identifying on-link IP addresses ๐Ÿซถ

Stateless Address Autoconfiguration also has to get subnet prefixes as part of configuring addresses ๐ŸŽ€ The prefixes used for autoconfiguration are logically separate from the ones used for on-link determination, but the autoconfiguration info gets piggybacked onto Router Discovery messages to cut down on network traffic ๐Ÿ“ In fact, the same prefixes can be advertised for both on-link determination and address autoconfiguration by setting the right flags in the Prefix Information options โœจ For how autoconfiguration info gets processed, see [ADDRCONF] ๐Ÿ’œ

6.1. Message Validation ๐Ÿ”

6.1.1. Validation of Router Solicitation Messages

Hosts MUST silently discard any received Router Solicitation Messages ๐Ÿ™ˆ

A router MUST silently discard any received Router Solicitation messages that don't pass all of these validity checks ๐Ÿ’…

  • The IP Hop Limit field has a value of 255, meaning the packet could not possibly have been forwarded by a router ๐ŸŒˆ
  • If the message includes an IP Authentication Header, the message authenticates correctly ๐Ÿ”
  • The ICMP Checksum is valid ๐Ÿงฎ
  • The ICMP Code is 0 ๐Ÿ’–
  • The ICMP length (derived from the IP length) is 8 or more octets ๐Ÿ“
  • All included options have a length that is greater than zero ๐ŸŒธ

The contents of the Reserved field, and of any unrecognized options, MUST be ignored ๐Ÿ™ˆ Future, backward-compatible changes to the protocol may specify the contents of the Reserved field or add new options, while backward-incompatible changes may use different Code values ๐Ÿฆ‹

The contents of any defined options that aren't specified to be used with Router Solicitation messages MUST be ignored, and the packet gets processed as normal โœจ The only defined option that may appear is the Source Link-Layer Address option ๐Ÿงš

A solicitation that passes the validity checks is called a "valid solicitation" ๐Ÿ’œ

6.1.2. Validation of Router Advertisement Messages

A node MUST silently discard any received Router Advertisement messages that don't pass all of these validity checks ๐Ÿ˜ญ

  • The IP Source Address is a link-local address. Routers must use their link-local address as the source for Router Advertisement and Redirect messages so that hosts can uniquely identify routers ๐Ÿซถ
  • The IP Hop Limit field has a value of 255, meaning the packet could not possibly have been forwarded by a router ๐ŸŒˆ
  • If the message includes an IP Authentication Header, the message authenticates correctly ๐Ÿ”
  • The ICMP Checksum is valid ๐Ÿงฎ
  • The ICMP Code is 0 ๐Ÿ’–
  • The ICMP length (derived from the IP length) is 16 or more octets ๐Ÿ“
  • All included options have a length that is greater than zero ๐ŸŒธ

The contents of the Reserved field, and of any unrecognized options, MUST be ignored ๐Ÿ™ˆ Future, backward-compatible changes to the protocol may specify the contents of the Reserved field or add new options, while backward-incompatible changes may use different Code values ๐Ÿฆ‹

The contents of any defined options that aren't specified to be used with Router Advertisement messages MUST be ignored, and the packet gets processed as normal โœจ The only defined options that may appear are the Source Link-Layer Address, Prefix Information and MTU options ๐Ÿงš

An advertisement that passes the validity checks is called a "valid advertisement" ๐Ÿ’œ

6.2. Router Specification ๐Ÿ‘‘

6.2.1. Router Configuration Variables ๐ŸŽ€

okay so a router MUST let system management configure the following conceptual variables ๐Ÿ’… the names are just there for demo purposes, bestie. an implementation doesn't need to literally have them, as long as its external behavior is consistent with what this doc describes โœจ default values are listed so config is easy in the common cases ๐Ÿซถ

some of the defaults below can get overridden by specific docs that explain how IPv6 runs over different link layers ๐ŸŒˆ that's lowkey genius because Neighbor Discovery has to work over link types with wildly different performance, so this keeps the setup from being a nightmare ๐Ÿ˜ญ

For each multicast interface:

  • AdvSendAdvertisements: a flag for whether or not the router sends periodic Router Advertisements and responds to Router Solicitations.
    • Default: FALSE
    • ngl this one is the most important girlie ๐Ÿ‘‘ AdvSendAdvertisements MUST be false by default, so a node won't accidentally start acting like a router unless system management explicitly configures it to send Router Advertisements ๐Ÿ™ˆ
  • MaxRtrAdvInterval: the maximum time allowed between sending unsolicited multicast Router Advertisements from the interface, in seconds. MUST be no less than 4 seconds and no greater than 1800 seconds.
    • Default: 600 seconds
  • MinRtrAdvInterval: the minimum time allowed between sending unsolicited multicast Router Advertisements from the interface, in seconds. MUST be no less than 3 seconds and no greater than .75 * MaxRtrAdvInterval.
    • Default: 0.33 * MaxRtrAdvInterval
  • AdvManagedFlag: the true/false value that goes in the "Managed address configuration" flag field in the Router Advertisement. see [ADDRCONF] ๐Ÿฆ‹
    • Default: FALSE
  • AdvOtherConfigFlag: the true/false value that goes in the "Other stateful configuration" flag field in the Router Advertisement. see [ADDRCONF] ๐Ÿฆ‹
    • Default: FALSE
  • AdvLinkMTU: the value that goes in MTU options sent by the router. a value of zero means no MTU options get sent ๐Ÿ’€
    • Default: 0
  • AdvReachableTime: the value that goes in the Reachable Time field of the Router Advertisement messages the router sends. zero means unspecified (by this router). MUST be no greater than 3,600,000 milliseconds (1 hour).
    • Default: 0
  • AdvRetransTimer: the value that goes in the Retrans Timer field of the Router Advertisement messages the router sends. zero means unspecified (by this router).
    • Default: 0
  • AdvCurHopLimit: the default value that goes in the Cur Hop Limit field of the Router Advertisement messages the router sends. the value should be set to the current diameter of the Internet ๐ŸŒธ zero means unspecified (by this router).
    • Default: the value specified in the "Assigned Numbers" RFC [ASSIGNED] that was in effect at the time of implementation
  • AdvDefaultLifetime: the value that goes in the Router Lifetime field of Router Advertisements sent from the interface, in seconds. MUST be either zero or between MaxRtrAdvInterval and 9000 seconds. a value of zero means the router is not to be used as a default router ๐Ÿ™…โ€โ™€๏ธ
    • Default: 3 * MaxRtrAdvInterval
  • AdvPrefixList: a list of prefixes to go in Prefix Information options in Router Advertisement messages sent from the interface ๐Ÿงš
    • Default: all prefixes that the router advertises via routing protocols as being on-link for the interface the advertisement is sent from. The link-local prefix SHOULD NOT be included in the list of advertised prefixes ๐Ÿ’…
    • Each prefix has an associated:
      • AdvValidLifetime: the value that goes in the Valid Lifetime in the Prefix Information option, in seconds. the designated value of all 1's (0xffffffff) represents infinity โ™พ๏ธ
        • Default: infinity.
      • AdvOnLinkFlag: the value that goes in the on-link flag ("L-bit") field in the Prefix Information option.
        • Default: TRUE
    • Automatic address configuration [ADDRCONF] defines additional information associated with each of the prefixes:
      • AdvPreferredLifetime: the value that goes in the Preferred Lifetime in the Prefix Information option, in seconds. the designated value of all 1's (0xffffffff) represents infinity. see [ADDRCONF].
        • Default: 604800 seconds (7 days)
      • AdvAutonomousFlag: the value that goes in the Autonomous Flag field in the Prefix Information option. see [ADDRCONF].
        • Default: TRUE

the variables above hold the info that goes into outgoing Router Advertisement messages ๐Ÿ“ฉ hosts use the info they receive to set up a bunch of matching variables that control their external behavior (see Section 6.3.2). some of these host variables (like CurHopLimit, RetransTimer, and ReachableTime) apply to all nodes, routers included ๐ŸŒˆ in practice, these variables might not actually exist on routers, since their contents can be derived from the variables above. BUT external router behavior MUST be the same as host behavior for these variables ๐Ÿซถ this includes the occasional randomization of the ReachableTime value, as described in Section 6.3.2.

Protocol constants are defined in Section 10.

6.2.2. Becoming An Advertising Interface ๐Ÿฆ‹

the term "advertising interface" refers to any functioning and enabled multicast interface that has at least one unicast IP address assigned to it AND whose AdvSendAdvertisements flag is TRUE ๐Ÿ’– a router MUST NOT send Router Advertisements out any interface that isn't an advertising interface ๐Ÿšซ

an interface can become an advertising interface at times other than system startup too โœจ for example:

  • changing the AdvSendAdvertisements flag on an enabled interface from FALSE to TRUE, or
  • administratively enabling the interface, if it had been administratively disabled, and its AdvSendAdvertisements flag is TRUE, or
  • enabling IP forwarding capability (aka changing the system from being a host to being a router), when the interface's AdvSendAdvertisements flag is TRUE.

a router MUST join the all-routers multicast address on an advertising interface ๐ŸŽ€ routers respond to Router Solicitations sent to the all-routers address, and they verify the consistency of Router Advertisements sent by neighboring routers ๐Ÿ‘‘

6.2.3. Router Advertisement Message Content ๐Ÿ’Œ

a router sends periodic AND solicited Router Advertisements out its advertising interfaces ๐Ÿ“ฃ outgoing Router Advertisements get filled with these values, matching the message format in Section 4.2:

  • In the Router Lifetime field: the interface's configured AdvDefaultLifetime.
  • In the M and O flags: the interface's configured AdvManagedFlag and AdvOtherConfigFlag, respectively. See [ADDRCONF].
  • In the Cur Hop Limit field: the interface's configured CurHopLimit.
  • In the Reachable Time field: the interface's configured AdvReachableTime.
  • In the Retrans Timer field: the interface's configured AdvRetransTimer.
  • In the options:
    • Source Link-Layer Address option: the link-layer address of the sending interface. This option MAY be omitted to facilitate in-bound load balancing over replicated interfaces ๐Ÿ“
    • MTU option: the interface's configured AdvLinkMTU value if the value is non-zero. If AdvLinkMTU is zero, the MTU option is not sent.
    • Prefix Information options: one Prefix Information option for each prefix listed in AdvPrefixList, with the option fields set from the info in the AdvPrefixList entry as follows:
      • In the "on-link" flag: the entry's AdvOnLinkFlag.
      • In the Valid Lifetime field: the entry's AdvValidLifetime.
      • In the "Autonomous address configuration" flag: the entry's AdvAutonomousFlag.
      • In the Preferred Lifetime field: the entry's AdvPreferredLifetime.

a router might want to send Router Advertisements WITHOUT advertising itself as a default router ๐Ÿ™ˆ for instance, a router might advertise prefixes for address autoconfiguration while not wanting to forward packets. a router like that sets the Router Lifetime field in outgoing advertisements to zero ๐Ÿซ 

a router MAY choose not to include some or all options when sending unsolicited Router Advertisements ๐Ÿงƒ for example, if prefix lifetimes are way longer than AdvDefaultLifetime, including them every few advertisements might be enough. HOWEVER, when responding to a Router Solicitation, or while sending the first few initial unsolicited advertisements, a router SHOULD include all options so that all info (like prefixes) gets propagated quickly during system initialization ๐Ÿš€

if including all options makes an advertisement bigger than the link MTU, multiple advertisements can be sent, each one containing a subset of the options ๐Ÿ’…

6.2.4. Sending Unsolicited Router Advertisements โœจ

Okay bestie, a host MUST NOT send Router Advertisement messages at any time ๐Ÿ™…โ€โ™€๏ธ like, not ever. Hosts are not the ones doing this job!

Unsolicited Router Advertisements are NOT strictly periodic ๐Ÿฆ‹ The gap between sends is randomized so that routers on the same link don't accidentally fall into sync with each other [SYNC]. Each advertising interface has its own timer โฐ Every time a multicast advertisement goes out of an interface, that timer resets to a uniformly-distributed random value between the interface's configured MinRtrAdvInterval and MaxRtrAdvInterval. When the timer expires, the next advertisement gets sent and a brand new random value gets picked. Iconic.

For the first few advertisements (up to MAX_INITIAL_RTR_ADVERTISEMENTS) sent from an interface when it becomes an advertising interface, if the randomly chosen interval is greater than MAX_INITIAL_RTR_ADVERT_INTERVAL, the timer SHOULD be set to MAX_INITIAL_RTR_ADVERT_INTERVAL instead. Using a smaller interval at the start makes it more likely a router gets found quickly when it first shows up, even if some packets get lost ๐Ÿซถ

The info in Router Advertisements can change because of system management ๐ŸŽ€ For example, the lifetime of advertised prefixes might change, new prefixes could get added, or a router could cease to be a router (aka switch from being a router to being a host) ๐Ÿ’€ In those cases, the router MAY transmit up to MAX_INITIAL_RTR_ADVERTISEMENTS unsolicited advertisements, using the same rules as when an interface becomes an advertising interface.

6.2.5. Ceasing To Be An Advertising Interface ๐ŸŒธ

An interface can stop being an advertising interface through system management stuff, such as:

  • changing the AdvSendAdvertisements flag of an enabled interface from TRUE to FALSE, or
  • administratively disabling the interface, or
  • shutting down the system.

In those cases the router SHOULD transmit one or more (but not more than MAX_FINAL_RTR_ADVERTISEMENTS) final multicast Router Advertisements on the interface with a Router Lifetime field of zero ๐Ÿ‘‹ When a router turns into a host, the system SHOULD also leave the all-routers IP multicast group on all interfaces where the router supports IP multicast (whether or not they had been advertising interfaces). Also, the host MUST insure that subsequent Neighbor Advertisement messages sent from the interface have the Router flag set to zero. Main character energy for sure ๐Ÿ’…

Note that system management can disable a router's IP forwarding capability (aka changing the system from being a router to being a host), and that doesn't automatically mean the router's interfaces stop being advertising interfaces ๐Ÿค” In that situation, subsequent Router Advertisements MUST set the Router Lifetime field to zero.

6.2.6. Processing Router Solicitations ๐Ÿงš

A host MUST silently discard any received Router Solicitation messages. Ignore-it-and-move-on energy ๐Ÿ™ˆ

Besides sending the periodic unsolicited ones, a router also sends advertisements in response to valid solicitations received on an advertising interface โœจ A router MAY choose to unicast the response directly to the soliciting host's address (if the solicitation's source address is not the unspecified address), but the usual move is to multicast the response to the all-nodes group. In that second case, the interface's interval timer resets to a new random value, as if an unsolicited advertisement had just gone out (see Section 6.2.4).

In all cases, Router Advertisements sent in response to a Router Solicitation MUST be delayed by a random time between 0 and MAX_RA_DELAY_TIME seconds. (If a single advertisement is sent in response to multiple solicitations, the delay is relative to the first solicitation.) On top of that, consecutive Router Advertisements sent to the all-nodes multicast address MUST be rate limited to no more than one advertisement every MIN_DELAY_BETWEEN_RAS seconds ๐Ÿšฆ

A router might process Router Solicitations like this:

  • Upon receipt of a Router Solicitation, compute a random delay within the range 0 through MAX_RA_DELAY_TIME. If the computed value corresponds to a time later than the time the next multicast Router Advertisement is scheduled to be sent, ignore the random delay and send the advertisement at the already-scheduled time.
  • If the router sent a multicast Router Advertisement (solicited or unsolicited) within the last MIN_DELAY_BETWEEN_RAS seconds, schedule the advertisement to be sent at a time corresponding to MIN_DELAY_BETWEEN_RAS plus the random value after the previous advertisement was sent. This ensures that the multicast Router Advertisements are rate limited.
  • Otherwise, schedule the sending of a Router Advertisement at the time given by the random value.

Note that a router is allowed to send multicast Router Advertisements more often than MinRtrAdvInterval says, as long as the extra ones are responses to Router Solicitations ๐Ÿ’ซ Still though, unsolicited multicast advertisements MUST NOT be sent more frequently than indicated by MinRtrAdvInterval. Rules are rules, periodt ๐Ÿ’…

When a router gets a Router Solicitation and the Source Address is not the unspecified address, it records that the packet's source is a neighbor by creating or updating the Neighbor Cache entry. If the solicitation has a Source Link-Layer Address option, and the router already has a Neighbor Cache entry for that neighbor, the link-layer address SHOULD be updated in the Neighbor Cache. If a Neighbor Cache entry is created for the source, its reachability state MUST be set to STALE as specified in Section 7.3.3. If a cache entry already exists and gets updated with a different link-layer address, the reachability state MUST also be set to STALE. Either way, the entry's IsRouter flag SHOULD be set to false.

If the Source Address is the unspecified address, the router MUST NOT create or update the Neighbor Cache entry ๐Ÿšซ

6.2.7. Router Advertisement Consistency ๐Ÿ‘€

Routers SHOULD inspect valid Router Advertisements sent by other routers and verify that the routers are advertising consistent information on a link. If things don't match, that's a sign one or more routers might be misconfigured, and those inconsistencies SHOULD be logged to system or network management ๐Ÿ•ต๏ธโ€โ™€๏ธ The minimum set of info to check includes:

  • Cur Hop Limit values (except for the unspecified value of zero).
  • Values of the M or O flags.
  • Reachable Time values (except for the unspecified value of zero).
  • Retrans Timer values (except for the unspecified value of zero).
  • Values in the MTU options.
  • Preferred and Valid Lifetimes for the same prefix.

Note that it is not an error for different routers to advertise different sets of prefixes ๐ŸŒˆ Also, some routers might leave some fields as unspecified (aka with the value zero) while other routers specify values. The logging of errors SHOULD be restricted to conflicting information that causes hosts to switch from one value to another with each received advertisement.

Any other action a router takes on receiving Router Advertisement messages is beyond the scope of this document ๐Ÿคทโ€โ™€๏ธ

The link-local address on a router SHOULD change rarely, if ever. Nodes receiving Neighbor Discovery messages use the source address to identify the sender. If multiple packets from the same router contain different source addresses, nodes will assume they come from different routers, which leads to undesirable behavior. For example, a node will ignore Redirect messages that are believed to have been sent by a router other than the current first-hop router. So the source address used in Router Advertisements sent by a particular router must be identical to the target address in a Redirect message when redirecting to that router.

Using the link-local address to uniquely identify routers on the link has the benefit that the address a router is known by should not change when a site renumbers ๐ŸŒธ

If a router changes the link-local address for one of its interfaces, it SHOULD inform hosts of this change. The router SHOULD multicast a few Router Advertisements from the old link-local address with the Router Lifetime field set to zero, and also multicast a few Router Advertisements from the new link-local address. The overall effect should be the same as if one interface stops being an advertising interface and a different one starts being an advertising interface.

6.3. Host Specification ๐Ÿ’–

6.3.1. Host Configuration Variables

None.

6.3.2. Host Variables

A host keeps track of certain Neighbor Discovery related variables on top of the data structures defined in Section 5.1. The specific variable names are only used for demonstration purposes, and an implementation is not required to have them, so long as its external behavior is consistent with what's described in this document ๐Ÿง 

These variables have default values that get overridden by info received in Router Advertisement messages. The default values are used when there is no router on the link, or when all received Router Advertisements have left a particular value unspecified.

The default values in this specification may be overridden by specific documents that describe how IP operates over different link layers. This rule lets Neighbor Discovery work over links with wildly different performance characteristics ๐Ÿš€

For each interface:

  • LinkMTU: The MTU of the link. Default: The valued defined in the specific document that describes how IPv6 operates over the particular link layer (e.g., [IPv6-ETHER]).
  • CurHopLimit: The default hop limit to be used when sending (unicast) IP packets. Default: The value specified in the "Assigned Numbers" RFC [ASSIGNED] that was in effect at the time of implementation.
  • BaseReachableTime: A base value used for computing the random ReachableTime value. Default: REACHABLE_TIME milliseconds.
  • ReachableTime: The time a neighbor is considered reachable after receiving a reachability confirmation. This value should be a uniformly-distributed random value between MIN_RANDOM_FACTOR and MAX_RANDOM_FACTOR times BaseReachableTime milliseconds. A new random value should be calculated when BaseReachableTime changes (due to Router Advertisements) or at least every few hours even if no Router Advertisements are received.
  • RetransTimer: The time between retransmissions of Neighbor Solicitation messages to a neighbor when resolving the address or when probing the reachability of a neighbor. Default: RETRANS_TIMER milliseconds

6.3.3. Interface Initialization ๐ŸŽ‰

The host joins the all-nodes multicast address on all multicast-capable interfaces.

6.3.4. Processing Received Router Advertisements ๐Ÿ’…

okay bestie, when there are multiple routers on the link ๐ŸŒธ, the info they advertise all together might be a superset of what any single Router Advertisement has โœจ. Info can also come from other dynamic stuff, like stateful autoconfiguration ๐Ÿงš. So hosts accept the union of all the received info ๐Ÿซถ. Getting a Router Advertisement MUST NOT wipe out the info from an earlier advertisement or from some other source ๐Ÿ™ˆ. BUT, if the info for a specific parameter (like Link MTU) or option (like Lifetime on a specific Prefix) is different from before, AND that parameter can only have one value, then the most recently-received info is the one that counts ๐Ÿ‘‘.

Some Router Advertisement fields (like Cur Hop Limit, Reachable Time and Retrans Timer) may hold a value that means unspecified ๐Ÿฆ‹. In that case the parameter should be ignored, and the host should keep using whatever value it's already using. Specifically, a host MUST NOT read the unspecified value as "go back to the default value that was in use before the first Router Advertisement was received" ๐Ÿ’€. This is the whole point: it stops hosts from constantly flip-flopping an internal variable just because one router says a specific value while other routers say unspecified ๐Ÿ’œ.

On receipt of a valid Router Advertisement, a host grabs the source address of the packet and does the following ๐ŸŽ€:

  • If the address isn't already in the host's Default Router List, and the advertisement's Router Lifetime is non-zero, make a new entry in the list and set its invalidation timer from the advertisement's Router Lifetime field โœจ.
  • If the address is already in the host's Default Router List because of a previously-received advertisement, reset its invalidation timer to the Router Lifetime value in the newly-received advertisement ๐Ÿ”„.
  • If the address is already in the host's Default Router List and the received Router Lifetime is zero, time the entry out right away, as specified in Section 6.3.5 โฐ.

To limit how much storage the Default Router List needs, a host MAY choose not to store every router address it finds through advertisements ๐Ÿ“. However, a host MUST retain at least two router addresses, and SHOULD retain more ๐Ÿซถ. Default router selections happen whenever communication to a destination looks like it's failing ๐Ÿ˜ญ. So the more routers on the list, the more likely it is that an alternative working router can be found quickly (for example, without waiting for the next advertisement to show up) โญ.

If the received Cur Hop Limit value is non-zero, the host SHOULD set its CurHopLimit variable to the received value ๐Ÿ’–.

If the received Reachable Time value is non-zero, the host SHOULD set its BaseReachableTime variable to the received value. If the new value is different from the previous one, the host SHOULD recompute a new random ReachableTime value. ReachableTime is computed as a uniformly-distributed random value between MIN_RANDOM_FACTOR and MAX_RANDOM_FACTOR times the BaseReachableTime. The random part is what eliminates the possibility that Neighbor Unreachability Detection messages synchronize with each other ๐ŸŒˆ.

In most cases the advertised Reachable Time will be the same across consecutive Router Advertisements, and a host's BaseReachableTime rarely changes ๐Ÿงธ. In those cases, an implementation SHOULD insure that a new random value gets recomputed at least once every few hours โณ.

The RetransTimer variable SHOULD be copied from the Retrans Timer field, as long as the received value is non-zero ๐Ÿ’….

After pulling info out of the fixed part of the Router Advertisement message, the advertisement is scanned for valid options ๐Ÿ”. If it contains a Source Link-Layer Address option, the link-layer address SHOULD be recorded in the Neighbor Cache entry for the router (creating an entry if needed), and the IsRouter flag in that Neighbor Cache entry MUST be set to true ๐ŸŽ€. The IsRouter flag is what Neighbor Unreachability Detection uses to figure out when a router turns into a host (aka, it's no longer able to forward packets) ๐Ÿฅ€. If a Neighbor Cache entry gets created for the router, its reachability state MUST be set to STALE, as specified in Section 7.3.3 ๐ŸŒธ. If a cache entry already exists and gets updated with a different link-layer address, the reachability state MUST also be set to STALE ๐Ÿซถ.

If the MTU option is present, hosts SHOULD copy the option's value into LinkMTU, but only if the value doesn't go over the default LinkMTU value specified in the link type specific document (for example, [IPv6-ETHER]) ๐Ÿ“.

Prefix Information options with the "on-link" (L) flag set are saying "this prefix is a range of addresses that should be treated as on-link" ๐Ÿง . BUT, a Prefix Information option with the on-link flag set to zero tells you NOTHING about on-link determination, and it MUST NOT be read as meaning the addresses covered by that prefix are off-link ๐Ÿ™…โ€โ™€๏ธ. The default behavior (see Section 5.2) when no info is known about an address is to send the packets to a default router, and getting a Prefix Information option with the "on-link " (L) flag set to zero doesn't change that at all ๐Ÿ’…. The reasons an address is treated as on-link are spelled out in the definition of "on-link" in Section 2.1 โœจ. Prefixes with the on-link flag set to zero would normally have the autonomous flag set and get used by [ADDRCONF] ๐Ÿฆ‹.

For each Prefix Information option with the on-link flag set, a host does the following ๐ŸŽ€:

  • If the prefix is the link-local prefix, silently ignore the Prefix Information option ๐Ÿ™ˆ.
  • If the prefix isn't already in the Prefix List, and the Prefix Information option's Valid Lifetime field is non-zero, make a new entry for the prefix and set its invalidation timer to the Valid Lifetime value in the Prefix Information option โœจ.
  • If the prefix is already in the host's Prefix List because of a previously-received advertisement, reset its invalidation timer to the Valid Lifetime value in the Prefix Information option. If the new Lifetime value is zero, time the prefix out immediately (see Section 6.3.5) โฐ.
  • If the Prefix Information option's Valid Lifetime field is zero, and the prefix isn't in the host's Prefix List, silently ignore the option ๐Ÿซง.

Note: implementations can choose to handle the on-link parts of prefixes separately from the address autoconfiguration parts, for example by passing a copy of each valid Router Advertisement message to both an "on-link" function and an "addrconf" function ๐Ÿงš. Each function can then work on its own, using just the prefixes that have the right flag set ๐ŸŒˆ.


6.3.5. Timing out Prefixes and Default Routers โฐ

Whenever the invalidation timer expires for a Prefix List entry, that entry gets discarded ๐Ÿ—‘๏ธ. Existing Destination Cache entries don't need to be updated, though ๐Ÿคทโ€โ™€๏ธ. If a reachability problem comes up with an existing Neighbor Cache entry, Neighbor Unreachability Detection will handle any recovery that's needed ๐Ÿ”ง.

Whenever the Lifetime of an entry in the Default Router List expires, that entry gets discarded too ๐Ÿ‘‹. When a router gets removed from the Default Router List, the node MUST update the Destination Cache so that all entries using that router go through next-hop determination again, instead of continuing to send traffic to the (deleted) router ๐Ÿ˜ญ.

6.3.6. Default Router Selection ๐Ÿ‘‘

The algorithm for picking a router depends partly on whether a router is known to be reachable ๐ŸŽฏ. The exact details of how a node tracks a neighbor's reachability state are covered in Section 7.3 ๐Ÿง . The default router selection algorithm gets invoked during next-hop determination when there's no Destination Cache entry for an off-link destination, or when communication through an existing router looks like it's failing ๐Ÿšจ. Under normal conditions, a router would be picked the first time traffic gets sent to a destination, and later traffic for that destination uses the same router as indicated in the Destination Cache (modulo any changes to the Destination Cache caused by Redirect messages) ๐Ÿ”.

The policy for picking routers from the Default Router List goes like this ๐Ÿ’–:

  1. Routers that are reachable or probably reachable (aka, in any state other than INCOMPLETE) SHOULD be preferred over routers whose reachability is unknown or suspect (aka, in the INCOMPLETE state, or for which no Neighbor Cache entry exists). An implementation may choose to always return the same router, or cycle through the router list in a round-robin fashion, as long as it always returns a reachable or probably reachable router when one is available ๐ŸŒธ.
  2. When none of the routers on the list are known to be reachable or probably reachable, routers SHOULD be selected in a round-robin fashion, so that later requests for a default router don't return the same router until all the other routers have been picked ๐ŸŽก. Cycling through the router list in this case makes sure that all the available routers get actively probed by the Neighbor Unreachability Detection algorithm ๐Ÿ”. A request for a default router is made together with sending a packet to a router, and the selected router gets probed for reachability as a side effect ๐Ÿซถ.
  3. If the Default Router List is empty, assume that all destinations are on-link, as specified in Section 5.2 ๐ŸŒ.

6.3.7. Sending Router Solicitations โœจ

okay so when an interface turns on, a host might be like "nah, I'm not waiting around for the next unsolicited Router Advertisement ๐Ÿ™„" just to find default routers or learn prefixes. so to get Router Advertisements quickly, a host SHOULD transmit up to MAX_RTR_SOLICITATIONS Router Solicitation messages, each one separated by at least RTR_SOLICITATION_INTERVAL seconds. Router Solicitations may be sent after any of these events: ๐Ÿ’œ

  • The interface is initialized at system startup time. ๐ŸŒธ
  • The interface is reinitialized after a temporary interface failure or after being temporarily disabled by system management. ๐Ÿ”Œ
  • The system changes from being a router to being a host, by having its IP forwarding capability turned off by system management. ๐ŸŽ€
  • The host attaches to a link for the first time. ๐Ÿฆ‹
  • The host re-attaches to a link after being detached for some time. ๐Ÿงš

a host sends Router Solicitations to the all-routers multicast address ๐Ÿ“ฃ. the IP source address is set to either one of the interface's unicast addresses or the unspecified address. the Source Link-Layer Address option SHOULD be set to the host's link-layer address, if the IP source address is a unicast address ๐Ÿ’….

before a host sends an initial solicitation, it SHOULD delay the transmission for a random amount of time between 0 and MAX_RTR_SOLICITATION_DELAY โณ. this is literally the anti-congestion move ๐Ÿ™Œ, because when a bunch of hosts start up on a link at the same time (think: recovering from a power failure ๐Ÿ˜ญ), everyone yelling at once would be chaos. if a host has already done a random delay since the interface became (re)enabled (for example, as part of Duplicate Address Detection [ADDRCONF]), there is no need to delay again before sending the first Router Solicitation message โœจ.

once the host sends a Router Solicitation and receives a valid Router Advertisement with a non-zero Router Lifetime, the host MUST desist from sending additional solicitations on that interface, until the next time one of the above events occurs. ๐Ÿ›‘ also, a host SHOULD send at least one solicitation in the case where an advertisement is received before it has sent a solicitation ๐Ÿซถ. unsolicited Router Advertisements may be incomplete (see Section 6.2.3), but solicited advertisements are expected to contain complete information ๐Ÿ’–.

if a host sends MAX_RTR_SOLICITATIONS solicitations and receives no Router Advertisements after waiting MAX_RTR_SOLICITATION_DELAY seconds after sending the last solicitation, the host concludes that there are no routers on the link for the purpose of [ADDRCONF] ๐Ÿฅบ. however, the host keeps receiving and processing Router Advertisements in case routers show up on the link later ๐Ÿ‘€. main character glow-up energy ๐Ÿ‘‘.


7. ADDRESS RESOLUTION AND NEIGHBOR UNREACHABILITY DETECTION ๐ŸŒˆ

okay this section is where the Neighbor Solicitation and Neighbor Advertisement messages get their moment โœจ. it covers the functions tied to those messages, including address resolution and the Neighbor Unreachability Detection algorithm ๐Ÿ”.

these messages are also used for Duplicate Address Detection, as specified in [ADDRCONF] ๐Ÿง. specifically, Duplicate Address Detection sends Neighbor Solicitation messages with an unspecified source address, targeting its own "tentative" address. nodes already using that address respond to those messages with a multicast Neighbor Advertisement saying the address is in use ๐Ÿšจ. it's giving "that's MY address, back off" energy ๐Ÿ’….

7.1. Message Validation ๐ŸŽ€

7.1.1. Validation of Neighbor Solicitations ๐Ÿ’œ

a node MUST silently discard any received Neighbor Solicitation message that does not pass all of these validity checks:

  • The IP Hop Limit field has a value of 255, i.e., the packet could not possibly have been forwarded by a router. ๐Ÿ›ก๏ธ
  • If the message includes an IP Authentication Header, the message authenticates correctly. ๐Ÿ”
  • ICMP Checksum is valid. โœ…
  • ICMP Code is 0. 0๏ธโƒฃ
  • ICMP length (derived from the IP length) is 24 or more octets. ๐Ÿ“
  • Target Address is not a multicast address. ๐Ÿšซ
  • All included options have a length that is greater than zero. ๐Ÿ“

the contents of the Reserved field, and of any unrecognized options, MUST be ignored ๐Ÿ™ˆ. future, backward-compatible changes to the protocol may specify the contents of the Reserved field or add new options, while backward-incompatible changes may use different Code values ๐Ÿ”ฎ.

the contents of any defined options that are not specified to be used with Neighbor Solicitation messages MUST be ignored, and the packet is processed as normal ๐Ÿซ . the only defined option that may appear is the Source Link-Layer Address option ๐ŸŽฏ.

a Neighbor Solicitation that passes the validity checks is called a "valid solicitation" ๐Ÿ†.

7.1.2. Validation of Neighbor Advertisements ๐Ÿฆ‹

a node MUST silently discard any received Neighbor Advertisement message that does not pass all of these validity checks:

  • The IP Hop Limit field has a value of 255, i.e., the packet could not possibly have been forwarded by a router. ๐Ÿ›ก๏ธ
  • If the message includes an IP Authentication Header, the message authenticates correctly. ๐Ÿ”
  • ICMP Checksum is valid. โœ…
  • ICMP Code is 0. 0๏ธโƒฃ
  • ICMP length (derived from the IP length) is 24 or more octets. ๐Ÿ“
  • Target Address is not a multicast address. ๐Ÿšซ
  • If the IP Destination Address is a multicast address, the Solicited flag is zero. ๐Ÿšฉ
  • All included options have a length that is greater than zero. ๐Ÿ“

the contents of the Reserved field, and of any unrecognized options, MUST be ignored ๐Ÿ™ˆ. future, backward-compatible changes may specify the contents of the Reserved field or add new options, while backward-incompatible changes may use different Code values ๐Ÿ”ฎ.

the contents of any defined options that are not specified to be used with Neighbor Advertisement messages MUST be ignored, and the packet is processed as normal ๐Ÿซ . the only defined option that may appear is the Target Link-Layer Address option ๐ŸŽฏ.

a Neighbor Advertisement that passes the validity checks is called a "valid advertisement" ๐Ÿ†.

7.2. Address Resolution ๐ŸŒธ

address resolution is the process where a node figures out the link-layer address of a neighbor, given only its IP address ๐Ÿ•ต๏ธโ€โ™€๏ธ. it only happens for addresses that are determined to be on-link, and for which the sender doesn't know the matching link-layer address. address resolution is never performed on multicast addresses ๐Ÿ™…โ€โ™€๏ธ.

7.2.1. Interface Initialization โœจ

when a multicast-capable interface becomes enabled, the node MUST join the all-nodes multicast address on that interface, as well as the solicited-node multicast address that corresponds to each of the IP addresses assigned to the interface ๐ŸŒ.

the set of addresses assigned to an interface can change over time. new addresses might be added and old ones might be removed [ADDRCONF] ๐Ÿ”„. in those cases, the node MUST join and leave the solicited-node multicast address corresponding to the new and old addresses, respectively ๐Ÿšช. note that multiple unicast addresses may map into the same solicited-node multicast address, so a node MUST NOT leave the solicited-node multicast group until all assigned addresses that correspond to that multicast address have been removed ๐Ÿฅน.

7.2.2. Sending Neighbor Solicitations ๐Ÿ“ฃ

when a node has a unicast packet to send to a neighbor but doesn't know the neighbor's link-layer address, it performs address resolution ๐Ÿ”Ž. for multicast-capable interfaces, this means creating a Neighbor Cache entry in the INCOMPLETE state and transmitting a Neighbor Solicitation message aimed at the neighbor ๐ŸŽฏ. the solicitation is sent to the solicited-node multicast address that corresponds to the target address ๐Ÿ’Œ.

if the source address of the packet prompting the solicitation is the same as one of the addresses assigned to the outgoing interface, that address SHOULD be placed in the IP Source Address of the outgoing solicitation ๐Ÿชช. otherwise, any one of the addresses assigned to the interface should be used. using the prompting packet's source address when possible ensures that the recipient of the Neighbor Solicitation puts the IP address into its Neighbor Cache that is highly likely to be used in later return traffic for that packet's "connection" ๐Ÿ’ซ. it's a whole vibe of consistency ๐Ÿงต.

if the solicitation is being sent to a solicited-node multicast address, the sender MUST include its link-layer address (if it has one) as a Source Link-Layer Address option ๐Ÿ“ฌ. otherwise, the sender SHOULD include its link-layer address (if it has one) as a Source Link-Layer Address option. including the source link-layer address in a multicast solicitation is required, so the target has an address it can send the Neighbor Advertisement to ๐Ÿ™Œ.

while waiting for address resolution to complete, the sender MUST, for each neighbor, keep a small queue of packets waiting on address resolution ๐Ÿ—‚๏ธ. the queue MUST hold at least one packet, and MAY contain more ๐Ÿฌ. however, the number of queued packets per neighbor SHOULD be limited to some small value ๐Ÿค. when a queue overflows, the new arrival SHOULD replace the oldest entry ๐Ÿ”. once address resolution completes, the node transmits any queued packets ๐Ÿš€.

while awaiting a response, the sender SHOULD retransmit Neighbor Solicitation messages approximately every RetransTimer milliseconds, even when there's no other traffic to the neighbor ๐Ÿ”. retransmissions MUST be rate-limited to at most one solicitation per neighbor every RetransTimer milliseconds โฑ๏ธ.

โš ๏ธ if no Neighbor Advertisement is received after MAX_MULTICAST_SOLICIT solicitations, address resolution has failed. the sender MUST return ICMP destination unreachable indications with code 3 (Address Unreachable) for each packet queued awaiting address resolution ๐Ÿ’€.

7.2.3. Receipt of Neighbor Solicitations ๐Ÿซถ

a valid Neighbor Solicitation where the Target Address is not a unicast or anycast address assigned to the receiving interface, and the Target Address is not a "tentative" address on which Duplicate Address Detection is being performed [ADDRCONF], MUST be silently ignored ๐Ÿ™ˆ. if the Target Address is tentative, the Neighbor Solicitation should be processed as described in [ADDRCONF] ๐Ÿงฉ.

when a valid Neighbor Solicitation targeted at the node arrives, the recipient SHOULD update the Neighbor Cache entry for the IP Source Address of the solicitation, as long as the Source Address is not the unspecified address ๐Ÿ“. if no entry exists yet, the node SHOULD create a new one and set its reachability state to STALE, as specified in Section 7.3.3 ๐Ÿ†•. if a cache entry already exists and gets updated with a different link-layer address, its reachability state MUST be set to STALE ๐Ÿ•ฐ๏ธ. if the solicitation contains a Source Link-Layer Address option, the entry's cached link-layer address should be replaced with the one in the solicitation ๐Ÿ”„.

if the Source Address is the unspecified address, the node MUST NOT create or update the Neighbor Cache entry ๐Ÿšซ. no sneaky entries allowed ๐Ÿ™…โ€โ™€๏ธ.

after any updates to the Neighbor Cache, the node sends a Neighbor Advertisement response as described in the next section ๐Ÿ“จ๐Ÿฆ‹

7.2.4. Sending Solicited Neighbor Advertisements ๐Ÿ’–

okay so a node sends a Neighbor Advertisement in response to a valid Neighbor Solicitation that's targeting one of its assigned addresses ๐ŸŽ€ The Target Address of the advertisement gets copied over from the Target Address of the solicitation.

Now, if the solicitation's IP Destination Address is a unicast or anycast address, the Target Link-Layer Address option SHOULD NOT be included ๐Ÿ™ˆ bestie, that's because the neighbor's cached value already has to be current for the solicitation to have been received at all. If the solicitation's IP Destination Address is a solicited-node multicast address, the Target Link-Layer option MUST be included in the advertisement. And if the node is a router, it MUST set the Router flag to one. Otherwise it MUST set that flag to zero. Simple, but so important โœจ

If the Target Address is either an anycast address or a unicast address the node is proxying for, or if the Target Link-Layer Address option isn't in the outgoing advertisement, the Override flag SHOULD be set to zero. Otherwise, it SHOULD be set to one. Setting the Override flag properly makes sure nodes prefer non-proxy advertisements, even when those show up after proxy ones ๐Ÿ‘‘ But the first advertisement for an anycast address "wins" ๐Ÿ’…

If the source of the solicitation is the unspecified address, the node MUST set the Solicited flag to zero and multicast the advertisement to the all-nodes address. Otherwise, the node MUST set the Solicited flag to one and unicast the advertisement to the Source Address of the solicitation. Main character energy in the routing world ๐Ÿฆ‹

If the Target Address is an anycast address, the sender SHOULD delay sending a response for a random time between 0 and MAX_ANYCAST_DELAY_TIME seconds. ๐Ÿงš


7.2.5. Receipt of Neighbor Advertisements ๐ŸŒธ

okay so when a valid Neighbor Advertisement comes in (solicited or unsolicited, doesn't matter), the Neighbor Cache gets searched for the target's entry. If there's no entry, the advertisement SHOULD be silently discarded. We don't need to make one, though, since the recipient clearly hasn't started any chat with the target ๐Ÿ™ˆ

Once the right Neighbor Cache entry is found, what happens next depends on that entry's state and the flags in the advertisement. If the entry is in an INCOMPLETE state (meaning no link-layer address is cached for the target), the advertisement updates the entry. If a cached link-layer address is already there, though, a node might choose to ignore the advertisement and keep using the cached one. It's giving "I'll decide what I trust" ๐Ÿ’…

If the target's entry is in the INCOMPLETE state, the receiving node records the link-layer address in the Neighbor Cache entry and sends any packets that were queued for that neighbor waiting on address resolution โœจ If the Solicited flag is set, the reachability state for the neighbor MUST be set to REACHABLE. Otherwise it MUST be set to STALE. (A more detailed explanation of reachability state is described in Section 7.3.3.) The Override flag gets ignored when the entry is INCOMPLETE, so don't stress about it there ๐Ÿซถ

If the target's entry is in any state other than INCOMPLETE when the advertisement arrives, the Override flag's setting decides whether the Target Link-Layer Address option (if it's there) replaces the cached address. If the Override flag is set, the receiving node MUST install the link-layer address in its cache. If the flag is zero, the receiving node MUST NOT install the link-layer address in its cache. The advertisement's sender sets the Override flag when it wants its Target Link-Layer Address option to replace the cached value in Neighbor Cache entries, no matter what's in them right now ๐Ÿ‘‘

Also, if the target's entry is in any state other than INCOMPLETE when the advertisement comes in, the Solicited flag setting decides the entry's new state. If the Solicited flag is set, the entry's state MUST be set to REACHABLE. If the flag is zero, the entry's state MUST be set to STALE. The Solicited flag should only be set if the advertisement is a response to a Neighbor Solicitation. Because Neighbor Unreachability Solicitations go to the cached link-layer address, a solicited advertisement tells you the forward path is working ๐Ÿฆ‹ An unsolicited advertisement, on the other hand, suggests a neighbor has urgent news to share, like a changed link-layer address ๐Ÿšจ

Regardless of whether the new link-layer address actually gets installed in the cache, a node should verify the reachability of the path it's currently using when it sends the next packet. That way it quickly finds a working path if the existing one has failed. This is exactly the case when an unsolicited Neighbor Advertisement announces a link-layer address change ๐Ÿ˜ญ

In the cases where the cached link-layer address gets updated, the receiving node MUST examine the Router flag in the received advertisement and update the IsRouter flag in the Neighbor Cache entry, so it reflects whether the node is a host or a router. And if the neighbor used to be a router but the advertisement's Router flag is now zero, the node MUST remove that router from the Default Router List. It also has to update the Destination Cache entries for every destination using that neighbor as a router, as specified in Section 7.3.3. Big tea, big responsibility ๐Ÿ’€


7.2.6. Sending Unsolicited Neighbor Advertisements ๐Ÿงš

okay so sometimes a node can tell its link-layer address has changed, like when an interface card gets hot-swapped, and it may want to let its neighbors know the new address fast ๐Ÿš€ In that case a node MAY send up to MAX_NEIGHBOR_ADVERTISEMENT unsolicited Neighbor Advertisement messages to the all-nodes multicast address. These advertisements MUST be separated by at least RetransTimer seconds โฐ

The Target Address field in the unsolicited advertisement is set to an IP address of the interface, and the Target Link-Layer Address option gets filled with the new link-layer address ๐ŸŽ€ The Solicited flag MUST be set to zero, so the Neighbor Unreachability Detection algorithm doesn't get confused ๐Ÿ™ˆ If the node is a router, it MUST set the Router flag to one. Otherwise it MUST set it to zero. The Override flag MAY be set to either zero or one.

Either way, neighboring nodes will immediately flip their Neighbor Cache entries for the Target Address to STALE, which makes them verify the path for reachability ๐Ÿ”ฅ If the Override flag is set to one, those neighbors install the new link-layer address in their caches. Otherwise they ignore the new address and go back to probing the cached one ๐Ÿซถ

A node with multiple IP addresses assigned to one interface MAY multicast a separate Neighbor Advertisement for each address. In that case the node SHOULD introduce a small delay between each advertisement, so there's less chance they get lost to congestion ๐ŸŒˆ

A proxy MAY multicast Neighbor Advertisements when its link-layer address changes, or when it's configured (by system management or other mechanisms) to proxy for an address. If multiple nodes are proxying for the same set of addresses, the proxies SHOULD provide a mechanism that stops more than one of them from multicasting advertisements for any one address. That keeps the excessive multicast traffic risk down ๐Ÿ’–

Also, a node belonging to an anycast address MAY multicast unsolicited Neighbor Advertisements for that anycast address when the node's link-layer address changes โœจ

Note that unsolicited Neighbor Advertisements don't reliably update caches in every node, because some advertisements might never be received by all nodes ๐Ÿ˜ญ So they should only be viewed as a performance optimization that quickly updates the caches in most neighbors. The Neighbor Unreachability Detection algorithm is what makes sure all nodes end up with a reachable link-layer address. The delay may just be slightly longer ๐Ÿข


7.2.7. Anycast Neighbor Advertisements ๐Ÿฆ‹

From the Neighbor Discovery point of view, anycast addresses get treated just like unicast addresses in most cases ๐Ÿ’… An anycast address is syntactically the same as a unicast address, so nodes doing address resolution or Neighbor Unreachability Detection on one treat it as if it were unicast. No special processing happens.

Nodes that have an anycast address assigned to an interface treat it exactly the same as a unicast address, with two exceptions ๐Ÿ‘‘ First, Neighbor Advertisements sent in response to a Neighbor Solicitation SHOULD be delayed by a random time between 0 and MAX_ANYCAST_DELAY_TIME to reduce the chance of network congestion. Second, the Override flag in Neighbor Advertisements SHOULD be set to 0. That way, when multiple advertisements arrive, the first received one gets used instead of the most recent one. "First one wins" era โœจ

Just like with unicast addresses, Neighbor Unreachability Detection makes sure a node quickly notices when the current binding for an anycast address stops being valid ๐Ÿ™Œ


7.2.8. Proxy Neighbor Advertisements ๐ŸŒธ

Under limited circumstances, a router MAY proxy for one or more other nodes. Basically, through Neighbor Advertisements it says it's willing to accept packets not explicitly addressed to itself ๐ŸŽ€ For example, a router might accept packets on behalf of a mobile node that has moved off-link. The mechanisms used for proxying are identical to the mechanisms used with anycast addresses, so if you get anycast you already get proxies ๐Ÿงš

A proxy MUST join the solicited-node multicast address(es) that correspond to the IP address(es) assigned to the node it's proxying for ๐Ÿ’œ

All solicited proxy Neighbor Advertisement messages MUST have the Override flag set to zero. This makes sure that if the node itself is on the link, its own Neighbor Advertisement (with the Override flag set to one) takes precedence over any advertisement received from a proxy ๐Ÿ‘‘ A proxy MAY send unsolicited advertisements with the Override flag set to one, as specified in Section 7.2.6. But doing that may cause the proxy advertisement to override a valid entry the node itself created ๐Ÿ™ˆ

Finally, when a proxy sends an advertisement in response to a Neighbor Solicitation, the sender should delay its response by a random time between 0 and MAX_ANYCAST_DELAY_TIME seconds ๐Ÿ’–

7.3. Neighbor Unreachability Detection ๐Ÿ’”โœจ

okay so communication to or through a neighbor can fail for literally so many reasons at any time ๐Ÿ˜ญ like hardware failing, or someone hot-swapping an interface card ๐Ÿ™ˆ If the destination itself has died, bestie, there's no recovery and the communication just fails ๐Ÿ’€ But if it's the path that broke, recovery might be possible ๐Ÿฆ‹ So a node actively keeps track of the reachability "state" for each neighbor it sends packets to. main character energy of paying attention ๐Ÿ’…

Neighbor Unreachability Detection is used for all paths between hosts and neighboring nodes: host-to-host, host-to-router, and router-to-host, all of it ๐ŸŒˆ It can also be used between routers, but it's not required if an equivalent mechanism is available, like one that's part of the routing protocols ๐Ÿงš

When a path to a neighbor starts looking sus, the recovery depends on what that neighbor is being used for. If the neighbor is the ultimate destination, address resolution needs to happen again ๐Ÿ” If the neighbor is a router, though, switching to another router is the move ๐Ÿ”ฅ The specific recovery is covered under next-hop determination. Neighbor Unreachability Detection signals that next-hop determination is needed by deleting a Neighbor Cache entry ๐Ÿ—‘๏ธ

Neighbor Unreachability Detection is performed only for neighbors that unicast packets are sent to. It's not used when sending to multicast addresses ๐Ÿ™…

7.3.1. Reachability Confirmation ๐Ÿซถ

A neighbor counts as reachable if the node recently got confirmation that packets it sent to that neighbor were received by its IP layer โœ… There are two ways to get positive confirmation: hints from upper layer protocols saying a connection is making "forward progress", or receiving a Neighbor Advertisement that answers a Neighbor Solicitation ๐Ÿ’Œ

A connection makes "forward progress" when the packets arriving from a remote peer can only be arriving because recent packets sent to that peer actually reached it ๐Ÿคฏ In TCP, for example, getting a (new) acknowledgement means the data sent earlier reached the peer. Likewise, new (non-duplicate) data arriving means earlier acknowledgements got delivered to the remote peer ๐ŸŽ€ If packets are reaching the peer, they're also getting to the sender's next-hop neighbor, so "forward progress" is a confirmation that the next-hop neighbor is reachable. For off-link destinations, forward progress implies that the first-hop router is reachable ๐Ÿ›ฃ๏ธ When this upper-layer information is available, it SHOULD be used ๐Ÿ“ฃ

In some cases, like UDP-based protocols and routers forwarding packets to hosts, that reachability info might not be readily available from upper-layer protocols ๐Ÿฅฒ When there are no hints and a node is sending packets to a neighbor, the node actively probes the neighbor using unicast Neighbor Solicitation messages to check that the forward path is still working ๐Ÿ”

Getting a solicited Neighbor Advertisement serves as reachability confirmation, because advertisements with the Solicited flag set to one are only sent in response to a Neighbor Solicitation ๐Ÿ’… Getting other Neighbor Discovery messages, like Router Advertisements or Neighbor Advertisements with the Solicited flag set to zero, MUST NOT be treated as a reachability confirmation ๐Ÿšซ Unsolicited messages only confirm the one-way path from the sender to the recipient node ๐Ÿ™ƒ Neighbor Unreachability Detection, on the other hand, needs a node to track the reachability of the forward path to a neighbor from its own perspective, not the neighbor's ๐Ÿชž Note that receiving a solicited advertisement means the path works in both directions, since the solicitation had to reach the neighbor to prompt it to reply. Likewise, receiving an advertisement shows the path from sender to recipient is working. But that last part is only known to the recipient. The advertisement's sender has no direct way of knowing that its advertisement actually reached a neighbor ๐Ÿ“ญ From the perspective of Neighbor Unreachability Detection, only the reachability of the forward path is of interest โœจ

7.3.2. Neighbor Cache Entry States ๐Ÿง

A Neighbor Cache entry can be in one of five states:

  • INCOMPLETE ๐Ÿฃ Address resolution is happening on the entry. Specifically, a Neighbor Solicitation has been sent to the solicited-node multicast address of the target, but the matching Neighbor Advertisement hasn't come back yet.
  • REACHABLE ๐Ÿ’š Positive confirmation came in within the last ReachableTime milliseconds that the forward path to the neighbor was functioning properly. While REACHABLE, nothing special happens as packets are sent.
  • STALE ๐Ÿฅ€ More than ReachableTime milliseconds have passed since the last positive confirmation that the forward path was functioning properly. While stale, nothing happens until a packet is sent.
    • The STALE state gets entered when an unsolicited Neighbor Discovery message updates the cached link-layer address. Receiving that message doesn't confirm reachability, but entering STALE makes sure reachability gets verified quickly if the entry is actually used. Reachability still isn't actually verified until the entry is used โณ
  • DELAY ๐Ÿ˜ด More than ReachableTime milliseconds have passed since the last positive confirmation that the forward path was functioning properly, and a packet was sent within the last DELAY_FIRST_PROBE_TIME seconds. If no reachability confirmation comes in within DELAY_FIRST_PROBE_TIME seconds of entering the DELAY state, send a Neighbor Solicitation and change the state to PROBE.
    • DELAY is an optimization that gives upper-layer protocols extra time to provide reachability confirmation, in cases where ReachableTime milliseconds have passed since the last confirmation only because of a lack of recent traffic. Without this optimization, opening a TCP connection after a traffic lull would kick off probes, even though the subsequent three-way handshake would provide a reachability confirmation almost immediately ๐Ÿค
  • PROBE ๐Ÿ”Ž A reachability confirmation is actively sought by retransmitting Neighbor Solicitations every RetransTimer milliseconds until a reachability confirmation is received. this is the detective era, bestie ๐ŸŒˆ

7.3.3. Node Behavior ๐ŸŽ€

Okay so Neighbor Unreachability Detection runs in parallel with sending packets, no cap ๐Ÿ’… While it's rechecking a neighbor's reachability, the node keeps sending packets to that neighbor using the link-layer address it already cached. And if nobody's sending traffic to a neighbor, no probes go out. Lowkey so efficient ๐Ÿฆ‹

When a node needs address resolution for a neighboring address, it makes an entry in the INCOMPLETE state and kicks off address resolution like Section 7.2 says. If address resolution fails, the entry SHOULD be deleted, so the next traffic to that neighbor runs next-hop determination again. Doing that again is what makes sure alternate default routers get tried too ๐Ÿ”

When a reachability confirmation shows up (either through upper-layer advice or a solicited Neighbor Advertisement), the entry's state flips to REACHABLE โœจ The one exception is upper-layer advice, which does nothing to entries in the INCOMPLETE state (the ones with no link-layer address cached, so it's giving nothing to work with ๐Ÿ™ˆ).

Once ReachableTime milliseconds have passed since the last reachability confirmation for a neighbor, the Neighbor Cache entry goes from REACHABLE to STALE โฐ

Note: An implementation may actually wait to switch from REACHABLE to STALE until a packet gets sent to the neighbor. So there doesn't have to be an explicit timeout event when ReachableTime runs out. Galaxy brain move ๐Ÿง 

The first time a node sends a packet to a neighbor whose entry is STALE, the sender switches it to DELAY and starts a timer for DELAY_FIRST_PROBE_TIME seconds. If the entry is still DELAY when that timer goes off, it becomes PROBE. If a reachability confirmation comes in, it goes to REACHABLE ๐Ÿซถ

When a node enters PROBE, it sends a unicast Neighbor Solicitation to the neighbor using the cached link-layer address. While it's in PROBE, the node resends Neighbor Solicitation messages every RetransTimer milliseconds until a reachability confirmation is obtained. Probes keep getting resent even if no other packets are going to that neighbor, because it's not giving up that easy ๐Ÿ’ช If nothing comes back after waiting RetransTimer milliseconds following the MAX_UNICAST_SOLICIT solicitations, the retransmissions stop and the entry SHOULD be deleted. Any traffic to that neighbor later will recreate the entry and do address resolution again ๐ŸŒธ

Also, all Neighbor Solicitations are rate-limited on a per-neighbor basis, so chill ๐ŸงŠ A node MUST NOT send Neighbor Solicitations to the same neighbor more often than once every RetransTimer milliseconds.

A Neighbor Cache entry goes into STALE when it's created from receiving packets other than solicited Neighbor Advertisements (so Router Solicitations, Router Advertisements, Redirects, and Neighbor Solicitations). These packets carry the link-layer address of either the sender or, in the case of Redirect, the redirection target. BUT getting those addresses does NOT confirm that the forward-direction path to that node actually works ๐Ÿ˜ญ Putting a brand-new entry with a known link-layer address in STALE means path failures get caught quickly, which is so smart ๐Ÿง โœจ Also, if a cached link-layer address gets modified because one of those messages showed up, the state SHOULD also be set to STALE, so the new path gets verified promptly.

To catch the case where a router turns into a host (say its IP forwarding gets switched off by system management), a node MUST compare the Router flag in every received Neighbor Advertisement message with the IsRouter flag recorded in the Neighbor Cache entry. When a node sees that a neighbor changed from being a router to being a host, the node MUST remove that router from the Default Router List and update the Destination Cache as described in Section 6.3.5. Note that a router might not be on the Default Router List even though a Destination Cache entry is using it (like if a host got redirected to it ๐Ÿ‘€). In those cases, every Destination Cache entry that references the (former) router has to perform next-hop determination again before it's used.

Sometimes link-specific information says a path to a neighbor failed (like when a virtual circuit gets reset). In that case, the link-specific info can be used to purge Neighbor Cache entries before Neighbor Unreachability Detection would get around to it. However, link-specific information MUST NOT be used to confirm the reachability of a neighbor, because it doesn't provide end-to-end confirmation between neighboring IP layers. Not the vibe ๐Ÿšซ


8. REDIRECT FUNCTION ๐Ÿฆ‹

This section covers the functions for sending and processing Redirect messages ๐Ÿ’Œ

Routers send Redirect messages to steer a host toward a better first-hop router for a specific destination, or to tell hosts that a destination is actually a neighbor (on-link). The second one happens when the ICMP Target Address is equal to the ICMP Destination Address ๐Ÿงญ

A router MUST be able to figure out the link-local address for each of its neighboring routers, so the target address in a Redirect message identifies the neighbor router by its link-local address. With static routing, this means the next-hop router's address should be specified using that router's link-local address. With dynamic routing, all IPv6 routing protocols have to somehow exchange the link-local addresses of neighboring routers ๐Ÿค

8.1. Validation of Redirect Messages

A host MUST silently discard any received Redirect message that doesn't pass all of the following validity checks:

  • IP Source Address is a link-local address. Routers have to use their link-local address as the source for Router Advertisement and Redirect messages so hosts can uniquely identify routers.
  • The IP Hop Limit field has a value of 255, i.e., the packet could not possibly have been forwarded by a router.
  • If the message includes an IP Authentication Header, the message authenticates correctly.
  • ICMP Checksum is valid.
  • ICMP Code is 0.
  • ICMP length (derived from the IP length) is 40 or more octets.
  • The IP source address of the Redirect is the same as the current first-hop router for the specified ICMP Destination Address.
  • The ICMP Destination Address field in the redirect message does not contain a multicast address.
  • The ICMP Target Address is either a link-local address (when redirected to a router) or the same as the ICMP Destination Address (when redirected to the on-link destination).
  • All included options have a length that is greater than zero.

The contents of the Reserved field, and of any unrecognized options, MUST be ignored ๐Ÿ™ˆ Future, backward-compatible changes to the protocol may specify the contents of the Reserved field or add new options. Backward-incompatible changes may use different Code values instead, so no drama ๐ŸŽ€

The contents of any defined options that aren't specified to be used with Redirect messages MUST be ignored, and the packet gets processed as normal. The only defined options that may appear are the Target Link-Layer Address option and the Redirected Header option โœจ

A host MUST NOT consider a redirect invalid just because the Target Address isn't covered under one of the link's prefixes. Part of the whole semantics of the Redirect message is that the Target Address is on-link, so that's literally the point ๐Ÿ’…

A redirect that passes the validity checks is called a "valid redirect" ๐Ÿ‘‘

8.2. Router Specification

A router SHOULD send a redirect message, subject to rate limiting, whenever it forwards a packet that is not explicitly addressed to itself (i.e., a packet that is not source routed through the router) in which:

  • the Source Address field of the packet identifies a neighbor, and
  • the router determines that a better first-hop node resides on the same link as the sending node for the Destination Address of the packet being forwarded, and
  • the Destination Address of the packet is not a multicast address, and

The transmitted redirect packet contains, consistent with the message format given in Section 4.5:

  • In the Target Address field: the address to which subsequent packets for the destination SHOULD be sent. If the target is a router, that router's link-local address MUST be used. If the target is a host, the Target Address field MUST be set to the same value as the Destination Address field ๐ŸŽฏ
  • In the Destination Address field: the destination address of the invoking IP packet.
  • In the options:
    • Target Link-Layer Address option: link-layer address of the target, if known.
    • Redirected Header: as much of the forwarded packet as can fit without the redirect packet exceeding 576 octets in size.

A router MUST limit the rate at which Redirect messages are sent, so the bandwidth and processing costs from Redirect messages stay under control. This matters when the source doesn't respond correctly to the Redirects, or when the source chooses to ignore unauthenticated Redirect messages. More details on rate-limiting ICMP error messages can be found in [ICMPv6] ๐Ÿšฆ

A router MUST NOT update its routing tables upon receipt of a Redirect. Routers keep their own tables, bestie, no sneaky edits ๐Ÿ™…โ€โ™€๏ธ

8.3. Host Specification

A host receiving a valid redirect SHOULD update its Destination Cache accordingly, so subsequent traffic goes to the specified target. If no Destination Cache entry exists for the destination, an implementation SHOULD create such an entry ๐ŸŒˆ

If the redirect contains a Target Link-Layer Address option, the host either creates or updates the Neighbor Cache entry for the target. In both cases, the cached link-layer address is copied from the Target Link-Layer Address option. If a Neighbor Cache entry is created for the target, its reachability state MUST be set to STALE, as specified in Section 7.3.3. If a cache entry already existed and it gets updated with a different link-layer address, its reachability state MUST also be set to STALE ๐Ÿ”„

In addition, if the Target Address is the same as the Destination Address, the host MUST treat the destination as on-link and set the IsRouter field in the corresponding Neighbor Cache entry to FALSE. Otherwise, it MUST set IsRouter to true ๐Ÿงš

Redirect messages apply to all flows that are being sent to a given destination. That means that upon receipt of a Redirect for a Destination Address, all Destination Cache entries to that address should be updated to use the specified next-hop, regardless of the contents of the Flow Label field that appears in the Redirected Header option ๐Ÿฆ‹

A host MAY have a configuration switch that can be set to make it ignore a Redirect message that does not have an IP Authentication header ๐Ÿ”

A host MUST NOT send Redirect messages. Receiving only, never sending, that's the rule ๐Ÿ’–

9. EXTENSIBILITY - OPTION PROCESSING โœจ

okay so options are the way we pack in variable length fields ๐ŸŽ€, fields that can show up more than once in the same packet ๐Ÿ’…, or info that doesn't need to be in every packet. they can also add new features to future versions of ND ๐Ÿฆ‹.

so future extensions can coexist with current implementations, all nodes MUST silently ignore any options they don't recognize in received ND packets and keep processing the packet ๐Ÿซถ. every option specified in this document MUST be recognized. and bestie, a node MUST NOT ignore valid options just because the ND message also has unrecognized ones ๐Ÿ˜ญ.

the current options are built so receivers can process multiple options in the same packet independently of each other โœจ. to keep that energy, future options SHOULD follow this simple rule:

The option MUST NOT depend on the presence or absence of any other options. The semantics of an option should depend only on the information in the fixed part of the ND packet and on the information contained in the option itself.

following that rule is iconic because:

  1. Receivers can process options independently of one another. For example, an implementation can choose to process the Prefix Information option contained in a Router Advertisement message in a user-space process while the link-layer address option in the same message is processed by routines in the kernel.
  2. Should the number of options cause a packet to exceed a link's MTU, multiple packets can carry subsets of the options without any change in semantics.
  3. Senders MAY send a subset of options in different packets. for instance, if a prefix's Valid and Preferred Lifetime are high enough, it might not be necessary to include the Prefix Information option in every Router Advertisement. different routers might also send different sets of options ๐Ÿ“. so a receiver MUST NOT associate any action with the absence of an option in a particular packet. this protocol says receivers should only act on the expiration of timers and on the information that is received in the packets โฐ.

options in Neighbor Discovery packets can show up in any order, so receivers MUST be prepared to process them independently of their order ๐Ÿ”€. there can also be multiple instances of the same option in a message (e.g., Prefix Information options) ๐ŸŒธ.

if the number of included options in a Router Advertisement makes the advertisement's size go over the link MTU, the router can send multiple separate advertisements, each containing a subset of the options ๐Ÿ“ฆ.

the amount of data included in the Redirected Header option MUST be limited so that the entire redirect packet does not exceed 576 octets ๐Ÿ™ˆ.

all options are a multiple of 8 octets long, which keeps alignment on point without any "pad" options ๐Ÿ’–. the fields in the options (and the fields in ND packets) are defined to align on their natural boundaries (for example, a 16-bit field is aligned on a 16-bit boundary), with one exception: the 128-bit IP addresses/prefixes are aligned on a 64-bit boundary. the link-layer address field holds an uninterpreted octet string, so it is aligned on an 8-bit boundary โœจ.

the size of an ND packet, IP header included, is limited to the link MTU (which is at least 576 octets). when adding options to an ND packet, a node MUST NOT exceed the link MTU ๐Ÿ’….

future versions of this protocol may define new option types. receivers MUST silently ignore any options they do not recognize and continue processing the message ๐Ÿฆ‹.


10. PROTOCOL CONSTANTS ๐ŸŽ€

here are the constants, all lined up and ready to go ๐Ÿงš:

Router constants:

         MAX_INITIAL_RTR_ADVERT_INTERVAL  16 seconds

         MAX_INITIAL_RTR_ADVERTISEMENTS    3 transmissions

         MAX_FINAL_RTR_ADVERTISEMENTS      3 transmissions

         MIN_DELAY_BETWEEN_RAS             3 seconds

         MAX_RA_DELAY_TIME                 .5 seconds

Host constants:

         MAX_RTR_SOLICITATION_DELAY        1 second

         RTR_SOLICITATION_INTERVAL         4 seconds

         MAX_RTR_SOLICITATIONS             3 transmissions

Node constants:

         MAX_MULTICAST_SOLICIT             3 transmissions

         MAX_UNICAST_SOLICIT               3 transmissions

         MAX_ANYCAST_DELAY_TIME            1 second

         MAX_NEIGHBOR_ADVERTISEMENT        3 transmissions

         REACHABLE_TIME               30,000 milliseconds

         RETRANS_TIMER                 1,000 milliseconds

         DELAY_FIRST_PROBE_TIME            5 seconds

         MIN_RANDOM_FACTOR                 .5

         MAX_RANDOM_FACTOR                 1.5

additional protocol constants are defined with the message formats in Section 4 ๐Ÿ“š.

all protocol constants are subject to change in future revisions of the protocol ๐ŸŒˆ.

the constants in this specification may be overridden by specific documents that describe how IPv6 operates over different link layers. this rule lets Neighbor Discovery work over links with wildly different performance characteristics ๐Ÿš€.


11. SECURITY CONSIDERATIONS ๐Ÿ”ฅ

okay, this section is serious, so buckle up ๐Ÿ˜ญ. Neighbor Discovery is vulnerable to attacks that make IP packets flow to places they were never supposed to go ๐Ÿ’€. these attacks can be used to cause denial of service, and they also let nodes intercept and optionally modify packets meant for other nodes ๐Ÿ™ˆ.

without authentication, the protocol cuts down on exposure to these threats by ignoring ND packets received from off-link senders ๐Ÿ›ก๏ธ.

the Hop Limit field of all received packets is verified to contain 255, the maximum legal value. routers decrement the Hop Limit on every packet they forward, so received packets with a Hop Limit of 255 must have come from a neighbor ๐ŸŽฏ.

the trust model for redirects is the same as in IPv4. a redirect is accepted only if it was received from the same router that is currently being used for that destination. it's natural to trust the routers on the link ๐Ÿซถ. if a host has been redirected to another node (meaning the destination is on-link), there's no way to stop the target from issuing another redirect to some other destination. still, this exposure is no worse than before: once subverted, the target host could always act as a hidden router to forward traffic elsewhere ๐Ÿ•ต๏ธ.

the protocol has no mechanism to figure out which neighbors are authorized to send a particular type of message, such as Router Advertisements. any neighbor, presumably even when authentication is in place, can send Router Advertisement messages and therefore cause denial of service ๐Ÿ˜ค. on top of that, any neighbor can send proxy Neighbor Advertisements, as well as unsolicited Neighbor Advertisements, as a potential denial of service attack ๐Ÿ’”.

Neighbor Discovery protocol packet exchanges can be authenticated using the IP Authentication Header [IPv6-AUTH]. a node SHOULD include an Authentication Header when sending Neighbor Discovery packets if a security association for use with the IP Authentication Header exists for the destination address ๐Ÿ”. those security associations may have been created through manual configuration or through the operation of some key management protocol ๐Ÿ—๏ธ.

received Authentication Headers in Neighbor Discovery packets MUST be verified for correctness, and packets with incorrect authentication MUST be ignored ๐Ÿšซ.

it SHOULD be possible for the system administrator to configure a node to ignore any Neighbor Discovery messages that are not authenticated using either the Authentication Header or Encapsulating Security Payload. the configuration technique for this MUST be documented. such a switch SHOULD default to allowing unauthenticated messages ๐ŸŽ€.

confidentiality issues are handled by the IP Security Architecture and the IP Encapsulating Security Payload documents [IPv6-SA, IPv6-ESP] ๐Ÿซง.


REFERENCES ๐Ÿ“š

[ADDRCONF] Thomson, S., and T. Narten, "IPv6 Address
          Autoconfiguration", RFC 1971, August 1996.

[ADDR-ARCH] Deering, S., and R. Hinden, Editors, "IP Version 6
          Addressing Architecture", RFC 1884, January 1996.

[ANYCST] Partridge, C., Mendez, T., and W. Milliken, "Host
          Anycasting Service", RFC 1546, November 1993.

[ARP] Plummer, D., "An Ethernet Address Resolution Protocol", STD
          37, RFC 826, November 1982.

[HR-CL] Braden, R., Editor, "Requirements for Internet Hosts --
          Communication Layers", STD 3, RFC 1122, October 1989.

[ICMPv4] Postel, J., "Internet Control Message Protocol", STD 5, RFC
          792, September 1981.

[ICMPv6] Conta, A., and S. Deering, "Internet Control Message
          Protocol (ICMPv6) for the Internet Protocol Version 6
          (IPv6)", RFC 1885, January 1996.

[IPv6] Deering, S., and R. Hinden, Editors, "Internet Protocol,
          Version 6 (IPv6) Specification", RFC 1883, January, 1996.

[IPv6-ETHER] Crawford, M., "A Method for the Transmission of IPv6
          Packets over Ethernet Networks", RFC 1972, August 1996.

[IPv6-SA] Atkinson, R., "Security Architecture for the Internet
          Protocol", RFC 1825, August 1995.

[IPv6-AUTH] Atkinson, R., "IP Authentication Header", RFC 1826,
          August 1995.

[IPv6-ESP] Atkinson, R., "IP Encapsulating Security Payload (ESP)",
          RFC 1827, August 1995.

[RDISC] Deering, S., "ICMP Router Discovery Messages", RFC 1256,
          September 1991.

[SH-MEDIA] Braden, R., Postel, J., and Y. Rekhter, "Internet
          Architecture Extensions for Shared Media", RFC 1620, May
          1994.

[ASSIGNED] Reynolds, J., and J. Postel, "ASSIGNED NUMBERS", STD 2,
          RFC 1700, October 1994.

[SYNC] S. Floyd, V. Jacobsen, "The Synchronization of Periodic Routing
          Messages", IEEE/ACM Transactions on Networking, April 1994.
          ftp://ftp.ee.lbl.gov/papers/sync_94.ps.Z

AUTHORS' ADDRESSES ๐Ÿซถ

   Erik Nordmark                Thomas Narten
   Sun Microsystems, Inc.       IBM Corporation
   2550 Garcia Ave              P.O. Box 12195
   Mt. View, CA 94041           Research Triangle Park, NC 27709-2195
   USA                          USA

   Phone: +1 415 786 5166       Phone: +1 919 254 7798
   Fax:   +1 415 786 5896       Fax:   +1 919 254 4027
   EMail: nordmark@sun.com      EMail: narten@vnet.ibm.com


   William Allen Simpson
   Daydreamer
   Computer Systems Consulting Services
   1384 Fontaine
   Madison Heights, Michigan  48071
   USA

   EMail: Bill.Simpson@um.cc.umich.edu
          bsimpson@MorningStar.com

APPENDIX A: MULTIHOMED HOSTS ๐Ÿฆ‹

okay so multihomed hosts (the ones with more than one interface) are giving complicated ๐Ÿ’€. Neighbor Discovery gets messy for them, and this appendix isn't trying to define how they should behave ๐Ÿ™ˆ. It just flags the issues that still need more study. Implementors are encouraged to play around with different approaches to making Neighbor Discovery work on multihomed hosts and to report back on what they find ๐Ÿงš

If a multihomed host gets Router Advertisements on all of its interfaces, it will (probably) have learned on-link prefixes for the addresses on each link โœจ. But when a packet has to go through a router, picking the "wrong" router can lead to a suboptimal or non-functioning path ๐Ÿ˜ญ. There are a few things to think about:

  1. In order for a router to send a redirect, it must determine that the packet it is forwarding originates from a neighbor. The standard test is to compare the packet's source address to the list of on-link prefixes for the interface the packet arrived on. But if the originating host is multihomed, its source address might belong to a different interface than the one it sent the packet from. In that case, a router won't send redirects, and suboptimal routing is likely ๐Ÿฅฒ. To get redirected, the sending host must always send packets out the interface that matches the outgoing packet's source address. This never comes up with non-multihomed hosts, since they only have one interface.
  2. If the selected first-hop router has no route at all for the destination, it can't deliver the packet. The destination might still be reachable through a router on one of the other interfaces ๐Ÿ‘€. Neighbor Discovery doesn't address this scenario, and it doesn't arise in the non-multihomed case.
  3. Even if the first-hop router does have a route for a destination, there may be a better route via another interface. No mechanism exists for the multihomed host to detect this situation.

If a multihomed host fails to receive Router Advertisements on one or more of its interfaces, it won't know (without configured information) which destinations are on-link on the affected interface(s) ๐Ÿ˜ตโ€๐Ÿ’ซ. That leads to a few problems:

  1. If no Router Advertisement is received on any interface, a multihomed host has no way of knowing which interface to send packets out on, even for on-link destinations. In the non-multihomed case, a node treats all destinations as residing on-link under similar conditions, and communication just proceeds ๐Ÿ’–. For multihomed hosts, though, extra information is needed to select the proper outgoing interface. Alternatively, a node could try to perform address resolution on all interfaces, which is a step involving significant complexity that isn't present in the non-multihomed case ๐Ÿซ .
  2. If Router Advertisements are received on some, but not all, interfaces, a multihomed host could choose to only send packets out on the interfaces where it has received them ๐ŸŽ€. A key assumption here is that routers on those other interfaces will be able to route packets to the ultimate destination, even when that destination lives on the subnet the sender connects to but has no on-link prefix information. If that assumption is false, communication would fail ๐Ÿ’€. And even if it holds, packets will still traverse a sub-optimal path.

APPENDIX B: FUTURE EXTENSIONS ๐ŸŒˆ

Possible extensions for future study are:

  • Using dynamic timers so the protocol can adapt to links with widely varying delay โฑ๏ธ. Measuring round trip times, however, requires acknowledgments and sequence numbers so that received Neighbor Advertisements can be matched with the actual Neighbor Solicitation that triggered them. Implementors who want to experiment with this could do so in a backwards-compatible way by defining a new option that carries the necessary information. Nodes that don't understand the option would simply ignore it ๐Ÿซถ.
  • Adding capabilities to make it easier to operate over links that currently require hosts to register with an address resolution server ๐Ÿ“ฎ. This could, for instance, let routers ask hosts to send them periodic unsolicited advertisements. Again, this could be added using a new option sent in the Router Advertisements โœจ.
  • Adding additional procedures for links where asymmetric and non-transitive reachability is part of normal operations ๐Ÿ“ก. Such procedures might let hosts and routers find usable paths on, e.g., radio links.

APPENDIX C: STATE MACHINE FOR THE REACHABILITY STATE ๐Ÿง 

this appendix is a summary of the rules specified in Sections 7.2 and 7.3 ๐Ÿ“. This document does not mandate that implementations adhere to this model, as long as their external behavior is consistent with what's described in this document ๐Ÿ™Œ.

When performing address resolution and Neighbor Unreachability Detection, the following state transitions apply using the conceptual model:

State           Event                   Action                New state

-               Packet to send.         Create entry.         INCOMPLETE
                                        Send multicast NS.
                                        Start retransmit timer

INCOMPLETE      Retransmit timeout,     Retransmit NS         INCOMPLETE
                less than N             Start retransmit timer
                retransmissions.

INCOMPLETE      Retransmit timeout,     Discard entry         -
                N or more               Send ICMP error
                retransmissions.

INCOMPLETE      NA, Solicited=0,        Record link-layer     STALE
                Override=any            address.  Send queued
                                        packets.

INCOMPLETE      NA, Solicited=1,        Record link-layer     REACHABLE
                Override=any            address.  Send queued
                                        packets.

!INCOMPLETE     NA, Solicited=1,        -                     REACHABLE
                Override=0

!INCOMPLETE     NA, Solicited=1,        Record link-layer     REACHABLE
                Override=1              address.

!INCOMPLETE     NA, Solicited=0,        -                     STALE
                Override=0

!INCOMPLETE     NA, Solicited=0,        Record link-layer     STALE
                Override=1              address.

!INCOMPLETE     upper-layer reachability  -                   REACHABLE
                confirmation

REACHABLE       timeout, more than      -                     STALE
                N seconds since
                reachability confirm.

STALE           Sending packet          Start delay timer     DELAY

DELAY           Delay timeout           Send unicast NS probe PROBE

                                        Start retransmit timer

PROBE           Retransmit timeout,     Retransmit NS         PROBE
                less than N
                retransmissions.

PROBE           Retransmit timeout,     Discard entry         -
                N or more
                retransmissions.

The state transitions for receiving unsolicited information other than Neighbor Advertisement messages apply to either the source of the packet (for Neighbor Solicitation, Router Solicitation, and Router Advertisement messages) or the target address (for Redirect messages), as follows:

State           Event                   Action                New state

-               NS, RS, RA, Redirect    Create entry.         STALE

INCOMPLETE      NS, RS, RA, Redirect    Record link-layer     STALE
                                        address.  Send queued
                                        packets.

!INCOMPLETE     NS, RS, RA, Redirect    Update link-layer     STALE
                Different link-layer    address
                address than cached.

!INCOMPLETE     NS, RS, RA, Redirect    -                     unchanged
                Same link-layer
                address as cached.

APPENDIX D: IMPLEMENTATION ISSUES ๐Ÿ’…

Appendix D.1: Reachability confirmations ๐Ÿซถ

Neighbor Unreachability Detection needs explicit confirmation that a forward-path is functioning properly ๐Ÿ”. To avoid the need for Neighbor Solicitation probe messages, upper layer protocols should give such an indication when doing so costs little. Reliable connection-oriented protocols such as TCP are generally aware when the forward-path is working โœจ. When TCP sends (or receives) data, for instance, it updates its window sequence numbers, sets and cancels retransmit timers, and so on. Specific scenarios that usually indicate a properly functioning forward-path include:

  • Receipt of an acknowledgement that covers a sequence number (e.g., data) not previously acknowledged indicates that the forward path was working at the time the data was sent ๐Ÿ“ฌ.
  • Completion of the initial three-way handshake is a special case of the previous rule. Although no data is sent during the handshake, the SYN flags are counted as data from the sequence number perspective ๐Ÿค“. This applies to both the SYN+ACK for the active open the ACK of that packet on the passively opening peer.
  • Receipt of new data (aka data the peer hasn't sent before) ๐Ÿ’– tells us the forward path was working when an acknowledgement went out that moved the peer's send window forward, which is what let that new data get sent in the first place ๐Ÿฆ‹

Okay so, sending reachability info between TCP and IP isn't free, so an implementation may wish to rate-limit the reachability confirmations it sends to IP ๐ŸŽ€ One option is to only process reachability every few packets. For example, if an implementation only has one round trip timer per connection, it might update reachability info once per round trip time โฐ If an implementation caches Destination Cache entries inside control blocks, it may be possible to update the Neighbor Cache entry directly (no expensive lookup!) once the TCP packet has been demultiplexed to its control block โœจ For other implementations, it may be possible to piggyback the reachability confirmation on the next packet submitted to IP, as long as the implementation guards against that confirmation going stale when no packets go to IP for an extended period ๐Ÿซถ

TCP also has to watch out for stale information pretending to be current reachability ๐Ÿ˜ญ New data received 30 minutes after a window has opened up does not confirm the path is working right now. It only means that 30 minutes ago the window update reached the peer, so the path was working at that point in time ๐Ÿ•ฐ๏ธ An implementation must also account for TCP zero-window probes, which get sent even when the path is broken and the window update never reached the peer ๐Ÿ’€

For UDP based applications (RPC, DNS), it's relatively simple to have the client send reachability confirmations when the response packet is received ๐ŸŒธ It's harder, and in some cases impossible, for the server to generate these confirmations, since there is no flow control. The server cannot tell whether a received request means a previous response reached the client ๐Ÿ™ˆ

Negative upper-layer advice cannot replace the Neighbor Unreachability Detection algorithm ๐Ÿšซ Negative advice (e.g., from TCP when there are excessive retransmissions) could hint that the forward path from the sender of the data might not be working. But it would fail to detect when the path from the receiver of the data isn't functioning, causing none of the acknowledgement packets to reach the

dgement

๐Ÿ“ฆ where this page comes from