RFC 2461

Neighbor Discovery for IP Version 6 (IPv6)

๐Ÿ“… published December 1998, from ietf

Neighbor Discovery for IP Version 6 (IPv6) ๐Ÿ’–

okay bestie, let's get into RFC 2461 ๐ŸŽ€ It's titled Neighbor Discovery for IP Version 6 (IPv6), and it came out of the Network Working Group as Request for Comments 2461. The authors are T. Narten (IBM), E. Nordmark (Sun Microsystems), and W. Simpson (Daydreamer). It's a Standards Track doc, dated December 1998 ๐Ÿ“… It obsoletes RFC 1970 ๐Ÿฆ‹ and doesn't list any document it updates.


Status of this Memo ๐Ÿ“œ

This doc is an Internet standards track protocol for the Internet community, and it's asking for discussion and suggestions for improvements ๐Ÿซถ For the standardization state and status of this protocol, check the current edition of the "Internet Official Protocol Standards" (STD 1) โœจ Distribution of this memo is unlimited ๐ŸŒˆ

Copyright (C) The Internet Society (1998). All Rights Reserved. ๐Ÿ’œ

Abstract ๐ŸŒธ

Okay so this doc specifies the Neighbor Discovery protocol for IP Version 6 ๐Ÿ”ฅ IPv6 nodes on the same link use Neighbor Discovery to find out each other's presence, figure out each other's link-layer addresses, find routers, and keep track of reachability info about the paths to active neighbors. It's giving full social network for devices on one link ๐Ÿ’…

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........................................    9
   3.1.  Comparison with IPv4................................   13
   3.2.  Supported Link Types................................   15
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.............................   26
   4.6.  Option Formats......................................   28
      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............................................   32
5.  CONCEPTUAL MODEL OF A HOST...............................   33
   5.1.  Conceptual Data Structures..........................   33
   5.2.  Conceptual Sending Algorithm........................   35
   5.3.  Garbage Collection and Timeout Requirements.........   37
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....   39
   6.2.  Router Specification................................   40
      6.2.1.  Router Configuration Variables.................   40
      6.2.2.  Becoming An Advertising Interface..............   44
      6.2.3.  Router Advertisement Message Content...........   44
      6.2.4.  Sending Unsolicited Router Advertisements......   46
      6.2.5.  Ceasing To Be An Advertising Interface.........   46
      6.2.6.  Processing Router Solicitations................   47
      6.2.7.  Router Advertisement Consistency...............   48
      6.2.8.  Link-local Address Change......................   49
   6.3.  Host Specification..................................   50
      6.3.1.  Host Configuration Variables...................   50
      6.3.2.  Host Variables.................................   50
      6.3.3.  Interface Initialization.......................   51
      6.3.4.  Processing Received Router Advertisements......   51
      6.3.5.  Timing out Prefixes and Default Routers........   54
      6.3.6.  Default Router Selection.......................   54
      6.3.7.  Sending Router Solicitations...................   55
7.  ADDRESS RESOLUTION AND NEIGHBOR UNREACHABILITY DETECTION.   56
   7.1.  Message Validation..................................   57
      7.1.1.  Validation of Neighbor Solicitations...........   57
      7.1.2.  Validation of Neighbor Advertisements..........   58
   7.2.  Address Resolution..................................   58
      7.2.1.  Interface Initialization.......................   59
      7.2.2.  Sending Neighbor Solicitations.................   59
      7.2.3.  Receipt of Neighbor Solicitations..............   60
      7.2.4.  Sending Solicited Neighbor Advertisements......   61
      7.2.5.  Receipt of Neighbor Advertisements.............   62
      7.2.6.  Sending Unsolicited Neighbor Advertisements....   64
      7.2.7.  Anycast Neighbor Advertisements................   65
      7.2.8.  Proxy Neighbor Advertisements..................   65
   7.3.  Neighbor Unreachability Detection...................   66
      7.3.1.  Reachability Confirmation......................   66
      7.3.2.  Neighbor Cache Entry States....................   67
      7.3.3.  Node Behavior..................................   68
8.  REDIRECT FUNCTION........................................   70

   8.1.  Validation of Redirect Messages.....................   71
   8.2.  Router Specification................................   72
   8.3.  Host Specification..................................   73
9.  EXTENSIBILITY - OPTION PROCESSING........................   74
10. PROTOCOL CONSTANTS......................................   75
11. SECURITY CONSIDERATIONS.................................   76
12. RENUMBERING CONSIDERATIONS..............................   78

References...................................................   80
Authors' Addresses...........................................   81
Appendix A: Multihomed Hosts.................................   82
Appendix B: Future Extensions................................   84
Appendix C: State Machine for the Reachability State.........   85
Appendix D: Summary of ISROUTER Rules........................   88
Appendix E: Implementation Issues............................   89
    Appendix E.1: Reachability confirmations.................   89
Appendix F: Changes since RFC 1970...........................   91
Full Copyright Statement.....................................   93

1. INTRODUCTION โœจ

This spec defines the Neighbor Discovery (ND) protocol for Internet Protocol Version 6 (IPv6) ๐Ÿฆ‹ Nodes (that's hosts and routers) use Neighbor Discovery to figure out the link-layer addresses of neighbors that live on attached links, and to quickly purge cached values that go stale ๐Ÿงน Hosts also use it to find neighboring routers that are willing to forward packets on their behalf ๐Ÿงš And nodes use the protocol to actively keep track of which neighbors are reachable and which aren't, and to detect changed link-layer addresses. When a router (or the path to one) fails, a host goes looking for functioning alternates. Main character energy, honestly ๐Ÿ‘‘

Unless a document covering IP over a particular link type says otherwise, this doc applies to all link types ๐ŸŒˆ Still, because ND uses link-layer multicast for some of its services, some link types (e.g., NBMA links) might get alternative protocols or mechanisms for those services, specified in the right document for IP over that link type ๐Ÿ“ The services here that don't directly depend on multicast, like Redirects, Next-hop determination, Neighbor Unreachability Detection, etc., are expected to be provided as this doc specifies. How you actually use ND on NBMA links is still an area for further study ๐Ÿ™ˆ

The authors want to shout out the contributions of the IPNGWG working group ๐Ÿซถ Listed in alphabetical order, they are: Ran Atkinson, Jim Bound, Scott Bradner, Alex Conta, Stephen Deering, Richard Draves, Francis Dupont, Robert Elz, Robert Gilligan, Robert Hinden, Allison Mankin, Dan McDonald, Charles Perkins, Matt Thomas, and Susan Thomson. Iconic squad ๐Ÿ’–


2. TERMINOLOGY ๐ŸŽ€

2.1. General โœจ

okay bestie, let's get into the glossary ๐Ÿ“–๐Ÿ’– we're starting with the basics!

IP means Internet Protocol Version 6 ๐ŸŒธ IPv4 and IPv6 only get said out loud when we actually need them to avoid confusion, no cap ๐Ÿซถ

ICMP is the Internet Message Control Protocol for the Internet Protocol Version 6 ๐Ÿฆ‹ same deal here: ICMPv4 and ICMPv6 only come up when it's necessary to keep things clear โœจ

node is any device that implements IP ๐Ÿ’ป

router is a node that forwards IP packets that aren't explicitly addressed to itself ๐Ÿšš it's giving delivery driver energy ๐Ÿ’…

host is any node that is not a router ๐Ÿ 

upper layer is a protocol layer sitting immediately above IP ๐ŸŽ€ the 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 (aka encapsulated in) IP, like IPX, AppleTalk, or IP itself ๐Ÿงš

link is a communication facility or medium that nodes can use to talk at the link layer, which is the layer right below IP ๐Ÿ”— examples are Ethernets (simple or bridged), PPP links, X.25, Frame Relay, or ATM networks. it also counts as a link when it's an internet (or higher) layer "tunnel," 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, usually spread across different nodes ๐ŸŒ a packet sent to an anycast address gets delivered to one of the interfaces that address identifies (the "nearest" one, according to the routing protocol's measure of distance). see [ADDR-ARCH] ๐Ÿ“š

ngl this part is so iconic: an anycast address looks exactly like a unicast address on the wire ๐Ÿ™ˆ so nodes sending packets to anycast addresses usually don't know one is being used. for the rest of this document, any reference to unicast addresses also applies to anycast addresses in cases where the node doesn't realize the unicast address is actually an anycast address ๐Ÿ’œ

prefix is a bit string made 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. it's the main character of matching ๐Ÿ‘‘

reachability is whether or not the one-way "forward" path to a neighbor is working properly ๐Ÿ›ค๏ธ specifically, it's about whether packets sent to a neighbor reach the IP layer on the neighboring machine and get processed properly by the receiving IP layer. for neighboring routers, reachability means packets sent by a node's IP layer get delivered to the router's IP layer, and the router is actually forwarding packets (so it's configured as a router, not a host). for hosts, reachability means packets sent by a node's IP layer get delivered to the neighbor host's IP layer โœ…

packet is an IP header plus payload ๐Ÿ“ฆ

