为什么 iBGP 路由不传播到其他 iBGP 邻居?

网络工程 路由 bgp
2021-07-30 22:10:44

我一直在网上搜索这个。一般表示为默认情况下,iBGP 不传播通过其他 iBGP 邻居学到的路由。我试图了解根本原因。

我找到的答案有点循环:路由不会传播,因为 BGP 具有全网状连接。

为什么 BGP 具有全网状连接?

- 因为路由没有传播。

有人可以详细说明潜在的设计原因吗?

3个回答

原因是为了防止路由循环。BGP 路由器不会将从 iBGP 邻居 A 获知的路由通告给第二个 iBGP 邻居 C。这在 BGP RFC 4271 §9.2 第 2 段中指定为了显示:

+-------+            +-------+            +---------+
| RTR A |----iBGP----| RTR B |----eBGP----| TRANSIT |
+-------+            +-------+            +---------+
                         |
                        iBGP
                         |
                     +-------+
                     | RTR C |
                     +-------+
  • RTR B 不会传播从AtoC或反之亦然的路由
  • RTR B 传播从AC到 的路由TRANSIT
  • RTR B 传播从TRANSITtoA和 的路由C

它需要具有路由器之间的附加的iBGP会话AC使网络正常工作,或使用路由反射或联盟,这允许B到传播从A到C的路由,同时加入一些额外的环路预防复杂性。

路由器之间需要iBGP 会话AC并不意味着它们之间需要有实际的第 2 层网络连接。iBGP 旨在跨主干网络在多个跃点上运行。

只是想扩大一点...

插图

BGP 在环路预防方面严重依赖 AS 编号。如果 AS 内有多个路由器,根据定义,它们共享同一个ASN,因此无法依靠 ASN 来防止它们之间形成环路。这就是为什么应该设计其他东西——从具有相同 ASN 的路由器接收的路由根本不会传播回该 AS 的路由器。这就是全网状网络成为必要条件,以便所有 iBGP 参与者上的 BGP 表保持一致。

http://network.jecool.net/bgp-loop-prevention/

在BGP中有两种环路预防机制:

  • 对于 EBGP,有 AS-Path 属性,该属性表明路由器在 AS 路径
    属性中看到自己的 AS 编号时将丢弃 BGP 通告
  • 对于 IBGP 有水平分割规则,该规则规定一个 IBGP 邻居发送的更新不应发送给另一个 IBGP
    邻居

相当重要的一段已经提到的 RFC 4271:https : //www.rfc-editor.org/rfc/rfc4271#section-5.1.2

   AS_PATH is a well-known mandatory attribute.  This attribute
   identifies the autonomous systems through which routing information
   carried in this UPDATE message has passed.  The components of this
   list can be AS_SETs or AS_SEQUENCEs.

   When a BGP speaker propagates a route it learned from another BGP
   speaker's UPDATE message, it modifies the route's AS_PATH attribute
   based on the location of the BGP speaker to which the route will be
   sent:

      a) When a given BGP speaker advertises the route to an internal
         peer, the advertising speaker SHALL NOT modify the AS_PATH
         attribute associated with the route.

      b) When a given BGP speaker advertises the route to an external
         peer, the advertising speaker updates the AS_PATH attribute as
         follows:

         1) if the first path segment of the AS_PATH is of type
            AS_SEQUENCE, the local system prepends its own AS number as
            the last element of the sequence (put it in the leftmost
            position with respect to the position of octets in the
            protocol message).  If the act of prepending will cause an
            overflow in the AS_PATH segment (i.e., more than 255 ASes),
            it SHOULD prepend a new segment of type AS_SEQUENCE and
            prepend its own AS number to this new segment.

         2) if the first path segment of the AS_PATH is of type AS_SET,
            the local system prepends a new path segment of type
            AS_SEQUENCE to the AS_PATH, including its own AS number in
            that segment.

         3) if the AS_PATH is empty, the local system creates a path
            segment of type AS_SEQUENCE, places its own AS into that
            segment, and places that segment into the AS_PATH.

这是 iBGP 的水平分割规则。这背后的总体想法是 BGP 的意思是字面上的边界协议,而您的 AS 应该像您的主场。eBGP 更像是局外人。BGP 不想太纠结于 AS 内路由的复杂性,并希望您将这些东西由 IGP 管理。因此,将您的 AS 视为您的房子。如果你妈妈大喊晚餐准备好了,你不要去敲你的兄弟姐妹(iBGP 邻居)的门,让他们知道她这么说,你假设他们和妈妈有自己的融洽关系。另一方面,如果客人(eBGP 邻居)结束,您的配偶说晚餐准备好了,您要让每个客人都知道这一点,因为他们不在“信任圈”中。