IPv6 RA 标志和各种组合

网络工程 路由器 IPv6
2022-02-07 03:08:31

IPv6 RA 中有哪些标志可用,Windows、Linux 和 BSD 如何解释它们的各种组合?

1个回答

我认为您指的是路由器广告中的 M 和 O 标志。主机操作系统如何解释这些标志在这里是题外话。RFC 4861,IP 版本 6 (IPv6) 的邻居发现,第 4.2 节。路由器广告消息格式详细说明了路由器广告消息格式,包括 RA 标志:

4.2. 路由器广告消息格式

路由器定期发送路由器广告消息,或响应路由器请求。

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

知识产权领域:

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


  Destination Address
                 Typically the Source Address of an invoking Router
                 Solicitation or the all-nodes multicast address.

  Hop Limit      255

ICMP 字段:

  Type           134

  Code           0

  Checksum       The ICMP checksum.  See [ICMPv6].

  Cur Hop Limit  8-bit unsigned integer.  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
                 set, it indicates that addresses are available via
                 Dynamic Host Configuration Protocol [DHCPv6].

                 If the M flag is set, the O flag is redundant and
                 can be ignored because DHCPv6 will return all
                 available configuration information.

  O              1-bit "Other configuration" flag.  When set, it
                 indicates that other configuration information is
                 available via DHCPv6.  Examples of such information
                 are DNS-related information or information on other
                 servers within the network.

    Note: If neither M nor O flags are set, this indicates that no
    information is available via DHCPv6.

  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.  The lifetime associated
                 with the default router in units of seconds.  The
                 field can contain values up to 65535 and receivers
                 should handle any value, while the sending rules in
                 Section 6 limit the lifetime to 9000 seconds.  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 applies only 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.  The time, in
                 milliseconds, that a node assumes a neighbor is
                 reachable after having received a reachability
                 confirmation.  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.  The time, in
                 milliseconds, between retransmitted Neighbor
                 Solicitation messages.  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).

可能的选项:

  Source link-layer address
                 The link-layer address of the interface from which
                 the Router Advertisement is sent.  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            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).  MAY be sent
                 on other links.

  Prefix Information
                 These options specify the prefixes that are on-link
                 and/or are used for stateless 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 host with multiple
                 interfaces may not be able to choose the correct
                 outgoing interface when sending traffic to its
                 neighbors.

前缀信息选项中还有几个标志(L 和 A),详见第 4.6.2 节前缀信息

4.6.2. 前缀信息

   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                             +
  |                                                               |
  +                                                               +
  |                                                               |
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

领域:

  Type           3

  Length         4

  Prefix Length  8-bit unsigned integer.  The number of leading bits
                 in the Prefix that are valid.  The value ranges
                 from 0 to 128.  The prefix length field provides
                 necessary information for on-link determination
                 (when combined with the L flag in the prefix
                 information option).  It also assists with address
                 autoconfiguration as specified in [ADDRCONF], for
                 which there may be more restrictions on the prefix
                 length.

  L              1-bit on-link flag.  When set, indicates that this
                 prefix can be used for on-link determination.  When
                 not set the advertisement makes no statement about
                 on-link or off-link properties of the prefix.  In
                 other words, if the L flag is not set a host MUST
                 NOT conclude that an address derived from the
                 prefix is off-link.  That is, it MUST NOT update a
                 previous indication that the address is on-link.

  A              1-bit autonomous address-configuration flag.  When
                 set indicates that this prefix can be used for
                 stateless address configuration as specified in
                 [ADDRCONF].

  Reserved1      6-bit unused field.  It MUST be initialized to zero
                 by the sender and MUST be ignored by the receiver.

  Valid Lifetime
                 32-bit unsigned integer.  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
                 32-bit unsigned integer.  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].

                 Note that the value of this field MUST NOT exceed
                 the Valid Lifetime field to avoid preferring
                 addresses that are no longer valid.

  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.

说明 前缀信息选项为主机提供链接前缀和地址自动配置的前缀。Prefix Information 选项出现在Router Advertisement 数据包中,对于其他消息必须被忽略。