link MTU is the maximum transmission unit, meaning 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 for a mobile node that has moved off-link could potentially act as a proxy for that 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 happens on a node other than the one that originated the packet, an ICMP error message is generated. if the error happens 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 gets notified through an appropriate mechanism (for example, 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 is when sending out messages, sometimes a transmission has to be delayed for a random amount of time ๐ŸŽฒ this stops multiple nodes from transmitting at exactly the same time, and it stops long-range periodic transmissions from syncing up with each other [SYNC] ๐Ÿ”„ when a random component is required, a node calculates the actual delay so that it forms a uniformly-distributed random value 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 is about pseudo-random number generators used when calculating a random delay component ๐ŸŒฑ if one is used, the generator should be initialized with a unique seed before it gets used. it's not enough to use the interface token alone as the seed, since interface tokens won't always be unique ๐Ÿ™…โ€โ™€๏ธ to lower the chance that duplicate interface tokens cause the same seed to be used, the seed should be calculated from a variety of input sources (for example, 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, and 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 neighbors (that's broadcast) or to 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 to 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 (for example X.25, ATM, frame relay, etc.) ๐Ÿ•ธ๏ธ

bestie, this one has a little twist ๐Ÿ‘€ all link types (NBMA included) are expected to provide multicast service for IP (for example, using multicast servers). but whether ND should use those facilities or an alternate mechanism that gives the equivalent ND services is still an issue for further study ๐Ÿ”ฌ

shared media is a link that lets a number of nodes communicate directly, but the attached nodes are configured so they don't have complete prefix information for all on-link destinations ๐Ÿ˜๏ธ that means at the IP level, nodes on the same link might not know they're neighbors, so by default they communicate through a router. examples are large (switched) public data networks like SMDS and B-ISDN. these are also called "large clouds" โ˜๏ธ see [SH-MEDIA] ๐Ÿ“–

variable MTU is a link that doesn't have a well-defined MTU (for example IEEE 802.5 token rings) ๐ŸŒ€ lots of links (like Ethernet) have a standard MTU defined by the link-layer protocol or by the specific document describing how to run IP over that 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 ๐Ÿ“ก it's giving chaotic-but-valid energy ๐Ÿ’€โœจ

2.3. Addresses ๐Ÿฆ‹

okay so Neighbor Discovery borrows a bunch of addresses that are already defined in [ADDR-ARCH], and they're honestly the stars of the show ๐Ÿ’…

  • all-nodes multicast address: the link-local scope address that reaches all nodes. It's FF02::1 โœจ
  • all-routers multicast address: the link-local scope address that reaches all routers. It's FF02::2 ๐Ÿ‘‘
  • solicited-node multicast address: a link-local scope multicast address that gets computed from the solicited target's address. The function lives in [ADDR-ARCH]. The clever part is that addresses which differ only in their high-order bits (like when you've got multiple high-order prefixes from different providers) still map to the same solicited-node address ๐Ÿงš. That means a node has fewer multicast addresses to join, which is so efficient it's giving main character energy ๐ŸŒˆ
  • link-local address: a unicast address with link-only scope, used to reach neighbors ๐ŸŒธ. All interfaces on routers MUST have a link-local address. Also, [ADDRCONF] requires that interfaces on hosts have a link-local address ๐Ÿซถ
  • unspecified address: a reserved value that means "there's no address here" (like, it's unknown) ๐Ÿ™ˆ. It's never used as a destination address, but it can be used as a source address if the sender doesn't know its own address yet. An example is checking whether an address is unused during address autoconfiguration [ADDRCONF] ๐Ÿ’€. Its value is 0:0:0:0:0:0:0:0 ๐Ÿ“
Quick reminder: the unspecified address is never a destination. Only ever a source, and only when the sender is still figuring out who it is ๐Ÿซถ

2.4. Requirements ๐Ÿ’œ

okay the keywords MUST, MUST NOT, REQUIRED, SHALL, SHALL NOT, SHOULD, SHOULD NOT, RECOMMENDED, MAY, and OPTIONAL are the big deal here ๐Ÿ˜ญ When they show up in this document, they're interpreted the way [KEYWORDS] describes. So read them carefully, bestie ๐ŸŽ€

Also, this doc uses internal conceptual variables to describe how the protocol behaves, plus external variables that an implementation has to let system administrators change ๐Ÿ”ฅ. The variable names, how their values change, and how those settings affect the protocol are all there to show the behavior. An implementation doesn't need to match these exact forms, as long as its external behavior is consistent with what's described here โœจ Not me being like "you have to copy this exactly" when the actual rule is "match the behavior" ๐Ÿ’…

3. PROTOCOL OVERVIEW โœจ

okay so this protocol is basically the group chat for every node sitting on the same link ๐Ÿ’ฌ and it solves a whole list of problems so they can actually vibe together. here's the full lineup ๐Ÿ’…

  • Router Discovery: how hosts find the routers hanging out on an attached link ๐Ÿงญ
  • Prefix Discovery: how hosts figure out the set of address prefixes that decide which destinations are on-link for an attached link. (nodes use prefixes to tell apart the destinations that live on-link from the ones only reachable through a router ๐Ÿ‘€)
  • Parameter Discovery: how a node learns link parameters like the link MTU, or Internet parameters like the hop limit value to stick in outgoing packets ๐Ÿ“ฆ
  • Address Autoconfiguration: how nodes automatically set up an address for an interface โœจ
  • Address resolution: how nodes figure out the link-layer address of an on-link destination (like a neighbor) when all they have is the destination's IP address ๐Ÿ”
  • Next-hop determination: the algorithm that maps an IP destination address to the IP address of the neighbor that traffic for that destination should be sent to. the next-hop can be a router or the destination itself ๐Ÿฆ‹
  • Neighbor Unreachability Detection: how nodes realize a neighbor is no longer reachable ๐Ÿ’€. for neighbors used as routers, alternate default routers can be tried, and for both routers and hosts, address resolution can be performed again
  • Duplicate Address Detection: how a node checks that an address it wants to use isn't already taken by another node ๐Ÿ™ˆ
  • Redirect: how a router tells a host about a better first-hop node to reach a particular destination ๐Ÿงš

okay now the messages ๐Ÿ“ฉ Neighbor Discovery defines five different ICMP packet types. that's a pair of Router Solicitation and Router Advertisement messages, a pair of Neighbor Solicitation and Neighbor Advertisement messages, and a Redirect message. here's what each one is for:

  • Router Solicitation: when an interface gets enabled, hosts may send out Router Solicitations asking routers to generate Router Advertisements right away instead of waiting for their next scheduled time ๐Ÿ™‹โ€โ™€๏ธ
  • Router Advertisement: routers announce they exist, along with various link and Internet parameters, either periodically or in response to a Router Solicitation message ๐Ÿ“ฃ. Router Advertisements carry prefixes used for on-link determination and/or address configuration, a suggested hop limit value, etc. ๐ŸŽ€
  • Neighbor Solicitation: sent by a node to find out a neighbor's link-layer address, or to check that a neighbor is still reachable via a cached link-layer address ๐Ÿ”Ž. Neighbor Solicitations are also used for Duplicate Address Detection ๐Ÿซถ
  • Neighbor Advertisement: the 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 tell hosts about a better first hop for a destination ๐Ÿงญ

on multicast-capable links, every router periodically multicasts a Router Advertisement packet to say "hey, I'm here" ๐Ÿ“ก. hosts catch Router Advertisements from all the routers and build a list of default routers ๐Ÿ“. routers send these often enough that hosts find out about them within a few minutes, but not so often that hosts can rely on the absence of advertisements to detect router failure ๐Ÿ™ƒ. that's why there's a separate Neighbor Unreachability Detection algorithm handling failure detection ๐Ÿ›Ÿ

Router Advertisements also carry a list of prefixes used for on-link determination and/or autonomous address configuration ๐Ÿ—‚๏ธ. flags attached to the prefixes say what each prefix is meant for ๐Ÿšฉ. hosts use the advertised on-link prefixes to build and maintain a list, and that list is what they check when deciding whether a packet's destination is on-link or beyond a router ๐Ÿง . be careful though, because a destination can be on-link even if no advertised on-link prefix covers it โš ๏ธ. in that case a router can send a Redirect telling the sender that the destination is a neighbor ๐Ÿ’โ€โ™€๏ธ

Router Advertisements (and the per-prefix flags) let routers tell hosts how to do Address Autoconfiguration ๐Ÿ . for example, routers can say whether hosts should use stateful (DHCPv6) and/or autonomous (stateless) address configuration ๐ŸŽŸ๏ธ. the exact semantics and usage of that address configuration info is spelled out in [ADDRCONF] ๐Ÿ“–

Router Advertisement messages also hold Internet parameters, like the hop limit hosts should use in outgoing packets, and optionally link parameters like the link MTU ๐Ÿ“. this is lowkey amazing because it means admins can set critical parameters once on the routers and they get propagated automatically to every attached host ๐Ÿ‘‘

Nodes do address resolution by multicasting a Neighbor Solicitation that asks the target node to send back its link-layer address ๐Ÿ™‹. Neighbor Solicitation messages get multicast to the solicited-node multicast address of the target address ๐ŸŽฏ. the target replies with its link-layer address in a unicast Neighbor Advertisement message ๐Ÿ’œ. one request-response pair is enough for both the initiator and the target to resolve each other's link-layer addresses, since the initiator includes its own link-layer address in the Neighbor Solicitation ๐Ÿค that's giving efficiency!! ๐Ÿ”ฅ

Neighbor Solicitation messages can also check whether more than one node has been assigned the same unicast address ๐Ÿ‘ฏ. using Neighbor Solicitation messages for Duplicate Address Detection is specified in [ADDRCONF] โœจ

Neighbor Unreachability Detection catches the failure of a neighbor, or the failure of the forward path to the neighbor ๐Ÿ˜ญ. to do that, it needs positive confirmation that packets sent to a neighbor are actually reaching it and being processed properly by its IP layer ๐Ÿ“ฌ. it gets confirmation from two sources. when possible, upper-layer protocols give a positive confirmation that a connection is making "forward progress", meaning previously sent data is known to have been delivered correctly (for example, new acknowledgments were received recently) ๐ŸŽ‰. when that kind of "hint" doesn't show up, a node sends unicast Neighbor Solicitation messages that solicit Neighbor Advertisements as reachability confirmation from the next hop ๐Ÿซง. to cut down on unnecessary network traffic, probe messages only go to neighbors the node is actively sending packets to ๐ŸŒธ

Neighbor Discovery also handles a few extra situations ๐Ÿง

  • Link-layer address change: a node that knows its link-layer address changed can multicast a few (unsolicited) Neighbor Advertisement packets to all nodes so cached link-layer addresses that went stale get updated fast ๐Ÿƒโ€โ™€๏ธ. just note that sending unsolicited advertisements is only a performance enhancement (e.g., unreliable) ๐Ÿ™. the Neighbor Unreachability Detection algorithm makes sure every node reliably discovers the new address, it just might take a bit longer ๐Ÿข
  • Inbound load balancing: nodes with replicated interfaces may want to load balance incoming packets across multiple network interfaces on the same link ๐ŸŒŠ. those nodes have multiple link-layer addresses assigned to the same interface. for example, a single network driver could represent multiple network interface cards as one logical interface with several link-layer addresses ๐Ÿƒ

load balancing works by letting routers leave the source link-layer address out of Router Advertisement packets, which forces neighbors to use Neighbor Solicitation messages to learn the routers' link-layer addresses ๐Ÿงฉ. the returned Neighbor Advertisement messages can then carry link-layer addresses that depend on who sent the solicitation ๐Ÿ’ซ

  • Anycast addresses: anycast addresses identify one of a set of nodes providing an equivalent service, and several nodes on the same link may be configured to recognize the same anycast address ๐ŸŒ. Neighbor Discovery handles this by having nodes expect to receive multiple Neighbor Advertisements for the same target ๐Ÿงšโ€โ™€๏ธ. all advertisements for anycast addresses get tagged as non-Override advertisements ๐Ÿท๏ธ. that invokes specific rules for figuring out which of the potentially multiple advertisements should be used ๐Ÿง 
  • Proxy advertisements: a router willing to accept packets on behalf of a target address that can't respond to Neighbor Solicitations can issue non-Override Neighbor Advertisements ๐Ÿซฅ. there's currently no specified use of proxy, but proxy advertising could potentially handle cases like mobile nodes that have moved off-link ๐Ÿšถโ€โ™€๏ธ. it is not intended as a general mechanism for nodes that, e.g., don't implement this protocol ๐Ÿšซ not the vibe, bestie ๐Ÿ’–

3.1. Comparison with IPv4 โœจ

okay so this is the glow-up moment ๐Ÿ’…. The IPv6 Neighbor Discovery protocol is basically a combo of ARP [ARP], ICMP Router Discovery [RDISC], and ICMP Redirect [ICMPv4] all rolled into one ๐Ÿซถ. IPv4 never had a generally agreed upon protocol or mechanism for Neighbor Unreachability Detection, though Hosts Requirements [HR-CL] does lay out some possible algorithms for Dead Gateway Detection (which is a subset of the problems Neighbor Unreachability Detection tackles). ngl that's a lot of acronyms ๐Ÿ˜ญ

Anyway, Neighbor Discovery gives us a whole buffet of upgrades over the IPv4 set of protocols ๐Ÿ“:

  • 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 lacking a well-defined MTU ๐ŸŽ€.
  • Address resolution multicasts are "spread" over 4 billion (2^32) multicast addresses, which greatly reduces address resolution related interrupts on nodes other than the target. Moreover, non-IPv6 machines should not be interrupted at all ๐Ÿ˜ญ๐Ÿซถ.
  • Redirects contain the link-layer address of the new first hop, so separate address resolution isn't needed 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. However, routers may be configured to omit some or all prefixes from Router Advertisements. In those cases hosts assume that 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 that 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]. It's expected to be useful on non-broadcast and shared media links, where it's undesirable or not possible for nodes to know all prefixes for on-link destinations ๐Ÿ‘‘.
  • Neighbor Unreachability Detection is part of the base, significantly improving the robustness of packet delivery in the presence of failing routers, partially failing or partitioned links, and nodes that change their link-layer addresses. For instance, mobile nodes can move off-link without losing any connectivity due to stale ARP caches ๐Ÿ”ฅ.
  • Unlike ARP, Neighbor Discovery detects half-link failures (using Neighbor Unreachability Detection) and avoids sending traffic to neighbors with which two-way connectivity is absent ๐Ÿ’–.
  • Unlike in IPv4 Router Discovery, the Router Advertisement messages do not 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 ๐ŸŒธ.
  • Link-local addresses are used to uniquely identify routers (for Router Advertisement and Redirect messages), which makes it possible for hosts to keep their router associations 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 ๐Ÿ™…โ€โ™€๏ธโœจ.
  • Placing address resolution at the ICMP layer makes the protocol more media-independent than ARP and makes it possible to use standard IP authentication and security mechanisms as appropriate [IPv6-AUTH, IPv6-ESP] ๐Ÿ”๐Ÿ’œ.

okay so Neighbor Discovery works on links with different properties ๐Ÿฆ‹. With certain properties, 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, are not specified in this document. Note that 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] in order to simplify use of 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 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 allows routers to 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) in order for multicast to work properly. Otherwise, when multicasting, a sender (which can't know which nodes will receive the packet) couldn't determine a minimum packet size all receivers can process ๐Ÿ“๐Ÿ’–.
  • asymmetric reachability: Neighbor Discovery detects the absence of symmetric reachability, and a node avoids paths to a neighbor with which it doesn't have symmetric connectivity.

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 ๐ŸŽ€

okay so hosts send Router Solicitations to prompt routers into generating Router Advertisements quickly ๐Ÿ™. Here's what the packet looks like:

   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
  • 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. MUST NOT be included if the Source Address is the unspecified address. Otherwise it SHOULD 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 do not recognize and continue processing the message ๐Ÿฆ‹โœจ.

4.2. Router Advertisement Message Format ๐Ÿ“ก

Okay bestie, routers send out Router Advertisement messages periodically ๐Ÿ•ฐ๏ธ or in response to a Router Solicitation ๐Ÿ’Œ. Here's the layout, no cap it's giving architecture ๐Ÿ˜ญโœจ

      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: It MUST be the link-local address assigned to the interface from which this message is sent. Non-negotiable, periodt ๐Ÿ’…
  • Destination Address: Typically the Source Address of an invoking Router Solicitation, or the all-nodes multicast address ๐ŸŒ
  • Hop Limit: 255 ๐Ÿ”ข
  • 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: 134 ๐ŸŽ€
  • Code: 0 ๐Ÿซถ
  • Checksum: The ICMP checksum. See [ICMPv6]. ๐Ÿงพ
  • Cur Hop Limit: 8-bit unsigned integer ๐Ÿ”ข. This is the default value that should be placed in the Hop Count field of the IP header for outgoing IP packets. A value of zero means unspecified (by this router) ๐Ÿคทโ€โ™€๏ธ
  • M: 1-bit "Managed address configuration" flag ๐Ÿ . When it's set, hosts use the administered (stateful) protocol for address autoconfiguration in addition to any addresses autoconfigured using stateless address autoconfiguration. How this flag is used is described in [ADDRCONF] ๐Ÿ“–
  • O: 1-bit "Other stateful configuration" flag ๐Ÿง. When it's set, hosts use the administered (stateful) protocol for autoconfiguration of other (non-address) information. How this flag is used is described in [ADDRCONF] ๐Ÿ“–
  • Reserved: A 6-bit unused field ๐Ÿซง. It MUST be initialized to zero by the sender and MUST be ignored by the receiver ๐Ÿ™ˆ
  • Router Lifetime: 16-bit unsigned integer โณ. This is the lifetime associated with the default router, in units of seconds. The maximum value corresponds to 18.2 hours. A Lifetime of 0 indicates that the router is not a default router and SHOULD NOT appear on the default router list ๐Ÿ’€. The Router Lifetime only applies to the router's usefulness as a default router. It does not apply to information contained in other message fields or options. Options that need time limits for their information include their own lifetime fields โœจ
  • Reachable Time: 32-bit unsigned integer โฑ๏ธ. This is the time, in milliseconds, that a node assumes a neighbor is reachable after having received a reachability confirmation. It's used by the Neighbor Unreachability Detection algorithm (see Section 7.3) ๐Ÿ”. A value of zero means unspecified (by this router) ๐Ÿซ 
  • Retrans Timer: 32-bit unsigned integer โฒ๏ธ. This is the time, in milliseconds, between retransmitted Neighbor Solicitation messages. It's used by address resolution and the Neighbor Unreachability Detection algorithm (see Sections 7.2 and 7.3) ๐Ÿงฉ. A value of zero means unspecified (by this router) ๐Ÿซ 

Possible options ๐ŸŽ

  • Source link-layer address: This is the link-layer address of the interface from which the Router Advertisement is sent. It's only used on link layers that have addresses ๐Ÿ“ฎ. A router MAY omit this option in order to enable inbound load sharing across multiple link-layer addresses ๐Ÿšš
  • MTU: This SHOULD be sent on links that have a variable MTU (as specified in the document that describes how to run IP over the particular link type) ๐Ÿ“. It MAY be sent on other links ๐ŸŒธ
  • Prefix Information: These options specify the prefixes that are on-link and/or are used for address autoconfiguration ๐Ÿ—บ๏ธ. A router SHOULD include all its on-link prefixes (except the link-local prefix) so that multihomed hosts have complete prefix information about on-link destinations for the links to which they attach ๐Ÿ˜๏ธ. If complete information is lacking, a multihomed host may not be able to choose the correct outgoing interface when sending traffic to its neighbors ๐Ÿ˜ตโ€๐Ÿ’ซ

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.3. Neighbor Solicitation Message Format ๐Ÿ”

Okay so nodes send Neighbor Solicitations to ask for the link-layer address of a target node, while also giving over their own link-layer address to that target ๐Ÿ“ฌ. They go out as multicast when a node needs to resolve an address ๐ŸŒ, and as unicast when a node wants to double-check that a neighbor is still reachable ๐Ÿซ‚. Here's the layout ๐Ÿ‘‘

         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 from which this message is sent, or (if Duplicate Address Detection is in progress [ADDRCONF]) the unspecified address ๐Ÿชช
  • Destination Address: This is either the solicited-node multicast address corresponding to the target address, or the target address ๐ŸŽฏ
  • Hop Limit: 255 ๐Ÿ”ข
  • 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: 135 ๐ŸŽ€
  • 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 ๐Ÿ™ˆ
  • Target Address: This 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 ๐Ÿ“ฎ. It MUST NOT be included when the source IP address is the unspecified address. Otherwise, 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 do not recognize and continue processing the message ๐Ÿซถโœจ

4.4. Neighbor Advertisement Message Format โœจ

Okay bestie, so nodes send Neighbor Advertisements as replies to Neighbor Solicitations ๐Ÿ’Œ, and they also send unsolicited ones to spread new info fast (it's unreliable, but it's so quick) ๐Ÿš€.

    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 from which the advertisement is sent.
  • Destination Address: For solicited advertisements, the Source Address of an invoking Neighbor Solicitation or, if the solicitation's Source Address is the unspecified address, the all-nodes multicast address. For unsolicited advertisements, typically the all-nodes multicast address.
  • Hop Limit: 255

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: 136
  • Code: 0
  • Checksum: The ICMP checksum. See [ICMPv6].
  • R: Router flag. When set, the R-bit indicates that the sender is a router. The R-bit is used by Neighbor Unreachability Detection to detect a router that changes to a host.
  • S: Solicited flag. When set, the S-bit indicates that the advertisement was sent in response to a Neighbor Solicitation from the Destination address. The S-bit is used as a reachability confirmation for Neighbor Unreachability Detection. It MUST NOT be set in multicast advertisements or in unsolicited unicast advertisements.
  • O: Override flag. When set, the O-bit indicates that the advertisement should override an existing cache entry and update the cached link-layer address. When it is not set, the advertisement will not update a cached link-layer address, though it will 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: 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, the Target Address field in the Neighbor Solicitation message that prompted this advertisement. For an unsolicited advertisement, the address whose link-layer address has changed. The Target Address MUST NOT be a multicast address.

Possible Options ๐ŸŽ€

  • Target link-layer address: The link-layer address for the target, i.e., the sender of the advertisement. This option MUST be included on link layers that have addresses when responding to multicast solicitations. When responding to a unicast Neighbor Solicitation, this option SHOULD be included.

The option MUST be included for multicast solicitations in order to avoid infinite Neighbor Solicitation "recursion" when the peer node does not have a cache entry to return a Neighbor Advertisements message. When responding to unicast solicitations, the option can be omitted, since the sender of the solicitation has the correct link-layer address (otherwise it would not have been able to send the unicast solicitation in the first place). However, including the link-layer address in this case adds little overhead and eliminates a potential race condition where the sender deletes the cached link-layer address prior to receiving a response to a previous solicitation.

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.5. Redirect Message Format ๐Ÿฆ‹

Routers send Redirect packets to tell a host about a better first-hop node on the path to a destination ๐Ÿ›ฃ๏ธ. Hosts can be redirected to a better first-hop router, but a redirect can also let them know that the destination is actually a neighbor ๐Ÿ‘€. That second case happens when the ICMP Target Address is set 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: MUST be the link-local address assigned to the interface from which this message is sent.
  • Destination Address: The Source Address of the packet that triggered the redirect.
  • Hop Limit: 255

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: 137
  • 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.
  • Target Address: 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: The IP address of the destination which is redirected to the target.

Possible Options ๐ŸŽ€

  • Target link-layer address: 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 1280 octets. ๐Ÿ’–

4.6. Option Formats ๐Ÿ’–

okay so ND messages can carry zero or more options ๐Ÿงš, and some of them can show up more than once in the same message. every option follows this exact shape:

     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: an 8-bit identifier for 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: an 8-bit unsigned integer ๐Ÿ”ข. it's the length of the option (including the type and length fields) in units of 8 octets. the value 0 is invalid. Nodes MUST silently discard an ND packet that contains an option with length zero. no exceptions, bestie ๐Ÿ™…โ€โ™€๏ธ
     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: 1 means Source Link-layer Address, and 2 means Target Link-layer Address.
  • Length: the length of the option (including the type and length fields) in units of 8 octets. for example, the length for IEEE 802 addresses is 1 [IPv6-ETHER]. ๐ŸŒธ
  • Link-Layer Address: 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, like [IPv6-ETHER]. ๐Ÿง 

Description: the Source Link-Layer Address option carries the link-layer address of the sender of the packet ๐Ÿ“ฌ. it's used in the Neighbor Solicitation, Router Solicitation, and Router Advertisement packets.

the Target Link-Layer Address option carries the link-layer address of the target ๐ŸŽฏ. it's 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: 3.
  • Length: 4.
  • Prefix Length: an 8-bit unsigned integer ๐Ÿ“. it's the number of leading bits in the Prefix that are valid. the value ranges from 0 to 128.
  • L: a 1-bit on-link flag ๐Ÿ”—. when set, it means 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. it's giving flexible ๐ŸŒˆ
  • A: a 1-bit autonomous address-configuration flag ๐Ÿช„. when set, it means this prefix can be used for autonomous address configuration as specified in [ADDRCONF].
  • Reserved1: a 6-bit unused field ๐Ÿซง. it MUST be initialized to zero by the sender and MUST be ignored by the receiver.
  • Valid Lifetime: a 32-bit unsigned integer โณ. it's 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: a 32-bit unsigned integer ๐Ÿ’œ. it's 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: 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 gives hosts 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                        ~
     |                                                               |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Fields:

  • Type: 4.
  • Length: the length of the option in units of 8 octets.
  • Reserved: these fields are unused. they MUST be initialized to zero by the sender and MUST be ignored by the receiver.
  • IP header + data: the original packet, truncated to make sure the size of the redirect message does not exceed 1280 octets โœ‚๏ธ.

Description: the Redirected Header option is used in Redirect messages and holds all or part of the packet that is being redirected ๐Ÿ“ฆ.

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

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: this field is unused. it MUST be initialized to zero by the sender and MUST be ignored by the receiver.
  • MTU: a 32-bit unsigned integer ๐Ÿ“. it's the recommended MTU for the link.

Description: the MTU option is used in Router Advertisement messages so that all nodes on a link use the same MTU value in those cases where the link MTU is not well known ๐Ÿค.

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

in configurations where heterogeneous technologies are bridged together, the maximum supported MTU may differ from one segment to another ๐ŸŒ‰. if the bridges do not generate ICMP Packet Too Big messages, communicating nodes won't be able to use Path MTU to dynamically figure out the right MTU on a per-neighbor basis ๐Ÿ˜ญ. in those cases, routers use the MTU option to specify the maximum MTU value that is supported by all segments. literally the saving grace ๐Ÿ‘‘

5. CONCEPTUAL MODEL OF A HOST โœจ

okay so this section is a mental model of how hosts (and kinda routers too) keep track of their neighbors ๐Ÿ  It's here to make Neighbor Discovery easier to picture, but it's not a must-copy blueprint. Implementations can organize their stuff however they want, as long as what they actually do on the wire matches what this document says ๐Ÿ’…

It only covers the Neighbor Discovery bits of host behavior. Stuff like picking a source address or choosing which outgoing interface to use on a multihomed host? Not here ๐Ÿ™…โ€โ™€๏ธ

5.1. Conceptual Data Structures ๐Ÿ’–

Every host needs to keep these four things for each interface:

  • Neighbor Cache ๐Ÿซถ
    • A set of entries about individual neighbors that traffic was recently sent to. Entries are keyed on the neighbor's on-link unicast IP address and hold stuff like its link-layer address, a flag saying whether the neighbor is a router or a host (we call this IsRouter in this doc), and a pointer to any queued packets waiting for address resolution to finish, etc.
    • Each entry also holds info for Neighbor Unreachability Detection: the reachability state, how many probes have gone unanswered, and when the next Neighbor Unreachability Detection event is scheduled.
  • Destination Cache ๐Ÿงญ
    • A set of entries about destinations that traffic was recently sent to. It covers both on-link and off-link destinations and acts as a little middleman into the Neighbor Cache. It maps a destination IP address to the IP address of the next-hop neighbor. This cache gets updated with info learned from Redirect messages.
    • Implementations can totally stash extra stuff that isn't really Neighbor Discovery in here, like the Path MTU (PMTU) and round trip timers that transport protocols keep ๐ŸŒˆ
  • Prefix List ๐ŸŒธ
    • A list of prefixes that define which addresses are on-link. These entries get created from info in Router Advertisements. Each one has an invalidation timer (pulled from the advertisement) that expires the prefix once it's no longer valid. There's a special "infinity" timer value meaning the prefix lasts forever, unless a newer finite value shows up in a later advertisement โณ
    • The link-local prefix is always on the list with an infinite invalidation timer, even if no router is advertising it. Received Router Advertisements SHOULD NOT modify the invalidation timer for the link-local prefix ๐Ÿ”’
  • Default Router List ๐Ÿ‘‘
    • A list of routers that packets can be sent to. These entries point into the Neighbor Cache, and the default router selection algorithm favors routers that are known to be reachable over ones whose reachability is kinda sus. Each entry also has an invalidation timer (from Router Advertisements) that deletes routers that aren't being advertised anymore ๐Ÿ—‘๏ธ

Okay but real talk, these structures can be built a bunch of different ways. One option is one big longest-match routing table for all of them ๐Ÿ—บ๏ธ No matter how you build it, it's critical that a router's Neighbor Cache entry gets shared by every Destination Cache entry that uses that router. Otherwise you'd end up sending redundant Neighbor Unreachability Detection probes, and nobody wants that ๐Ÿ™ˆ

Also, other protocols (like IPv6 Mobility) might add their own conceptual data structures. Implementations are free to build those however they like. For example, an implementation could squish all the conceptual data structures into one routing table ๐Ÿงš

The Neighbor Cache holds the info Neighbor Unreachability Detection uses, and the big thing in there is each neighbor's reachability state. There are five possible values. These descriptions are kinda informal, so for the precise definitions go to Section 7.3.2 ๐Ÿ“–

  • INCOMPLETE: Address resolution is in progress and the neighbor's link-layer address hasn't been figured out yet โณ
  • REACHABLE: Roughly speaking, the neighbor was known to be reachable recently, like within the last tens of seconds โœ…
  • STALE: The neighbor isn't known to be reachable anymore, but until traffic gets sent to it, nobody should bother trying to verify its reachability ๐Ÿ˜ด
  • DELAY: The neighbor isn't known to be reachable anymore, and traffic was just sent to it. Instead of probing right away, we wait a little bit so upper layer protocols get a chance to confirm reachability on their own ๐Ÿ™
  • PROBE: The neighbor isn't known to be reachable anymore, and unicast Neighbor Solicitation probes are being sent to check ๐Ÿ”

5.2. Conceptual Sending Algorithm ๐Ÿฆ‹

When a node sends a packet somewhere, it uses the Destination Cache, the Prefix List, and the Default Router List together to figure out the IP address of the right next hop. This is called "next-hop determination" ๐ŸŽฏ Once the next hop's IP address is known, the Neighbor Cache gets checked for that neighbor's link-layer info.

Here's how next-hop determination works for a unicast destination. 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. 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 ๐Ÿคทโ€โ™€๏ธ

Next-hop determination isn't run on every single packet, because that would be wasteful ๐Ÿ™ƒ Instead, the results get saved in the Destination Cache, which also takes in updates from Redirect messages. So when a node has a packet to send, it checks the Destination Cache first. If there's no entry for that destination, next-hop determination runs to make one.

Once the next hop's IP address is known, the sender looks in the Neighbor Cache for that neighbor's link-layer info. If there's no entry, 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 goes into the Neighbor Cache entry, and the queued packet finally gets sent ๐ŸŽ‰ The full address resolution mechanism is in Section 7.2.

For multicast packets, the next hop is always the multicast destination address, and it's considered on-link. The way to figure out the link-layer address for a given IP multicast address is in a separate document covering how IP runs over a particular link type, like [IPv6-ETHER] ๐Ÿ“š

Every time a Neighbor Cache entry gets accessed while sending a unicast packet, the sender checks its Neighbor Unreachability Detection info using the algorithm in Section 7.3. That check might end up with the sender sending a unicast Neighbor Solicitation to make sure the neighbor is still around ๐Ÿซข

Next-hop determination happens the first time traffic is sent to a destination. As long as communication keeps going smoothly, that Destination Cache entry keeps getting used. But if communication stops working, as Neighbor Unreachability Detection decides, next-hop determination might need to run again. For example, traffic going through a dead router should get moved over to a working one ๐Ÿš‘ It's also possible to reroute traffic meant for a mobile node through a "mobility agent" ๐Ÿงณ

When a node redoes next-hop determination, it doesn't have to throw out the whole Destination Cache entry. It's actually super useful to keep stuff like the PMTU and round trip timer values that might also live in that entry ๐Ÿ’…

Routers and multihomed hosts have multiple interfaces, so the rest of this document assumes that every Neighbor Discovery message being sent or received is tied to the right interface for its context. For example, when a router responds to a Router Solicitation, the Router Advertisement goes out the same interface the solicitation came in on โœจ

5.3. Garbage Collection and Timeout Requirements โœจ

okay so the conceptual data structures don't all clean up after themselves the same way ๐Ÿ’… Different mechanisms handle discarding stuff that might be stale or just sitting there unused.

From a correctness point of view, you don't need to periodically purge Destination and Neighbor Cache entries ๐Ÿงน Stale info can hang around forever, but Neighbor Unreachability Detection makes sure it gets purged fast the second anything actually tries to use it. iykyk ๐Ÿ’œ

Now, a node may need to garbage-collect old entries to keep storage under control ๐Ÿซง but it has to be careful, bestie. There must always be enough room for the working set of active entries. A tiny cache can cause a flood of Neighbor Discovery messages if entries keep getting thrown out and rebuilt in quick succession, and that's giving chaos ๐Ÿ’€ Any LRU-based policy that only reclaims entries that haven't been used in a while (e.g., ten minutes or more) should be adequate for cleaning up the unused ones ๐ŸŒธ

A node should keep entries in the Default Router List and the Prefix List until their lifetimes expire ๐ŸŽ€ Though a node may garbage collect entries early if it's running low on memory. And if not every router is kept on the Default Router List, a node should keep at least two entries (and preferably more) so connectivity to off-link destinations stays robust ๐Ÿฆ‹

When you remove an entry from the Prefix List, you don't need to purge anything from the Destination or Neighbor Caches. Neighbor Unreachability Detection will efficiently clear out any entries in those caches that have gone invalid โœจ Removing an entry from the Default Router List is different though ๐Ÿ‘€ Any Destination Cache entries that go through that router have to perform next-hop determination again so they can pick a new default router. main character energy for the replacement, no cap ๐Ÿ‘‘


6. ROUTER AND PREFIX DISCOVERY ๐Ÿงš

This section is all about how routers and hosts behave for the Router Discovery part of Neighbor Discovery. Router Discovery is how you find neighboring routers, and it's also how you learn prefixes and configuration parameters for address autoconfiguration ๐ŸŒˆ

Prefix Discovery is the process where hosts learn which ranges of IP addresses are on-link, meaning they 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, which is so efficient ๐Ÿ˜ญ In fact, the same prefixes can be advertised for both on-link determination and address autoconfiguration, just by setting the right flags in the Prefix Information options. For the full details on 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, 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 8 or more octets.
  • All included options have a length that is greater than zero.
  • If the IP source address is the unspecified address, there is no source link-layer address option in the message.

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, so keep an eye out ๐Ÿ‘€

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 ๐Ÿšซ

  • 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, 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 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 may specify the contents of the Reserved field or add new options, and backward-incompatible changes may use different Code values. Same energy as before, just for advertisements ๐Ÿ’œ

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 bestie, so a router MUST let system management configure the following conceptual variables ๐Ÿ’… The names are just for demo purposes. An implementation doesn't have to literally have them, as long as its external behavior matches what this doc describes ๐Ÿงš Defaults are included so config is easy in the common cases ๐Ÿ“

Some of the defaults below can be overridden by specific docs that explain how IPv6 works over different link layers ๐ŸŒˆ That's honestly so useful, because link types with wildly different performance need different settings ๐Ÿฆ‹

For each multicast interface:

  • AdvSendAdvertisements: a flag for whether the router sends periodic Router Advertisements and answers Router Solicitations ๐Ÿ“ฃ
    • Default: FALSE
    • Note that 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 max time allowed between 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 min time allowed between 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 of the Router Advertisement. See [ADDRCONF].
    • Default: FALSE
  • AdvOtherConfigFlag: the TRUE/FALSE value that goes in the "Other stateful configuration" flag field of the Router Advertisement. See [ADDRCONF].
    • Default: FALSE
  • AdvLinkMTU: the value placed in MTU options sent by the router. A value of zero means no MTU options get sent ๐Ÿซถ
    • Default: 0
  • AdvReachableTime: the value placed in the Reachable Time field of the Router Advertisements the router sends ๐Ÿ’œ The value zero means unspecified (by this router). MUST be no greater than 3,600,000 milliseconds (1 hour).
    • Default: 0
  • AdvRetransTimer: the value placed in the Retrans Timer field of the Router Advertisements the router sends. The value zero means unspecified (by this router).
    • Default: 0
  • AdvCurHopLimit: the default value placed in the Cur Hop Limit field of the Router Advertisements the router sends ๐Ÿงญ The value should be set to the current diameter of the Internet. The value 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 placed 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 be placed 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 placed in the Valid Lifetime in the Prefix Information option, in seconds. The designated value of all 1's (0xffffffff) represents infinity โ™พ๏ธ Implementations MUST allow AdvValidLifetime to be specified in two ways:
        • a time that decrements in real time, meaning one that results in a Lifetime of zero at the specified time in the future, or
        • a fixed time that stays the same in consecutive advertisements.
      • Default: 2592000 seconds (30 days), fixed (i.e., stays the same in consecutive advertisements).
      • AdvOnLinkFlag: the value placed 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, so here's the extra stuff ๐Ÿ‘‘

  • AdvPreferredLifetime: the value placed in the Preferred Lifetime in the Prefix Information option, in seconds. The designated value of all 1's (0xffffffff) represents infinity. See [ADDRCONF] for details on how this value is used. Implementations MUST allow AdvPreferredLifetime to be specified in two ways:
    • a time that decrements in real time, meaning one that results in a Lifetime of zero at a specified time in the future, or
    • a fixed time that stays the same in consecutive advertisements.
  • Default: 604800 seconds (7 days), fixed (i.e., stays the same in consecutive advertisements).
  • AdvAutonomousFlag: the value placed 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 take the info they receive and use it to set up their own analogous variables, which control their external behavior (see Section 6.3.2) ๐Ÿ’– Some of those host variables (e.g., CurHopLimit, RetransTimer, and ReachableTime) apply to all nodes, routers included. In practice these variables may not actually be present on routers, since their contents can be derived from the variables above. Still, external router behavior MUST be the same as host behavior with respect to these variables. That 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 ๐ŸŒˆ

okay so 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. Not me sending ads somewhere they're not allowed ๐Ÿ’€

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) while its AdvSendAdvertisements flag is TRUE, or
  • enabling IP forwarding capability (i.e., changing the system from being a host to being a router) while 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 that the Router Advertisements sent by neighboring routers are consistent. Main character energy for real ๐Ÿ‘‘โœจ

6.2.3. Router Advertisement Message Content โœจ

okay so bestie, a router sends periodic AND solicited Router Advertisements out of its advertising interfaces ๐Ÿ“ฃ๐Ÿฆ‹. the outgoing ones get filled up with these values, matching the message format from Section 4.2 (the vibe is very "organised girlie" ๐Ÿ’…):

  • 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: 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 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.

ngl this part is giving "fill in the form correctly" energy, and it's iconic ๐Ÿซถ.

A router might want to send Router Advertisements without advertising itself as a default router ๐Ÿ™ˆ. like, a router could advertise prefixes for address autoconfiguration while not wanting to forward packets. in that case it 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 much longer than AdvDefaultLifetime, including them every few advertisements may 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 information (e.g., 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 containing a subset of the options ๐ŸŒˆ.

6.2.4. Sending Unsolicited Router Advertisements ๐Ÿ’œ

A host MUST NOT send Router Advertisement messages at any time. bestie, hosts are NOT allowed to do this, period ๐Ÿ™…โ€โ™€๏ธ.

Unsolicited Router Advertisements are not strictly periodic ๐Ÿฆ‹. the gap between sends is randomized so that routers don't accidentally sync up with each other's advertisements on the same link [SYNC] โœจ. each advertising interface has its own timer. whenever a multicast advertisement goes out of an interface, the timer resets to a uniformly-distributed random value between the interface's configured MinRtrAdvInterval and MaxRtrAdvInterval. when the timer expires, the next advertisement is sent and a new random value gets picked ๐ŸŽ€.

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. a smaller interval at the start means a router gets discovered quicker when it first shows up, even if some packets get lost ๐Ÿซถ๐Ÿ”ฅ.

The information in Router Advertisements may change through system management actions ๐Ÿ’…. for instance, prefix lifetimes might change, new prefixes could be added, or a router could stop being a router (switching from router to host), etc. in those cases the router MAY send 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 may stop being an advertising interface through system management actions, 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 send 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 ๐Ÿ˜ญ. if the router is becoming 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) ๐Ÿ’”. on top of that, the host MUST make sure that subsequent Neighbor Advertisement messages sent from the interface have the Router flag set to zero ๐Ÿ™ˆ.

Note that system management may disable a router's IP forwarding capability (switching the system from router to host). that step does NOT necessarily mean the router's interfaces stop being advertising interfaces ๐Ÿ‘€. in those cases, 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 ๐Ÿคซ. hosts don't answer these at all, bestie.

Besides sending periodic unsolicited advertisements, 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 been sent (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 one advertisement is sent in response to multiple solicitations, the delay is measured from the first solicitation.) also, 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 ๐Ÿ“:

  • When a Router Solicitation arrives, compute a random delay within the range 0 through MAX_RA_DELAY_TIME. If the computed value lands later than the time the next multicast Router Advertisement is scheduled to go out, ignore the random delay and send 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 for MIN_DELAY_BETWEEN_RAS plus the random value after the previous advertisement was sent. this is how the multicast Router Advertisements stay 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 ๐Ÿ’–. but in all cases, unsolicited multicast advertisements MUST NOT be sent more often than MinRtrAdvInterval indicates ๐Ÿšซ.

Router Solicitations whose Source Address is the unspecified address MUST NOT update the router's Neighbor Cache ๐Ÿ™…โ€โ™€๏ธ. solicitations with a proper source address DO update the Neighbor Cache, like this: if the router already has a Neighbor Cache entry for the solicitation's sender, the solicitation contains a Source Link-Layer Address option, and the received link-layer address differs from the one already cached, the link-layer address SHOULD be updated in that entry, and its reachability state MUST also be set to STALE ๐Ÿ”„. if there's no existing entry for the sender, the router creates one, installs the link-layer address, and sets its reachability state to STALE as specified in Section 7.3.3 ๐ŸŽ€. whether or not a Source Link-Layer Address option is provided, if a Neighbor Cache entry for the sender exists (or gets created), the entry's IsRouter flag MUST be set to FALSE ๐Ÿ’….

6.2.7. Router Advertisement Consistency ๐Ÿ‘‘

Routers SHOULD inspect valid Router Advertisements sent by other routers and check that they're advertising consistent information on a link ๐Ÿ”. detected inconsistencies suggest one or more routers might be misconfigured, and they SHOULD be logged to system or network management ๐Ÿ“. the minimum set of information 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. If AdvPreferredLifetime and/or AdvValidLifetime decrement in real time as specified in section 6.2.7, then the comparison of the lifetimes cannot compare the contents of the fields in the Router Advertisement, but must instead compare the time at which the prefix will become deprecated and invalidated, respectively. because of link propagation delays and potentially poorly synchronized clocks between routers, such comparisons SHOULD allow some time skew โณ.

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 (i.e., with the value zero) while other routers specify values. 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 on reception of Router Advertisement messages by a router is beyond the scope of this document ๐Ÿซถ.

okay so the link-local address on a router SHOULD change rarely, if ever ๐Ÿซถ nodes receiving Neighbor Discovery messages use the source address to figure out who sent it ๐Ÿ‘€ if multiple packets from the same router show up with different source addresses, nodes will assume they came from different routers and things get messy ๐Ÿ˜ญ like, a node will ignore Redirect messages that it thinks came from a router other than the current first-hop router ๐Ÿ’€ so the source address in Router Advertisements sent by a particular router must be identical to the target address in a Redirect message when redirecting to that router. no cap, it has to match ๐Ÿ’…

using the link-local address to uniquely identify routers on the link is iconic because 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 ceases being an advertising interface and a different one starts being an advertising interface โœจ periodt


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, as long as its external behavior matches 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's 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, which is so smart ๐Ÿ”ฅ

for each interface:

  • LinkMTU: the MTU of the link. Default: the value 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 so when there are multiple routers on the link, the info they advertise together might be a superset of what any single Router Advertisement carries ๐ŸŒธ. info can also come from other dynamic stuff, like stateful autoconfiguration ๐Ÿงš. hosts accept the union of ALL the received info, and a new Router Advertisement MUST NOT invalidate everything from a previous advertisement or from another source ๐Ÿ’…. BUT if a specific parameter (like Link MTU) or option (like Lifetime on a specific Prefix) comes in with a different value than before, and it can only have one value, the most recently-received info is the authoritative one ๐Ÿ‘‘.

Some Router Advertisement fields (like Cur Hop Limit, Reachable Time and Retrans Timer) can 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. and a host MUST NOT interpret the unspecified value as meaning "change back to the default value that was in use before the first Router Advertisement was received." this rule is lowkey genius because it stops hosts from constantly flip-flopping an internal variable when one router says a specific value and the others 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 is not already in the host's Default Router List, and the advertisement's Router Lifetime is non-zero, create 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 value is zero, immediately time-out the entry as specified in Section 6.3.5 ๐Ÿ’€.

To limit the storage needed for the Default Router List, a host MAY choose not to store all of the router addresses it discovers through advertisements ๐Ÿ“. however, a host MUST retain at least two router addresses, and it SHOULD retain more. default router selections happen whenever communication to a destination appears to be failing, so the more routers on the list, the more likely an alternative working router can be found quickly (for example, without having to wait for the next advertisement to arrive) ๐Ÿƒโ€โ™€๏ธ๐Ÿ’จ.

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 the reason Neighbor Unreachability Detection messages can't end up synchronizing with each other ๐ŸŒˆ.

In most cases the advertised Reachable Time value stays the same across consecutive Router Advertisements, and a host's BaseReachableTime rarely changes. so 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 gets scanned for valid options ๐Ÿ”. if it has a Source Link-Layer Address option, the link-layer address SHOULD be recorded in the Neighbor Cache entry for the router (creating the entry if necessary), and the IsRouter flag in that entry MUST be set to TRUE ๐Ÿ’–. if no Source Link-Layer Address is included but a matching Neighbor Cache entry already exists, its IsRouter flag MUST be set to TRUE too ๐Ÿซถ. the IsRouter flag is how Neighbor Unreachability Detection figures 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 ๐ŸŒธ. and if an existing cache entry 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, so long as the value is greater than or equal to the minimum link MTU [IPv6] and does NOT exceed 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 indicate a prefix that identifies a range of addresses which should be considered on-link ๐ŸŒ. BUT, a Prefix Information option with the on-link flag set to zero conveys NO information about on-link determination, and it MUST NOT be interpreted to mean that the addresses covered by the prefix are off-link ๐Ÿ™…โ€โ™€๏ธ. the ONLY way to cancel a previous on-link indication is to advertise that prefix with the L-bit set and the Lifetime set to zero ๐Ÿงน. the default behavior (see Section 5.2) when sending a packet to an address with no info about its on-link status is to forward the packet to a default router, and receiving a Prefix Information option with the "on-link" (L) flag set to zero does not change that behavior ๐Ÿš€. 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 is not already in the Prefix List, and the Prefix Information option's Valid Lifetime field is non-zero, create 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-out the prefix immediately (see Section 6.3.5) ๐Ÿ’€.
  • If the Prefix Information option's Valid Lifetime field is zero, and the prefix is NOT in the host's Prefix List, silently ignore the option ๐Ÿ˜Œ.

Stateless address autoconfiguration [ADDRCONF] may, in some circumstances, increase the Valid Lifetime of a prefix or ignore it completely, to prevent one particular denial of service attack ๐Ÿ›ก๏ธ. but since the same denial of service aimed at the on-link prefix list isn't catastrophic (hosts would just send packets to a default router and get a redirect, instead of sending packets straight to a neighbor), the Neighbor Discovery protocol does NOT impose that kind of check on prefix lifetime values ๐Ÿฆ‹.

Note: Implementations can choose to process the on-link aspects of the prefixes separately from the address autoconfiguration aspects of the prefixes by, e.g., passing a copy of each valid Router Advertisement message to both an "on-link" and an "addrconf" function. each function can then operate independently on the prefixes that have the appropriate flag set. ๐Ÿงฉ๐Ÿ’…

6.3.5. Timing out Prefixes and Default Routers ๐Ÿ’€

Whenever the invalidation timer expires for a Prefix List entry, that entry is discarded ๐Ÿ—‘๏ธ. no existing Destination Cache entries need to be updated, though. if a reachability problem comes up with an existing Neighbor Cache entry, Neighbor Unreachability Detection will handle any needed recovery ๐Ÿ› ๏ธ.

Whenever the Lifetime of an entry in the Default Router List expires, that entry is discarded โŒ›. when removing a router from the Default Router List, the node MUST update the Destination Cache so that all entries using that router perform 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 appears to be failing ๐Ÿ†˜. under normal conditions, a router gets selected the first time traffic is sent to a destination, and later traffic for that destination keeps using the same router (as shown in the Destination Cache), unless Redirect messages change the Destination Cache ๐Ÿ”.

The policy for selecting 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 with no Neighbor Cache entry at all) โœจ. an implementation may choose to always return the same router, or to cycle through the router list in a round-robin fashion, as long as it always returns a reachable or probably reachable router whenever one is available ๐ŸŽ .
  2. When NO 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 selected ๐ŸŒ€. cycling through the list in this case makes sure all available routers get actively probed by the Neighbor Unreachability Detection algorithm ๐Ÿ”ฌ. a request for a default router happens alongside 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 bestie, when an interface turns on ๐Ÿ”Œโœจ, a host might not want to sit around waiting for the next unsolicited Router Advertisement just to find its default routers or learn prefixes ๐Ÿ’…. So to get Router Advertisements fast, a host SHOULD send up to MAX_RTR_SOLICITATIONS Router Solicitation messages, each one separated by at least RTR_SOLICITATION_INTERVAL seconds ๐Ÿฆ‹. Router Solicitations can go out 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 gets 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 not the unspecified address ๐ŸŒธ.

