Skip to main content

6. Router and Prefix Discovery

This section describes router and prefix discovery. Router Discovery is the process through which hosts locate routers that reside on an attached link. Prefix Discovery is the process through which hosts discover the set of address prefixes that define which destinations are on-link for an attached link.

Hosts use the advertised on-link prefixes to build and maintain a list that is used in deciding when a packet's destination is on-link or beyond a router. 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 such cases, hosts assume that destinations are off-link and send traffic to routers. A router can then issue redirects as appropriate.

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 do not satisfy all of the following validity checks:

  • IP Source Address is a link-local address. Routers MUST NOT send Router Advertisements to multicast addresses (other than the all-nodes multicast address) if the solicitation's source address is the unspecified address. This restriction is to prevent denial-of-service attacks from malicious nodes.

  • The IP Hop Limit field has a value of 255, i.e., the packet could not possibly have been forwarded by a router.

  • 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 a Router Solicitation that is valid according to the above checks is received on an interface, and the interface is an advertising interface, the router may respond with either a multicast Router Advertisement or with a unicast Router Advertisement destined to the soliciting node's address, as described below. The router should respond with a unicast Router Advertisement if the Router Solicitation was sent from a unicast address, and with a multicast Router Advertisement if the Router Solicitation was sent from the unspecified address.

6.1.2. Validation of Router Advertisement Messages

A node MUST silently discard any received Router Advertisement messages that do not satisfy all of the following 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.

  • 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 to the protocol may specify the contents of the Reserved field or add new options; backward-incompatible changes may use different Code values.

The contents of any defined options that are not specified to be used with Router Advertisement messages MUST be ignored and the packet processed as normal. The only defined options that may appear are the Source Link-Layer Address, MTU, and Prefix Information options.

A Router Advertisement that passes the validity checks is called a "valid Router Advertisement".

6.2. Router Specification

6.2.1. Router Configuration Variables

A router MUST allow for the following conceptual variables to be configured by system management for each advertising interface:

MaxRtrAdvInterval - The maximum time allowed between sending unsolicited multicast Router Advertisements from the interface, in seconds. MUST be no less than 4 seconds and no greater than 1800 seconds.

Default: 600 seconds

MinRtrAdvInterval - The minimum time allowed between sending unsolicited multicast Router Advertisements from the interface, in seconds. MUST be no less than 3 seconds and no greater than .75 * MaxRtrAdvInterval.

Default: 0.33 * MaxRtrAdvInterval

AdvManagedFlag - The value to be placed in the "Managed address configuration" flag in the Router Advertisement. See [ADDRCONF].

Default: FALSE

AdvOtherConfigFlag - The value to be placed in the "Other configuration" flag in the Router Advertisement. See [ADDRCONF].

Default: FALSE

AdvLinkMTU - The value to be placed in MTU options sent by the router. A value of zero indicates that no MTU options are sent.

Default: 0

AdvReachableTime - The value to be placed in the Reachable Time field in the Router Advertisement messages sent by the router. The value zero means unspecified (by this router). MUST be no greater than 3,600,000 milliseconds (1 hour).

Default: 0

AdvRetransTimer - The value to be placed in the Retrans Timer field in the Router Advertisement messages sent by the router. The value zero means unspecified (by this router).

Default: 0

AdvCurHopLimit - The value to be placed in the Cur Hop Limit field in the Router Advertisement messages sent by the router. 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" [ASSIGNED] that was in effect at the time of implementation.

AdvDefaultLifetime - The value to be 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 indicates that the router is not to be used as a default router. These limits may be overridden by specific documents that describe how IPv6 operates over different link layers. For instance, in a point-to-point link the peers may have enough information about the number and status of devices at the other end so that advertisements are not needed.

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 from which the advertisement is sent.

For each prefix advertised in Prefix Information options, the router MUST also allow for the following configuration variables:

AdvValidLifetime - The value to be placed in the Valid Lifetime in the Prefix Information option, in seconds. The designated value of all 1's (0xffffffff) represents infinity.

Default: 2592000 seconds (30 days), fixed (i.e., stays the same in consecutive advertisements).

AdvOnLinkFlag - The value to be placed in the on-link flag ("L-bit") field in the Prefix Information option.

Default: TRUE

AdvPreferredLifetime - The value to be placed in the Preferred Lifetime in the Prefix Information option, in seconds. The designated value of all 1's (0xffffffff) represents infinity.

Default: 604800 seconds (7 days), fixed (i.e., stays the same in consecutive advertisements).

AdvAutonomousFlag - The value to be placed in the Autonomous Flag field in the Prefix Information option.

Default: TRUE

6.2.2. Becoming An Advertising Interface

The term "advertising interface" refers to any interface on which a router sends periodic Router Advertisements. A router MUST allow a system administrator to make an interface an advertising interface.

