ip router id 有没有推荐的范围

网络工程 思科 路由器 ipv4 杜松
2021-07-19 19:54:02

通常,路由器 id 将设置为最高环回地址(如果存在)或物理接口的最高 IP 地址。但是大多数供应商提供了一种配置特定值示例的方法:-“ip router-id 55.1.1.1”。我的问题是,可以配置的 router-id 值是否有任何限制?任何 RFC 建议?我可以将“255.255.255.255”配置为我的 IP 路由器 ID 吗?

3个回答

通常,路由器 id 将设置为最高环回地址(如果存在)或物理接口的最高 IP 地址。但是大多数供应商提供了一种配置特定值示例的方法:-“ip router-id 55.1.1.1”。我的问题是,可以配置的 router-id 值是否有任何限制?任何 RFC 建议?我可以将“255.255.255.255”配置为我的 IP 路由器 ID?

概括

您没有指定协议,因此答案是“视情况而定”。如果您不在任何地方使用 MPLS TE,则路由器 ID 的值对于 OSPF、OSPFv3、BGP、ISIS 或 LDP 似乎无关紧要。从技术上讲,在这些情况下,您可以将“255.255.255.255”分配为路由器 ID 的 32 位部分。

虽然这些协议并不严格视为路由协议,但您不能将底层 IGP 选择与您部署MPLS TE 的能力分开因此,如果您将MPLS TEOSPF TE 扩展、CR-LDP 等一起使用……那么建议将您的路由器 ID 分配为同一路由器上的地址。

总体指导:为您的同事和未来的服务部署保持简单

虽然 IGP 允许您为路由器 ID 选择任何值,但您不应该使生活变得过于困难虽然理论上您可以将路由器 1 的路由器 ID 指定为路由器 2 上的环回地址,但不要这样做,除非您已经打算为自己制造坏名声。

在您之后必须支持基础设施的任何人都会讨厌上述决定。此外,您会使某些 MPLS TE 服务的实施变得更加困难,因为人们必须重新分配路由器 ID 才能启动多个 MPLS TE 服务。


RFC 1142, (ISIS) - 可变长度字段,从 1 到 8 个八位字节

ID      System identifier  a variable length field from 1 to
  8 octets (inclusive). Each routeing domain employ
  ing this protocol shall select a single size for the ID
  field and all Intermediate systems in the routeing do
  main shall use this length for the system IDs of all
  systems in the routeing domain.

### [RFC 2328, Section 5 (OSPF)] - 一个 32 位数字

仅将 Router ID 定义为 32 位数字,因此可以使用任何32 位数字:

Router ID
    A 32-bit number that uniquely identifies this router in the AS.
    One possible implementation strategy would be to use the
    smallest IP interface address belonging to the router. If a
    router's OSPF Router ID is changed, the router's OSPF software
    should be restarted before the new Router ID takes effect.  In
    this case the router should flush its self-originated LSAs from
    the routing domain (see Section 14.1) before restarting, or they
    will persist for up to MaxAge minutes.

RFC 4271,第 4.2 节 (BGP) - 表示有效单播 IP 主机地址的 4 字节无符号整数

BGP ID在 OPEN 消息中定义为“ 4 字节无符号整数”。

 BGP Identifier:

    This 4-octet unsigned integer indicates the BGP Identifier of
    the sender.  A given BGP speaker sets the value of its BGP
    Identifier to an IP address that is assigned to that BGP
    speaker.  The value of the BGP Identifier is determined upon
    startup and is the same for every local interface and BGP peer.

然而,为了在语法上正确,它必须是“一个有效的单播 IP 主机地址”。

 6.2.  OPEN Message Error Handling
  ...
  If the BGP Identifier field of the OPEN message is syntactically
  incorrect, then the Error Subcode MUST be set to Bad BGP Identifier.
  Syntactic correctness means that the BGP Identifier field represents
  a valid unicast IP host address.