Before a host sends its first solicitation, it SHOULD wait a random amount of time between 0 and MAX_RTR_SOLICITATION_DELAY ๐ŸŽ€. This helps ease congestion when a bunch of hosts start up on a link at the same time, like after recovering from a power failure โšก. 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's 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 stop sending more solicitations on that interface, until the next time one of the events above happens ๐Ÿ›‘. Also, a host SHOULD send at least one solicitation if an advertisement shows up before it has sent one ๐Ÿ’œ. Unsolicited Router Advertisements may be incomplete (see Section 6.2.3), while solicited advertisements are expected to contain complete information ๐Ÿงš.

If a host sends MAX_RTR_SOLICITATIONS solicitations and gets no Router Advertisements after waiting MAX_RTR_SOLICITATION_DELAY seconds past the last solicitation, the host concludes that there are no routers on the link for the purpose of [ADDRCONF] ๐Ÿ˜ญ. Still, the host keeps receiving and processing Router Advertisement messages in case routers show up on the link later ๐Ÿ‘€.


7. ADDRESS RESOLUTION AND NEIGHBOR UNREACHABILITY DETECTION โœจ

This section covers the stuff related to Neighbor Solicitation and Neighbor Advertisement messages, including address resolution and the Neighbor Unreachability Detection algorithm ๐Ÿฆ‹.