An interface may become an advertising interface at any time. When it does, the router:

  • Initializes the interface as described in [ADDRCONF].

  • Schedules its first Router Advertisement to be sent from the interface. The transmission time is chosen such that the advertisement is sent at a time uniformly distributed between 0 and MAX_INITIAL_RTR_ADVERT_INTERVAL.

6.2.3. Router Advertisement Message Content

A router sends periodic as well as solicited Router Advertisements out its advertising interfaces. Outgoing Router Advertisements are filled with the following values consistent with the message format given in Section 4.2:

  • In the Router Lifetime field: the interface's configured AdvDefaultLifetime.

  • In the M and O flags: the interface's configured AdvManagedFlag and AdvOtherConfigFlag, respectively.

  • 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 interface. This option SHOULD be included, but MAY be omitted on links that have no addresses.

    • 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. Each Prefix Information option includes the following fields:

      • In the "on-link" flag: AdvOnLinkFlag
      • In the Valid Lifetime field: AdvValidLifetime
      • In the "autonomous address-configuration" flag: AdvAutonomousFlag
      • In the Preferred Lifetime field: AdvPreferredLifetime
      • In the Prefix: the prefix being advertised

A router MAY include options other than those specified above.

6.2.4. Sending Unsolicited Router Advertisements

A router sends unsolicited Router Advertisements to announce its presence and to advertise various link and Internet parameters. For each advertising interface, the router sends periodic multicast Router Advertisements to the all-nodes multicast address.

The rate at which Router Advertisements are sent is controlled by the router's configuration variables: MaxRtrAdvInterval and MinRtrAdvInterval. When an interface becomes an advertising interface, the router initializes a timer on the interface that expires after sending the first advertisement. The timer is set to expire at a time uniformly distributed between 0 and MAX_INITIAL_RTR_ADVERT_INTERVAL.

After the first advertisement, subsequent Router Advertisements are sent when the timer expires. The timer is reset to a value uniformly distributed between MinRtrAdvInterval and MaxRtrAdvInterval whenever the timer expires.

6.2.5. Ceasing To Be An Advertising Interface

An interface may cease to be an advertising interface at any time. For instance, a router that is shutting down or an interface that is being disabled may cease to be an advertising interface. In such cases, the router SHOULD transmit one or more (but not more than MAX_FINAL_RTR_ADVERTISEMENTS) final multicast Router Advertisements on the interface with a Router Lifetime field of zero. In the case of a router that is shutting down, the interface SHOULD be declared to cease being an advertising interface and then the final Router Advertisements should be sent. In the case where the router is aware that an interface is likely to be unavailable for some time (e.g., due to imminent loss of power), the router MAY transmit the final Router Advertisements at a faster rate (i.e., more frequently than once per MinRtrAdvInterval).

6.2.6. Processing Router Solicitations

A host MUST silently discard any received Router Solicitation messages.

In addition to sending periodic, unsolicited advertisements, a router sends Router Advertisements in response to valid Router 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 case will be to multicast the response to the all-nodes group. In the latter case, the interface's interval timer is reset to a new random value, as if an unsolicited advertisement had 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 a single advertisement is being sent in response to multiple solicitations, the delay is relative to the first solicitation.) In addition, 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 MAY choose to ignore Router Solicitations if the router's configuration indicates that Router Advertisements should not be sent on the interface.

6.2.7. Router Advertisement Consistency

To minimize the likelihood of misconfiguration, routers SHOULD be consistent in the values they advertise. That is, routers on the same link SHOULD advertise the same values for AdvCurHopLimit, AdvManagedFlag, AdvOtherConfigFlag, AdvLinkMTU, AdvReachableTime, and AdvRetransTimer. Such consistency is not required, however, and if routers advertise different values, the system should still work, although perhaps not as well as it might.

If routers on a link advertise different values for AdvCurHopLimit, hosts will use the advertised value they learned most recently. If AdvCurHopLimit changes, some hosts may use one value, while others may use a different value until all hosts have received a Router Advertisement that advertises the new value.

If routers advertise different values for AdvReachableTime or AdvRetransTimer, hosts will calculate their own values as described in Section 6.3.2.

If routers advertise different values for AdvDefaultLifetime, hosts will prefer the router advertising the largest value.

6.3. Host Specification

6.3.1. Host Configuration Variables

A host SHOULD allow the following variable to be configured by system management for each interface:

DupAddrDetectTransmits - The number of consecutive Neighbor Solicitation messages sent while performing Duplicate Address Detection on a tentative address. A value of zero indicates that Duplicate Address Detection is not performed on tentative addresses. A value of one indicates a single transmission with no follow-up retransmissions.

Default: 1, but may be overridden by a link-type specific value in the document that covers operating IP over a particular link type.

6.3.2. Host Variables

A host maintains the following variables on a per-interface basis:

RouterList - A list of default routers, as defined in Section 5.

PrefixList - A list of prefixes, as defined in Section 5.

LinkMTU - The MTU value for the link. Initialized from the linkmtu value that the link layer provides.