RFC 2740,第 2.2 节 (OSPFv3) - 32 位数字

明确禁止协议 (IPv6) 中的地址与路由器 ID 之间存在任何关系,路由器 ID 仅为 32 位数字。

2.2.  Removal of addressing semantics
 ...
 o   OSPF Router IDs, Area IDs and LSA Link State IDs remain at
     the IPv4 size of 32-bits. They can no longer be assigned as
     (IPv6) addresses.

RFC 4577,第 4.2.2 节(BGP/MPLS IP VPN 的 OSPF) - 32 位数字(有效的 OSPF RID)

4.2.2.  Router ID
    If a PE and a CE are communicating via OSPF, the PE will have an OSPF
    Router ID that is valid (i.e., unique) within the OSPF domain.  More
    precisely, each OSPF instance has a Router ID.  Different OSPF 
    instances may have different Router IDs.

RFC 5036, Section 3.1 (LDP) - 6 个字节,其中 4 个字节应该是有效的 IGP 路由器 ID

LDP Identifier
  Six octet field that uniquely identifies the label space of the
  sending LSR for which this PDU applies.  The first four octets
  identify the LSR and MUST be a globally unique value.  It SHOULD
  be a 32-bit router Id assigned to the LSR and also used to
  identify it in Loop Detection Path Vectors.  The last two octets
  identify a label space within the LSR.  For a platform-wide label
  space, these SHOULD both be zero.

RFC 3480,第 2 节 (CR-LDP) - 始终可访问的稳定 IP 地址

将路由器 ID 定义为“ LSR的稳定IP 地址,如果与 LSR 有任何连接,则始终可以访问该地址”。 因此它几乎必须是一个环回地址

     In the context of this document, the term "Router ID" means a stable
     IP address of an LSR that is always reachable if there is any
     connectivity to the LSR.  This is typically implemented as a
     "loopback address"; the key attribute is that the address does not
     become unusable if an interface on the LSR is down.  In some cases,
     this value will need to be configured.  If one is using OSPF or ISIS
     as the IGP in support of traffic engineering, then it is RECOMMENDED
     for the Router ID to be set to the "Router Address" as defined in
     [OSPF-TE], or "Traffic Engineering Router ID" as defined in [ISIS-
     TE].

RFC 3630,第 2.4.1 节 (OSPF-TE) - 广告路由器的稳定 IP 地址

RFC 3630 第 2.4.1 节 (OSPF-TE)要求“广告路由器的稳定 IP 地址”

 2.4.1.  Router Address TLV

  The Router Address TLV specifies a stable IP address of the
  advertising router that is always reachable if there is any
  connectivity to it; this is typically implemented as a "loopback
  address".  The key attribute is that the address does not become
  unusable if an interface is down.  In other protocols, this is known
  as the "router ID," but for obvious reasons this nomenclature is
  avoided here.  If a router advertises BGP routes with the BGP next
  hop attribute set to the BGP router ID, then the Router Address
  SHOULD be the same as the BGP router ID.

我手动将路由器 ID 设置为用于进入路由器的管理 IP 地址。对我来说,这很有意义,并且可以无缝地进入邻居。

CCIEZone,他们有一种非常彻底的方法来区分网络上的路由器。我希望我早点发现这一点。

  • Octet 1:组织(1 = 父组织,2+ = 子组织)
  • 八位字节 2:站点 ID(必须定义并特定于组织)
  • 八位字节 3:建筑 ID 或其他有用的标识符
  • 八位字节 4:实际路由器名称

由 cciezone.com 提供

我的问题是,可以配置的 router-id 值是否有任何限制?

路由器 ID 没有限制,所以255.255.255.255应该可以正常工作。

大多数路由协议会​​以各种方式使用路由器 ID,但您应该避免将其视为 IP 地址。路由器 ID 实际上是一个任意的 32 位数字,所以是的,您可以分配任何您想要的内容,只要您避免设备之间的 ID 重复即可。