Neighbor Solicitation and Advertisement messages are also used for Duplicate Address Detection as specified by [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 with a multicast Neighbor Advertisement saying the address is in use, so it's giving "not you, that's mine" ๐Ÿ™…โ€โ™€๏ธ.

7.1. Message Validation

7.1.1. Validation of Neighbor Solicitations

A node MUST silently discard any received Neighbor Solicitation message that doesn't 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.
  • 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.
  • If the IP source address is the unspecified address, the IP destination address is a solicited-node multicast address.
  • If the IP source address is the unspecified address, there is no source link-layer address option in the message.

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

The contents of any defined options that aren't specified to be used with Neighbor 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 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 doesn't 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.
  • 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 to the protocol may specify what the Reserved field contains or add new options ๐ŸŒˆ. Backward-incompatible changes may use different Code values ๐Ÿ’€.

The contents of any defined options that aren't specified to be used with Neighbor Advertisement messages MUST be ignored, and the packet gets 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 how a node figures out the link-layer address of a neighbor when all it has is that neighbor's IP address ๐Ÿ—บ๏ธ. It only happens for addresses that are determined to be on-link and where the sender doesn't already 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 for each of the IP addresses assigned to the interface ๐ŸŒธ.

The set of addresses on an interface can change over time, since new addresses might get added and old ones might get removed [ADDRCONF] ๐Ÿ”„. In those cases, the node MUST join and leave the solicited-node multicast addresses for the new and old addresses, respectively ๐ŸŽ€. Heads up: multiple unicast addresses can map into the same solicited-node multicast address, so a node MUST NOT leave that solicited-node multicast group until every assigned address mapping to it has been removed ๐Ÿ™…โ€โ™€๏ธ.

7.2.2. Sending Neighbor Solicitations

When a node has a unicast packet for a neighbor but doesn't know the neighbor's link-layer address, it does 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 goes to the solicited-node multicast address that matches the target address ๐Ÿ“ฌ.

If the source address of the packet that prompted 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 stores the IP address that's most likely to be used in later return traffic for that packet's "connection" ๐Ÿง โœจ.

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 to send the Neighbor Advertisement to ๐Ÿซถ. On unicast solicitations, an implementation MAY omit the Source Link-Layer Address option ๐Ÿ™Œ. The thinking here is that if the sender already has a peer's link-layer address in its cache, there's a high chance the peer also has an entry for the sender in its cache, so it doesn't need to be sent ๐Ÿฆ‹.

While waiting for address resolution to finish, the sender MUST keep a small queue of packets for each neighbor ๐Ÿ“ฆ. The queue MUST hold at least one packet, and MAY hold more ๐ŸŒˆ. The number of queued packets per neighbor SHOULD still be limited to some small value ๐Ÿค. When a queue overflows, the new arrival SHOULD replace the oldest entry ๐Ÿ”. Once address resolution completes, the node sends whatever packets are queued ๐Ÿš€.

While it waits for a response, the sender SHOULD retransmit Neighbor Solicitation messages approximately every RetransTimer milliseconds, even if 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 while waiting for address resolution ๐Ÿ˜ญ.

7.2.3. Receipt of Neighbor Solicitations โœจ

okay so when a Neighbor Solicitation shows up, the receiving node has to check if it's actually for it ๐Ÿ‘€ a valid Neighbor Solicitation that doesn't meet any of the following requirements MUST be silently discarded ๐Ÿ’€

  • The Target Address is a "valid" unicast or anycast address assigned to the receiving interface [ADDRCONF],
  • The Target Address is a unicast address for which the node is offering proxy service, or
  • The Target Address is a "tentative" address on which Duplicate Address Detection is being performed [ADDRCONF].

if the Target Address is tentative, the Neighbor Solicitation should be processed as described in [ADDRCONF] ๐Ÿงš otherwise, the following description applies. if the Source Address is not the unspecified address and, on link layers that have addresses, the solicitation includes a Source Link-Layer Address option, then the recipient SHOULD create or update the Neighbor Cache entry for the IP Source Address of the solicitation ๐Ÿซถ if an entry doesn't already exist, the node SHOULD create a new one and set its reachability state to STALE as specified in Section 7.3.3. if an entry does already exist, and the cached link-layer address differs from the one in the received Source Link-Layer option, the cached address should be replaced by the received address and the entry's reachability state MUST be set to STALE ๐Ÿ”ฅ

if a Neighbor Cache entry is created, the IsRouter flag SHOULD be set to FALSE ๐ŸŒธ this is the case even if the Neighbor Solicitation is sent by a router, since Neighbor Solicitation messages don't say whether or not the sender is a router ๐Ÿ™ˆ if the sender is a router, subsequent Neighbor Advertisement or Router Advertisement messages will set the correct IsRouter value โœจ if a Neighbor Cache entry already exists, its IsRouter flag MUST NOT be modified ๐Ÿ”’

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

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 this one is giving reply energy ๐Ÿ’– a node sends a Neighbor Advertisement in response to a valid Neighbor Solicitation targeting one of the node's assigned addresses โœจ the Target Address of the advertisement is copied from the Target Address of the solicitation. if the solicitation's IP Destination Address is not a multicast address, the Target Link-Layer Address option MAY be omitted ๐Ÿฆ‹ the neighboring node's cached value must already be current, because otherwise the solicitation wouldn't have been received ๐Ÿง  if the solicitation's IP Destination Address is a multicast address, the Target Link-Layer option MUST be included in the advertisement ๐Ÿ™Œ and furthermore, if the node is a router, it MUST set the Router flag to one; otherwise it MUST set the flag to zero ๐Ÿ‘‘

if the Target Address is either an anycast address or a unicast address for which the node is providing proxy service, or the Target Link-Layer Address option is not included, the Override flag SHOULD be set to zero ๐Ÿ“ otherwise, the Override flag SHOULD be set to one ๐Ÿ’œ proper setting of the Override flag makes sure nodes give preference to non-proxy advertisements, even when they're received after proxy advertisements ๐Ÿ˜ญ it also makes sure 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 ๐Ÿ’Œ

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 โณ

because unicast Neighbor Solicitations are not required to include a Source Link-Layer Address, it's possible that a node sending a solicited Neighbor Advertisement doesn't have a matching link-layer address for its neighbor in its Neighbor Cache ๐Ÿฅบ in that situation, a node will first have to use Neighbor Discovery to figure out the link-layer address of its neighbor (i.e., send out a multicast Neighbor Solicitation) ๐Ÿ”

7.2.5. Receipt of Neighbor Advertisements ๐Ÿ“ฌ

when a valid Neighbor Advertisement comes in (either solicited or unsolicited), the Neighbor Cache is searched for the target's entry ๐Ÿ”Ž if no entry exists, the advertisement SHOULD be silently discarded ๐Ÿ—‘๏ธ there's no need to create an entry if none exists, since the recipient apparently hasn't started any communication with the target ๐Ÿ™…โ€โ™€๏ธ

once the right Neighbor Cache entry has been found, the specific actions depend on the state of that entry, the flags in the advertisement, and the actual link-layer address supplied ๐Ÿงฉ

if the target's Neighbor Cache entry is in the INCOMPLETE state when the advertisement is received, one of two things happens ๐Ÿ˜ณ if the link layer has addresses and no Target Link-Layer address option is included, the receiving node SHOULD silently discard the received advertisement ๐Ÿ’€ otherwise, the receiving node does the following steps:

  • It records the link-layer address in the Neighbor Cache entry.
  • If the advertisement's Solicited flag is set, the state of the entry is set to REACHABLE; otherwise it is set to STALE.
  • It sets the IsRouter flag in the cache entry based on the Router flag in the received advertisement.
  • It sends any packets queued for the neighbor that were awaiting address resolution.

note that the Override flag is ignored if the entry is in the INCOMPLETE state ๐Ÿ™ƒ

if the target's Neighbor Cache entry is in any state other than INCOMPLETE when the advertisement is received, things get a lot more complex ๐ŸŒ€ if the Override flag is clear and the supplied link-layer address differs from the one in the cache, then one of two actions takes place: if the state of the entry is REACHABLE, set it to STALE, but don't update the entry in any other way; otherwise, the received advertisement should be ignored and MUST NOT update the cache ๐Ÿšซ if the Override flag is set, or the Override flag is clear and the supplied link-layer address is the same as the one in the cache, or no Target Link-Layer address option was supplied, the received advertisement MUST update the Neighbor Cache entry as follows:

  • The link-layer address in the Target Link-Layer Address option MUST be inserted in the cache (if one is supplied and it's different from the address already recorded) ๐Ÿ“
  • If the Solicited flag is set, the state of the entry MUST be set to REACHABLE. If the Solicited flag is zero and the link-layer address was updated with a different address, the state MUST be set to STALE. Otherwise, the entry's state stays unchanged ๐Ÿซง

an advertisement's Solicited flag should only be set if the advertisement is a response to a Neighbor Solicitation ๐Ÿ’– because Neighbor Unreachability Detection Solicitations are sent to the cached link-layer address, receiving a solicited advertisement tells you the forward path is working โœ… receiving an unsolicited advertisement, though, suggests that a neighbor has urgent news to share (e.g., a changed link-layer address) ๐Ÿ“ฃ if the urgent info means a change from what a node is currently using, the node should verify the reachability of the (new) path when it sends the next packet ๐Ÿ›ฃ๏ธ there's no need to update the state for unsolicited advertisements that don't change the contents of the cache ๐Ÿ™…โ€โ™€๏ธ

the IsRouter flag in the cache entry MUST be set based on the Router flag in the received advertisement ๐Ÿ‘‘ in cases where the IsRouter flag changes from TRUE to FALSE as a result of this update, the node MUST remove that router from the Default Router List and update the Destination Cache entries for all destinations using that neighbor as a router, as specified in Section 7.3.3 ๐Ÿงน this is needed to detect when a node that's used as a router stops forwarding packets because it's been configured as a host ๐Ÿ–ฅ๏ธ

the rules above make sure the cache gets updated either when the Neighbor Advertisement takes precedence (i.e., the Override flag is set), or when the Neighbor Advertisement refers to the same link-layer address that's already recorded in the cache ๐ŸŽฏ if none of the above apply, the advertisement prompts future Neighbor Unreachability Detection (if it isn't already in progress) by changing the state in the cache entry ๐Ÿ”„

7.2.6. Sending Unsolicited Neighbor Advertisements ๐Ÿ“ข

sometimes a node can tell that its link-layer address has changed (e.g., a hot-swapped interface card) ๐Ÿ”ง and it might want to tell its neighbors about the new link-layer address quickly ๐Ÿƒโ€โ™€๏ธ๐Ÿ’จ in those cases, 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 is filled with the new link-layer address ๐Ÿชช the Solicited flag MUST be set to zero, so it doesn't confuse the Neighbor Unreachability Detection algorithm ๐Ÿ™…โ€โ™€๏ธ 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 change the state of their Neighbor Cache entries for the Target Address to STALE, which prompts them to verify the path for reachability ๐Ÿ›ค๏ธ if the Override flag is set to one, neighboring nodes will install the new link-layer address in their caches ๐Ÿ’ซ otherwise, they'll ignore the new link-layer address and probe the cached address instead ๐Ÿ”

a node that has 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 sending each advertisement to lower the chance of the advertisements getting 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 several nodes are providing proxy services for the same set of addresses, the proxies SHOULD provide a mechanism that stops multiple proxies from multicasting advertisements for any one address, to cut down the risk of excessive multicast traffic ๐Ÿšฆ

also, a node belonging to an anycast address MAY multicast unsolicited Neighbor Advertisements for the anycast address when the node's link-layer address changes ๐ŸŒˆ

note that because unsolicited Neighbor Advertisements don't reliably update caches in every node (the advertisements might not reach all nodes), they should only be viewed as a performance optimization that quickly updates the caches in most neighbors โšก the Neighbor Unreachability Detection algorithm makes sure all nodes end up with a reachable link-layer address, even though the delay may be a bit longer ๐Ÿฅฐ

7.2.7. Anycast Neighbor Advertisements โœจ

Okay, so from Neighbor Discovery's point of view, anycast addresses are basically treated like unicast addresses, most of the time ๐Ÿ’…. An anycast address is syntactically the same as a unicast address, so when nodes do address resolution or Neighbor Unreachability Detection on one, they just treat it like a unicast address. No special processing happens ๐Ÿฆ‹.

Nodes with an anycast address assigned to an interface treat it exactly like 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 show up, the first one received gets used instead of the most recent one ๐ŸŽ€.

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 act as a proxy for one or more other nodes. Basically, through Neighbor Advertisements, it says it's willing to accept packets that aren't 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 by proxy are identical to the ones used with anycast addresses, so it's giving dรฉjร  vu ๐Ÿ’œ.

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. Here's why it's so iconic: if the node itself is present on the link, its own Neighbor Advertisement (with the Override flag set to one) will take 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 so may cause the proxy advertisement to override a valid entry the node created itself, so it's a bit of a risky move ๐Ÿ’€.

Finally, when sending a proxy 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, bestie, communication to or through a neighbor can fail for a bunch of reasons at any time, like hardware failure or someone hot-swapping an interface card ๐Ÿ˜ญ. If the destination itself has failed, no recovery is possible and the communication just fails. But if it's the path that broke, recovery might be possible ๐Ÿซถ. So a node actively tracks the reachability "state" for the neighbors it's sending packets to. Main character energy, honestly ๐Ÿ’….

Neighbor Unreachability Detection is used for all paths between hosts and neighboring nodes, including host-to-host, host-to-router, and router-to-host communication ๐ŸŒธ. It may also be used between routers, but it's not required if an equivalent mechanism is available, for example, as part of the routing protocols ๐ŸŽ€.

When a path to a neighbor looks like it's failing, the recovery depends on how that neighbor is being used ๐Ÿงš. If the neighbor is the ultimate destination, address resolution should be performed again. If the neighbor is a router, though, switching to another router would be the move ๐Ÿ”ฅ. The specific recovery is covered under next-hop determination. Neighbor Unreachability Detection signals the need for next-hop determination by deleting a Neighbor Cache entry ๐Ÿ’œ.

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

7.3.1. Reachability Confirmation ๐ŸŒˆ

A neighbor is considered reachable if the node has recently received a confirmation that packets it sent recently were received by the neighbor's IP layer โœจ. There are two ways to get that positive confirmation: hints from upper-layer protocols showing a connection is making "forward progress", or receipt of a Neighbor Advertisement that responds to a Neighbor Solicitation ๐Ÿฆ‹.

A connection makes "forward progress" if the packets received from a remote peer can only be arriving if recent packets sent to that peer are actually reaching it. In TCP, for example, receiving a (new) acknowledgement means previously sent data reached the peer ๐Ÿ’–. Likewise, new (non-duplicate) data arriving means earlier acknowledgements are getting delivered to the remote peer. If packets are reaching the peer, they must also be reaching the sender's next-hop neighbor, so "forward progress" confirms that the next-hop neighbor is reachable ๐Ÿ‘‘. For off-link destinations, forward progress implies 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, reachability information may not be readily available from upper-layer protocols ๐Ÿฅบ. When no hints are available and a node is sending packets to a neighbor, the node actively probes the neighbor using unicast Neighbor Solicitation messages to verify the forward path is still working ๐Ÿ”.

A solicited Neighbor Advertisement serves as reachability confirmation, since advertisements with the Solicited flag set to one are only sent in response to a Neighbor Solicitation ๐ŸŽ€. Receipt of other Neighbor Discovery messages, like Router Advertisements and Neighbor Advertisements with the Solicited flag set to zero, MUST NOT be treated as a reachability confirmation ๐Ÿ™…โ€โ™€๏ธ. Receipt of unsolicited messages only confirms the one-way path from the sender to the recipient node. Neighbor Unreachability Detection, on the other hand, requires that a node keep track of the reachability of the forward path to a neighbor from its perspective, not the neighbor's ๐Ÿ’….

Note that receiving a solicited advertisement means the path is working in both directions ๐Ÿฆ‹. The solicitation must have reached the neighbor, prompting it to generate an advertisement. Likewise, receiving an advertisement means the path from the sender to the recipient is working. However, the latter fact is only known to the recipient. The advertisement's sender has no direct way of knowing the advertisement it sent 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, and the lineup is iconic ๐Ÿ‘‘:

   INCOMPLETE  Address resolution is being performed on the entry.
               Specifically, a Neighbor Solicitation has been sent to
               the solicited-node multicast address of the target,
               but the corresponding Neighbor Advertisement has not
               yet been received.

   REACHABLE   Positive confirmation was received within the last
               ReachableTime milliseconds that the forward path to
               the neighbor was functioning properly.  While
               REACHABLE, no special action takes place as packets
               are sent.

   STALE       More than ReachableTime milliseconds have elapsed
               since the last positive confirmation was received that
               the forward path was functioning properly.  While
               stale, no action takes place until a packet is sent.

               The STALE state is entered upon receiving an
               unsolicited Neighbor Discovery message that updates
               the cached link-layer address.  Receipt of such a
               message does not confirm reachability, and entering
               the STALE state insures reachability is verified
               quickly if the entry is actually being used.  However,
               reachability is not actually verified until the entry
               is actually used.

   DELAY       More than ReachableTime milliseconds have elapsed
               since the last positive confirmation was received that
               the forward path was functioning properly, and a
               packet was sent within the last DELAY_FIRST_PROBE_TIME
               seconds.  If no reachability confirmation is received
               within DELAY_FIRST_PROBE_TIME seconds of entering the
               DELAY state, send a Neighbor Solicitation and change
               the state to PROBE.

               The DELAY state is an optimization that gives upper-
               layer protocols additional time to provide
               reachability confirmation in those cases where
               ReachableTime milliseconds have passed since the last
               confirmation due to lack of recent traffic.  Without
               this optimization the opening of a TCP connection
               after a traffic lull would initiate 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.

7.3.3. Node Behavior ๐Ÿฆ‹

okay so Neighbor Unreachability Detection runs in parallel with sending packets to a neighbor, bestie ๐Ÿงš while a node is reasserting that a neighbor is reachable, it keeps sending packets using the cached link-layer address, no cap. and if no traffic is going to a neighbor, no probes get sent. lowkey the most efficient vibe ever ๐Ÿ’…

when a node needs to do address resolution on 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 the next-hop determination procedure again. that re-check is what makes sure alternate default routers get tried ๐Ÿซถ

when a reachability confirmation shows up (either from upper-layer advice or a solicited Neighbor Advertisement), the entry's state changes to REACHABLE ๐ŸŒธ the one exception is that upper-layer advice does nothing to entries in the INCOMPLETE state (for example, the ones with no cached link-layer address), so don't even try ๐Ÿ™ˆ

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 defer changing the state from REACHABLE to STALE until a packet is sent to the neighbor, i.e., there need not be an explicit timeout event associated with the expiration of ReachableTime.

the first time a node sends a packet to a neighbor whose entry is STALE, the sender switches the state to DELAY and starts a timer to expire in DELAY_FIRST_PROBE_TIME seconds ๐ŸŽ€ if the entry is still in DELAY when that timer goes off, the state changes to PROBE. if reachability confirmation comes in, the state changes to REACHABLE.

when a node enters the PROBE state, it sends a unicast Neighbor Solicitation message to the neighbor using the cached link-layer address ๐Ÿ“จ while it's in PROBE, the node retransmits Neighbor Solicitation messages every RetransTimer milliseconds until reachability confirmation is obtained. the probes get retransmitted even if no other packets are going to the neighbor, periodt ๐Ÿ’œ if there's no response after waiting RetransTimer milliseconds following the MAX_UNICAST_SOLICIT solicitations, the retransmissions stop and the entry SHOULD be deleted. the next traffic to that neighbor will recreate the entry and do address resolution again ๐Ÿ”

fyi, all Neighbor Solicitations are rate-limited on a per-neighbor basis ๐Ÿšฆ a node MUST NOT send Neighbor Solicitations to the same neighbor more often than once every RetransTimer milliseconds. no spamming, bestie ๐Ÿ™…โ€โ™€๏ธ

a Neighbor Cache entry enters the STALE state when it's created because of receiving packets other than solicited Neighbor Advertisements (so Router Solicitations, Router Advertisements, Redirects, and Neighbor Solicitations) ๐Ÿ“ those packets carry the link-layer address of either the sender or, for a Redirect, the redirection target. BUT getting those link-layer addresses does NOT confirm that the forward-direction path to that node works. ngl that's the twist ๐Ÿ˜ญ still, putting a newly created entry (with a known link-layer address) into STALE makes sure path failures get caught quickly โšก and if a cached link-layer address gets modified because one of those messages arrived, the state SHOULD also be set to STALE, so the path to the new link-layer address gets verified promptly ๐Ÿ”

to properly catch a router that turns into a host (say its IP forwarding capability gets switched off by system management), a node MUST compare the Router flag field in every received Neighbor Advertisement message with the IsRouter flag stored in the Neighbor Cache entry ๐Ÿ‘€ when a node sees that a neighbor went 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. heads up: a router might not be on the Default Router List even though a Destination Cache entry is still using it (like when a host got redirected to it). in those cases, every Destination Cache entry referencing the (former) router has to run next-hop determination again before it gets used ๐Ÿ”„

sometimes link-specific information says a path to a neighbor has failed (like when a virtual circuit gets reset) ๐Ÿ”Œ in those situations, that info can be used to purge Neighbor Cache entries before Neighbor Unreachability Detection would have done it. however, link-specific information MUST NOT be used to confirm the reachability of a neighbor, because it doesn't give end-to-end confirmation between neighboring IP layers. not it ๐Ÿ™…โ€โ™€๏ธ


8. REDIRECT FUNCTION ๐Ÿ’…

this section covers the functions for sending and processing Redirect messages ๐Ÿ“ฌ

Redirect messages get sent by routers to redirect a host to a better first-hop router for a specific destination, or to tell hosts that a destination is actually a neighbor (aka on-link) ๐ŸŒˆ the second one happens when the ICMP Target Address equals the ICMP Destination Address โœจ

a router MUST be able to figure out the link-local address of each of its neighboring routers ๐Ÿงญ that's so the target address in a Redirect message identifies the neighbor router by its link-local address. for static routing, this means the next-hop router's address should be specified using that router's link-local address. for dynamic routing, it means all IPv6 routing protocols must 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 these validity checks:

  • 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 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, while backward-incompatible changes may use different Code values. that's the plan, and it's giving future-proof ๐Ÿ”ฎ

the contents of any defined options that aren't specified for use 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 of the redirect isn't covered by one of the link's prefixes ๐Ÿ™…โ€โ™€๏ธ part of what a Redirect message means is that the Target Address is on-link, so that's expected, periodt.

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 1280 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 when the source doesn't correctly respond to the Redirects, or 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 only send these, they never act on them. iconic restraint, honestly ๐Ÿ’…

8.3. Host Specification ๐Ÿ’–

okay bestie, when a host gets a valid redirect it SHOULD update its Destination Cache so the next packets go to the target it was told about ๐Ÿงš. if there's no Destination Cache entry for that destination yet, the implementation SHOULD make one โœจ

if the redirect has a Target Link-Layer Address option, the host either creates or updates the Neighbor Cache entry for the target ๐ŸŽ€. either way, the cached link-layer address gets copied from that option. if the Neighbor Cache entry is brand new, its reachability state MUST be set to STALE, as described in Section 7.3.3 ๐Ÿ’…. if the entry already existed and the address is different, its reachability state MUST also be set to STALE ๐Ÿ˜ญ. if the link-layer address matches what's already cached, the state just stays the same, no drama ๐ŸŒธ

if the Target and Destination Addresses are the same, the host MUST treat the Target as on-link ๐Ÿฆ‹. if they're different, the host MUST set IsRouter to TRUE for the target ๐Ÿ‘‘. but when the two addresses match, you can't reliably tell whether the Target is a router, so newly created Neighbor Cache entries should set the IsRouter flag to FALSE, and existing cache entries should leave the flag alone ๐Ÿ™ˆ. if the Target really is a router, later Neighbor Advertisement or Router Advertisement messages will update IsRouter for it โญ

redirects apply to every flow going to a given destination ๐ŸŒˆ. so when a Redirect comes in for a Destination Address, all Destination Cache entries to that address should be updated to use the new next-hop, no matter what the Flow Label field in the Redirected Header option says ๐Ÿ’œ

a host MAY have a configuration switch that makes it ignore any Redirect message that doesn't have an IP Authentication header ๐Ÿ”ฅ

a host MUST NOT send Redirect messages. period. not me ๐Ÿ’€


9. EXTENSIBILITY - OPTION PROCESSING โœจ

options are how we encode variable-length fields, fields that can show up more than once in the same packet, or info that doesn't appear in every packet ๐Ÿ“. they can also add new functionality to future versions of ND, which is so iconic ๐Ÿ‘‘

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 ๐Ÿซถ. all options specified in this document MUST be recognized. a node MUST NOT ignore valid options just because the ND message also has unrecognized ones ๐Ÿ’…

the current options are designed so receivers can process multiple options in the same packet independently of each other ๐Ÿฆ‹. to keep that vibe in future options, they 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 has some seriously good perks ๐ŸŽ€:

  1. receivers can process options independently of one another. like, an implementation can handle the Prefix Information option in a Router Advertisement in a user-space process while the link-layer address option in that same message gets handled by kernel routines ๐Ÿงš
  2. if the number of options would push a packet past 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 example, if a prefix's Valid and Preferred Lifetimes are high enough, the Prefix Information option doesn't have to be in every Router Advertisement ๐ŸŒˆ. also, different routers might 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's actually received in the packets โญ

options in Neighbor Discovery packets can show up in any order, and receivers MUST be ready to process them independently of their order ๐Ÿซถ. there can also be multiple instances of the same option in a message, like Prefix Information options โœจ

if the options in a Router Advertisement make the advertisement's size go over the link MTU, the router can send multiple separate advertisements, each with a subset of the options ๐Ÿฆ‹

the amount of data in the Redirected Header option MUST be limited so the entire redirect packet doesn't exceed 1280 octets ๐Ÿ”ฅ

every option is a multiple of 8 octets long, so alignment is handled without any "pad" options ๐ŸŽ€. the fields in options (and in ND packets) line up on their natural boundaries, so a 16-bit field sits on a 16-bit boundary. the exception is the 128-bit IP addresses/prefixes, which line up on a 64-bit boundary ๐Ÿ’œ. the link-layer address field is just an uninterpreted octet string, 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 1280 octets). when a node adds options to an ND packet, it MUST NOT exceed the link MTU ๐Ÿ‘‘

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 ๐Ÿ’–