CurHopLimit - The default value that should be placed in the Hop Count field of the IP header for outgoing IP packets. Initialized to the value specified by the "IPv6 Assigned Numbers" document [ASSIGNED].

BaseReachableTime - A base value used for computing the random ReachableTime value. Initialized to REACHABLE_TIME.

ReachableTime - The time a neighbor is considered reachable after receiving a reachability confirmation. ReachableTime is used by the Neighbor Unreachability Detection algorithm (see Section 7.3). It is learned from Router Advertisements or is set to a default value. It is a random value uniformly distributed between MIN_RANDOM_FACTOR and MAX_RANDOM_FACTOR times BaseReachableTime. 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. Also used during Duplicate Address Detection (see [ADDRCONF]). RetransTimer is learned from Router Advertisements or is set to a default value.

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

On receipt of a valid Router Advertisement, a host extracts the source address of the packet and does the following:

  • If the address is not already present in the host's Default Router List, and the advertisement's Router Lifetime is non-zero, create a new entry in the list, and initialize its invalidation timer value from the advertisement's Router Lifetime field.

  • If the address is already present in the host's Default Router List as a result of a previously received advertisement, reset its invalidation timer to the Router Lifetime value in the newly received advertisement.

  • If the address is already present 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.

A Router Advertisement field (e.g., Cur Hop Limit, Reachable Time, and Retrans Timer) may contain a value denoting that it is unspecified. In such cases, the parameter should be ignored and the host should continue using whatever value it is already using.

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 differs from the previous value, the host SHOULD re-compute a new random ReachableTime value.

If the received Retrans Timer value is non-zero, the host SHOULD set its RetransTimer variable to the received value.

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 (e.g., [IPv6-ETHER]).

Prefix Information options that have the "on-link" (L) flag set indicate a prefix identifying a range of addresses that should be considered on-link. Note, however, that a Prefix Information option with the on-link flag set to zero conveys no information concerning on-link determination and MUST NOT be interpreted to mean that addresses covered by the prefix are off-link. The only way to disable a previously advertised prefix is to advertise that prefix with the Valid Lifetime set to zero. (see Section 6.3.5).

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

  • If the prefix is not already present in the Prefix List, and the Prefix Information option's Valid Lifetime field is non-zero, create a new entry for the prefix and initialize its invalidation timer to the Valid Lifetime value in the Prefix Information option.

  • If the prefix is already present in the host's Prefix List as a result 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 present in the host's Prefix List, silently ignore the option.

The autonomous address-configuration flag (A-flag) indicates whether or not the prefix can be used for stateless address autoconfiguration. The processing of the A-flag is specified in [ADDRCONF].

6.3.5. Timing out Prefixes and Default Routers

When a prefix's Valid Lifetime expires, the prefix is removed from the Prefix List. A prefix is invalidated when its Valid Lifetime expires.

Whenever the invalidation timer expires for an entry in the Default Router List, that entry is discarded. When removing a router from the Default Router List, the node MUST update the Destination Cache in such a way that all entries using the router perform next-hop determination again rather than continue sending traffic to the (deleted) router.

6.3.6. Default Router Selection

The algorithm for selecting a default router depends on the Host's policy. This algorithm could be part of a mobility solution.

The rules below represent the Default Router Selection algorithm that SHOULD be used in the absence of a better algorithm.

  • Routers that are reachable or probably reachable (i.e., in any state other than INCOMPLETE) SHOULD be preferred over routers whose reachability is unknown or suspect (i.e., in the INCOMPLETE state). An implementation may choose to always return the same router or cycle through the router list in a round-robin fashion as long as it always returns a reachable router when one is available.

  • 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 subsequent requests for a default router do not return the same router until all other routers have been selected.

Cycling through the router list in this case ensures that all available routers are actively being tested for reachability while none are known to be reachable.

6.3.7. Sending Router Solicitations

When an interface becomes enabled, a host may send up to MAX_RTR_SOLICITATIONS Router Solicitation messages. However, interfaces on which unsolicited Router Advertisements are not expected (e.g., host-only links, or links where a host has been configured with a default router) need not send Router Solicitations.

A host sends Router Solicitations to the all-routers multicast address.

The host SHOULD transmit up to MAX_RTR_SOLICITATIONS Router Solicitation messages, each separated by at least RTR_SOLICITATION_INTERVAL seconds. However, to avoid network congestion, the delay before the first transmission SHOULD be a uniformly distributed random value between 0 and MAX_RTR_SOLICITATION_DELAY. This delay ensures that Router Solicitations from different hosts are not synchronized.

After transmitting MAX_RTR_SOLICITATIONS solicitations, the host will receive Router Advertisements, or will have concluded that there are no routers on the link. Once the host has sent MAX_RTR_SOLICITATIONS solicitations, it SHOULD continue to receive and process Router Advertisements that may arrive after it has stopped sending Router Solicitations.