10. PROTOCOL CONSTANTS ๐ŸŒˆ

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

more protocol constants are defined alongside the message formats in Section 4 ๐Ÿฆ‹

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

the constants here can 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 open to attacks that make IP packets flow to unexpected places. these attacks can 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 these threats by ignoring ND packets from off-link senders ๐Ÿ›ก๏ธ. the Hop Limit field of every received packet is checked to contain 255, the maximum legal value. since routers decrement the Hop Limit on every packet they forward, a received packet with a Hop Limit of 255 must have come from a neighbor ๐Ÿ™ˆ

here's an example of a denial of service attack ๐Ÿ’€. a node on the link that can send packets with an arbitrary IP source address can advertise itself as a default router and also send "forged" Router Advertisement messages. those messages immediately time out all other default routers and all on-link prefixes. an intruder can do this by sending out multiple Router Advertisements, one for each legitimate router, with the source address set to another router's address, the Router Lifetime field set to zero, and the Preferred and Valid lifetimes set to zero for all the prefixes. that would send every packet, for both on-link and off-link destinations, to the rogue router. the rogue router can then selectively examine, modify or drop all packets sent on the link. Neighbor Unreachability Detection won't catch this black hole as long as the rogue router politely answers the NUD probes with a Neighbor Advertisement with the R-bit set ๐Ÿ˜ค

lots of link layers are also vulnerable to other denial of service attacks, like continuously occupying the link on CSMA/CD networks (for example, by sending packets back-to-back really closely or asserting the collision signal on the link), or originating packets with somebody else's source MAC address to confuse Ethernet switches, for example ๐ŸŒˆ

the trust model for redirects matches IPv4 ๐Ÿ’œ. a redirect is accepted only if it comes from the same router 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 sending another redirect to some other destination. still, this exposure is no worse than before, because the target host, once subverted, could always act as a hidden router to forward traffic somewhere else ๐Ÿ‘‘

the protocol has no mechanism to determine which neighbors are authorized to send a particular type of message (like Router Advertisements). any neighbor, presumably even when authentication is in place, can send Router Advertisement messages and cause denial of service ๐Ÿ˜ญ. plus, any neighbor can send proxy Neighbor Advertisements, as well as unsolicited Neighbor Advertisements, as a potential denial of service attack ๐Ÿ™ˆ

Neighbor Discovery 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 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 aren't 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] ๐Ÿ’–

12. RENUMBERING CONSIDERATIONS โœจ

Okay so, Neighbor Discovery teams up with IPv6 Address Autoconfiguration [ADDRCONF] to help with renumbering ๐Ÿ”„. New prefixes and addresses can show up, and old ones can get deprecated and then removed ๐Ÿ’….

The whole thing only works if every node on the link gets the Router Advertisement messages in a timely manner ๐Ÿซถ. But a host might be turned off or unreachable for ages, like a machine that gets powered down for months after a project ends ๐Ÿ’€. It's still possible to keep renumbering robust in those cases, but it does put some limits on how long prefixes have to keep being advertised ๐ŸŽ€.

Let's walk through an example ๐Ÿฆ‹. A prefix starts out advertised with a lifetime of 2 months. On August 1st, somebody realizes the prefix needs to be deprecated and removed because of renumbering by September 1st ๐Ÿ˜ญ. You can drop the advertised lifetime to 1 week starting August 1st, then keep making the lifetimes shorter as the cutoff gets closer, until by September 1st the prefix is advertised with a zero lifetime ๐ŸŒธ.

Here's the catch ๐Ÿ™ˆ. If one or more nodes were unplugged from the link before September 1st, they might still think the prefix is valid, because the last lifetime they got was 2 months. So a node unplugged on July 31st thinks the prefix is valid until September 30th. If that node gets plugged back in before September 30th, it may keep using the old prefix. The only way to make a node stop using a prefix that was advertised with a long Lifetime is to have it receive an advertisement for that prefix that lowers the lifetime ๐Ÿ“‰. The fix in this example is simple: keep advertising the prefix with a lifetime of 0 from September 1st until October 1st ๐Ÿ’–.

In general, to be robust against nodes that might be unplugged from the link, it's important to track the furthest point in the future that any node on the link could still consider a particular prefix valid ๐Ÿ”ญ. The prefix then has to be advertised with a 0 Lifetime until that point ๐Ÿ‘‘. This "furthest into the future" time is just the maximum, over all Router Advertisements, of the time the advertisement was sent plus the prefix's Lifetime contained in that advertisement ๐Ÿงฎ.

Infinite lifetimes need a special mention, because they make this a lot messier โญ. If a prefix is advertised with an infinite lifetime, and that prefix later needs renumbering, it's undesirable to keep advertising it with a zero lifetime forever ๐Ÿ˜ฉ. So either infinite lifetimes should be avoided, or there has to be a limit on how long a node can be unplugged from the link before it's plugged back in ๐Ÿ™ƒ. The problem is that it's unclear how a network administrator can enforce a limit on how long hosts such as laptops get unplugged ๐Ÿ’ป.

Network administrators should give serious thought to using relatively short lifetimes (no more than a few weeks, i.e., โณ). It might seem like long lifetimes would help robustness, but honestly a host can't communicate without properly working routers anyway ๐Ÿšซ. Those routers will be sending Router Advertisements with appropriate and current prefixes โœ…. A host on a network with no functioning routers is going to have bigger problems than just a missing valid prefix and address ๐Ÿ˜ฌ.

One more thing ๐Ÿงš. The discussion above doesn't distinguish between the preferred and valid lifetimes. For all practical purposes, it's probably enough to track the valid lifetime, since the preferred lifetime won't exceed the valid lifetime ๐Ÿ’œ.


REFERENCES ๐Ÿ“š

[ADDRCONF]   Thomson, S. and T. Narten, "IPv6 Address
             Autoconfiguration", RFC 2462, December 1998.

[ADDR-ARCH]  Hinden, R. and S. Deering, "IP Version 6 Addressing
             Architecture", RFC 2373, July 1998.

[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) Specification", RFC 2463, December 1998.

[IPv6]       Deering, S. and R. Hinden, "Internet Protocol, Version 6
             (IPv6) Specification", RFC 2460, December 1998.

[IPv6-ETHER] Crawford, M., "Transmission of IPv6 Packets over
             Ethernet Networks", RFC 2464, December 1998.

[IPv6-SA]    Kent, S. and R. Atkinson, "Security Architecture for the
             Internet Protocol", RFC 2401, November 1998.

[IPv6-AUTH]  Kent, S. and R. Atkinson, "IP Authentication Header",
             RFC 2402, November 1998.

[IPv6-ESP]   Kent, S. and R. Atkinson, "IP Encapsulating Security
             Payload (ESP)", RFC 2406, November 1998.

[KEYWORDS]   Bradner, S., "Key words for use in RFCs to Indicate
             Requirement Levels", BCP 14, RFC 2119, March 1997.

[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. See also:
             http://www.iana.org/numbers.html

[SYNC]       S. Floyd, V. Jacobson, "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 ๐ŸŽ€

Thomas Narten
IBM Corporation
P.O. Box 12195
Research Triangle Park, NC 27709-2195
USA

Phone: +1 919 254 7798
EMail: narten@raleigh.ibm.com


Erik Nordmark
Sun Microsystems, Inc.
901 San Antonio Road
Palo Alto, CA 94303
USA

Phone: +1 650 786 5166
Fax:   +1 650 786 5896
EMail: nordmark@sun.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, this one's a whole mood ๐ŸŒ€. A bunch of complicated issues pop up when Neighbor Discovery gets used by hosts that have multiple interfaces ๐Ÿ”€. This appendix doesn't try to define how multihomed hosts should properly operate with Neighbor Discovery ๐Ÿ™…โ€โ™€๏ธ. Instead, it points out issues that need more study. Implementors are encouraged to experiment 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 ๐Ÿ˜ต. Here are the issues to think about:

  1. To send a redirect, a router has to determine that the packet it's forwarding comes from a neighbor ๐Ÿ‘€. The standard test for this is to compare the packet's source address to the list of on-link prefixes associated with the interface the packet arrived on. But if the originating host is multihomed, the source address it uses might belong to a different interface than the one it was sent from. In that case, the 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 issue 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 to the destination, it can't deliver the packet ๐Ÿšง. But the destination might be reachable through a router on one of the other interfaces ๐ŸŒˆ. Neighbor Discovery doesn't address this scenario, and it never comes up in the non-multihomed case ๐Ÿคทโ€โ™€๏ธ.
  3. Even if the first-hop router does have a route to a destination, there might be a better route through another interface โœจ. There's no mechanism for the multihomed host to detect that situation ๐Ÿ•ต๏ธโ€โ™€๏ธ.

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

  1. If no Router Advertisement arrives 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 on-link under these conditions, and communication just proceeds ๐ŸŽ‰. In the multihomed case, though, extra information is needed to pick the right outgoing interface ๐Ÿงฉ. The other option is for a node to try address resolution on all interfaces, which is a step with a lot of complexity that the non-multihomed host never has to deal with ๐ŸŒ€.
  2. If Router Advertisements arrive on some interfaces but not all, a multihomed host could choose to only send packets out the interfaces where it got Router Advertisements ๐Ÿ’ซ. The key assumption here is that routers on those other interfaces will be able to route packets to the final destination, even when that destination is on the subnet the sender connects to but has no on-link prefix information ๐Ÿ™. If that assumption turns out to be FALSE, communication fails ๐Ÿ’€. And even if the assumption holds, packets will travel a sub-optimal path ๐Ÿข.

APPENDIX B: FUTURE EXTENSIONS ๐Ÿ”ฎ

Here are some possible extensions the folks in charge are thinking about for later study ๐Ÿง :

  • Using dynamic timers so the protocol can adapt to links with widely varying delay โฑ๏ธ. Measuring round trip times, though, needs acknowledgments and sequence numbers, so received Neighbor Advertisements can be matched with the actual Neighbor Solicitation that triggered them ๐Ÿ”. Implementors who want to experiment with this could do it in a backwards-compatible way by defining a new option that carries the necessary information ๐Ÿงก. Nodes that don't understand the option would just ignore it ๐Ÿ™ˆ.
  • Adding capabilities that make it easier to run over links that currently require hosts to register with an address resolution server ๐Ÿ“ฎ. For instance, this could let routers ask hosts to send them periodic unsolicited advertisements ๐Ÿ“ฃ. Again, this could be added with a new option sent in the Router Advertisements ๐Ÿ’Œ.
  • Adding extra procedures for links where asymmetric and non-transitive reachability is just part of normal operation ๐Ÿ“ก. Those procedures might help hosts and routers find usable paths on things like radio links ๐Ÿ“ป (e.g., radio links). ๐ŸŒธ

APPENDIX C: STATE MACHINE FOR THE REACHABILITY STATE โœจ

Okay bestie, this appendix is basically a cheat sheet ๐Ÿ“ It sums up the rules from Sections 7.2 and 7.3. The spec doesn't force you to build your code around this model, as long as what your implementation does from the outside matches what the document describes ๐Ÿซถ

When you're doing address resolution and Neighbor Unreachability Detection, these state transitions apply in 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
                Same link-layer
                address as cached.

REACHABLE       NA, Solicited=1,        -                     STALE
                Override=0
                Different link-layer
                address than cached.

STALE or PROBE  NA, Solicited=1,        -                     unchanged
                Override=0
                Different link-layer
                address than cached.

!INCOMPLETE     NA, Solicited=1,        Record link-layer     REACHABLE
                Override=1              address (if
                                        different).

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

!INCOMPLETE     NA, Solicited=0,        -                     unchanged
                Override=1
                Same link-layer
                address as cached.

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

!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.

Now the transitions for unsolicited info that isn't a Neighbor Advertisement ๐ŸŽ€ These apply to either the packet's source (for Neighbor Solicitation, Router Solicitation, and Router Advertisement messages) or the target address (for Redirect messages), and they go like this:

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: SUMMARY OF ISROUTER RULES ๐Ÿ’…

This appendix is the quick summary of how the IsRouter flag gets maintained in this document ๐ŸŒธ

Here's the backstory. ND messages carry info, either implied or spelled out, about whether the sender (or the Target Address) is a host or a router. These are the assumptions being used:

  • A Router Solicitation sender is implicitly treated as a host, since routers have no reason to send these.
  • A Router Advertisement sender is implicitly treated as a router.
  • Neighbor Solicitation messages say nothing, implicitly or explicitly, about the sender. Both hosts and routers send them.
  • Neighbor Advertisement messages have an explicit "IsRouter flag", the R-bit. ๐Ÿซถ
  • When a redirect's target is different from the destination address in the packet being redirected, the target is implicitly treated as a router. This makes sense, because that node should be able to forward packets on toward the destination.
  • When a redirect's target is the same as the destination, there's no host-versus-router info at all. All we know is that the destination (the target) is on-link, and it could be a host or a router.

The IsRouter rules are built on that info. If an ND message has explicit or implicit info, receiving it will update the IsRouter flag. But when an ND message has no host-versus-router info, receiving it MUST NOT change the IsRouter state. If receiving one of those messages creates a Neighbor Cache entry, this document says the IsRouter flag gets set to FALSE. ๐Ÿ˜ญ

Mislabelling a host as a router is the bigger risk, so be careful. The other way around is less dangerous. Either way, a later Neighbor Advertisement or Router Advertisement will set the correct IsRouter value. โœจ

APPENDIX E: IMPLEMENTATION ISSUES ๐Ÿงš

Appendix E.1: Reachability confirmations

Neighbor Unreachability Detection needs explicit proof that a forward-path is working properly. To skip sending Neighbor Solicitation probes, upper layer protocols should give that signal whenever it's cheap to do so ๐Ÿ’– Reliable connection-oriented protocols like TCP usually already know when the forward-path is working. When TCP sends or receives data, for example, it updates its window sequence numbers, sets and cancels retransmit timers, and so on. The specific situations that usually mean a forward-path is working properly are:

  • Getting an acknowledgement that covers a sequence number (e.g., data) that wasn't acknowledged before. This means the forward path was working when that data was sent.
  • Finishing the initial three-way handshake is a special case of the rule above. Even though no data goes out during the handshake, the SYN flags count as data from the sequence number perspective. This covers both the SYN+ACK for the active open and the ACK of that packet on the passively opening peer.
  • Receiving new data (data not received before) means the forward-path was working when an acknowledgement went out that advanced the peer's send window, the one that let the new data get sent. ๐Ÿฆ‹

To keep the cost of sharing reachability info between TCP and IP low, an implementation may want to rate-limit the reachability confirmations it sends to IP. One option is to only process reachability every few packets. For instance, an implementation that has only one round trip timer per connection might update reachability info once per round trip time. For implementations that cache Destination Cache entries inside control blocks, it may be possible to update the Neighbor Cache entry directly (no expensive lookup needed) 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 the piggybacked confirmation going stale when no packets go to IP for a long time. ๐Ÿ“

TCP must also be careful not to treat "stale" information as proof of current reachability. For example, new data received 30 minutes after a window opened up doesn't confirm the path is working right now. It only shows that 30 minutes ago the window update reached the peer, meaning the path was working at that moment. 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 pretty simple to have the client send reachability confirmations when the response packet arrives. It's harder, and sometimes impossible, for the server to generate these confirmations, because there's no flow control. The server can't tell whether a received request means a previous response reached the client. ๐Ÿ’œ

Also, an implementation can't use negative upper-layer advice as a replacement for the Neighbor Unreachability Detection algorithm. Negative advice (for example, 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 miss the case where the path from the receiver of the data isn't working, which stops the acknowledgement packets from reaching the sender. ๐Ÿ˜ญ๐Ÿ”ฅ

APPENDIX F: CHANGES SINCE RFC 1970 โœจ

  • bye bye IPv6 priority field ๐Ÿ’… every reference to it is gone
  • the solicited-node multicast address definition got replaced with a reference to [ADDR-ARCH] ๐Ÿ”ฅ that spec says "the solicited-node multicast address is formed by taking the low-order 24 bits of the address (unicast or anycast) and appending those bits to the prefix FF02:0:0:0:0:1:FF00::/104"
  • the references section now lists the new RFC numbers ๐Ÿ“š
  • section 7.2.5 and the tables in appendix C got an update ๐Ÿฆ‹ receipt of an NS message only updates the state of an existing neighbor cache entry if the link-layer address is different from the one already recorded
  • section 7.1.1 got an explicit check ๐Ÿ™ˆ a received NS from an unsolicited address must be sent to the solicited-node multicast address, and if it's sent to a unicast destination, it gets silently discarded
  • section 6.2.1 now has a requirement that Lifetimes be configurable in one of two ways: as a fixed value that doesn't change over time, or one that decrements in real time โณ
  • section 6.2.7 got text that relaxes the consistency checks on prefix lifetimes when they're configured to decrement in real time ๐ŸŒˆ this avoids false alarms caused by link propagation delay and lack of synchronized clocks
  • section 6.3.4 got text pointing out that [ADDRCONF] might ignore short lifetimes, but Neighbor Discovery does not ignore short prefix lifetimes ๐Ÿงš
  • the rules for RS and NS packets with an unspecified source address got clarified ๐Ÿ’– such packets MUST NOT include a source link-layer address option, and receivers verify this
  • section 7.2.3 now says which addresses a node may proxy for in NS messages ๐ŸŽ€ the old text only mentioned unicast and anycast addresses assigned to the interface, so it wasn't clear that proxy addresses were allowed
  • the rules for when to set the IsRouter flag in Neighbor Cache entries got tightened up ๐ŸŒธ ambiguities and inconsistencies are gone, and there's a new appendix (Appendix D) that summarizes these rules
  • there's a new section on renumbering considerations (section 12) ๐Ÿ“ it clarifies how long prefixes have to be advertised when their lifetime(s) are reduced
  • the rules in section 7 for NS/NA packets used for NUD probes got extra text ๐Ÿซถ Link-Layer Address options can now be left out of these packets in certain cases without causing an infinite NS "recursion" specifically, the Link-Layer address may be omitted in unicast solicitations (i.e., MAY language)
  • the default AdvValidLifetime changed from infinity to 30 days โญ
  • the constant "576" changed to "1280" in places where it refers to the minimum sized IP packet that all links must be able to carry ๐Ÿ‘‘

Copyright (C) The Internet Society (1998). All Rights Reserved.

This document and translations of it may be copied and furnished to others, and derivative works that comment on or otherwise explain it or assist in its implementation may be prepared, copied, published and distributed, in whole or in part, without restriction of any kind, provided that the above copyright notice and this paragraph are included on all such copies and derivative works. However, this document itself may not be modified in any way, such as by removing the copyright notice or references to the Internet Society or other Internet organizations, except as needed for the purpose of developing Internet standards in which case the procedures for copyrights defined in the Internet Standards process must be followed, or as required to translate it into languages other than English.

The limited permissions granted above are perpetual and will not be revoked by the Internet Society or its successors or assigns.

This document and the information contained herein is provided on an "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. ๐Ÿ’œ

๐Ÿ“ฆ where this page comes from