Cisco BGP同步不生效

网络工程 思科 路由 BGP
2022-02-25 03:31:10

据我了解,BGP 同步是一项现在默认禁用的功能。如果存在匹配的 IGP 路由,它只允许将 iBGP 路由选择为最佳(并因此进一步通告给其他邻居)。

我有一个同时运行 BGP(在 AS100 中)和 EIGRP 的路由器 (R1)。该路由器是 AS100 中的路由反射器,并连接到另一个路由器 (R8),该路由器又连接到 AS54 中的 R10。R8 从 R10 (112.0.0.0/8) 获知一条路由,并将其进一步通告给 R1。这些外部路由器不会重新分配到 EIGRP,因此不能通过 BGP 以外的其他方式在 R1 上使用。

R1配置:

R1#sh run | s eigrp|bgp
router eigrp 100
 network 155.1.0.0
 redistribute connected route-map ONLY_LOOPBACK
router bgp 100
 ! sync is enabled
 synchronization
 bgp log-neighbor-changes
 network 150.1.1.1 mask 255.255.255.255
 ! R8 neighbor
 neighbor 155.1.58.8 remote-as 100
 neighbor 155.1.58.8 route-reflector-client
 ! R4 neighbor
 neighbor 155.1.146.4 remote-as 100
 neighbor 155.1.146.4 route-reflector-client

R1 没有到 112.0.0.0/8 (EIGRP) 的 IGP 路由,也没有运行任何其他路由协议:

R1#sh ip eigrp topo 112.0.0.0/8
EIGRP-IPv4 Topology Entry for AS(100)/ID(150.1.1.1)
%Entry 112.0.0.0/8 not in topology table

BGP 还将到 112.0.0.0/8 的两个可能路径标记为未同步:

R1# sh ip bgp 112.0.0.1
BGP routing table entry for 112.0.0.0/8, version 2
Paths: (2 available, best #2, table default)
  Advertised to update-groups:
     1         
  Refresh Epoch 1
  54 50 60, (Received from a RR-client)
    155.1.58.8 (metric 3328) from 155.1.58.8 (150.1.8.8)
      Origin IGP, metric 0, localpref 100, valid, internal, not synchronized
      rx pathid: 0, tx pathid: 0
  Refresh Epoch 1
  54 50 60, (Received from a RR-client)
    155.1.67.7 (metric 3072) from 155.1.67.7 (150.1.7.7)
      Origin IGP, metric 0, localpref 100, valid, internal, not synchronized, best
      rx pathid: 0, tx pathid: 0x0

据我所知,它们都是内部路由(从 iBGP 对等方接收),并且两者都不同步。因此,它们不应被视为最佳路径的候选者,并且 R1 不应进一步宣传该路径。

然而,如前所述,它仍然选择路径#2 为最佳,并将路径进一步通告给其他 RR 客户端,例如 R4:

R4#sh ip bgp 112.0.0.0
BGP routing table entry for 112.0.0.0/8, version 0
Paths: (1 available, no best path)
  Not advertised to any peer
  Refresh Epoch 2
  54 50 60
    155.1.67.7 (inaccessible) from 155.1.146.1 (150.1.1.1)
      Origin IGP, metric 0, localpref 100, valid, internal, not synchronized
      Originator: 150.1.7.7, Cluster list: 150.1.1.1
      rx pathid: 0, tx pathid: 0

它从 R1 (150.1.1.1 / 155.1.146.1) 发布。在 R4,路由被认为是不同步的,因此没有最佳路径。但为什么它首先是由 R1 宣传的呢?当两条可用路径不同步时,为什么 R1 会选择最佳路径?

1个回答

我认为您误解了 BGP 同步。BGP 同步意味着 BGP 路由器不会将前缀通告给 eBGP 对等体,直到您的 AS 中的所有路由器都知道通过 IGP 的路由。换句话说,除非该路由通过 IGP 在其路由表中存在,否则 eBGP 不会将路由通告给 eBGP 对等体。Cisco 有很多文档来解释 BGP。例如,BGP:常见问题

问:什么是同步,它如何影响安装在 IP 路由表中的 BGP 路由?

A. 如果您的 AS 将流量从另一个 AS 传递到第三个 AS,则在您的 AS 中的所有路由器通过 IGP 获知路由之前,BGP 不应发布路由。BGP 等待 IGP 在 AS 内传播路由,然后将其通告给外部对等方。如果启用同步的 BGP 路由器无法在其 IGP 中验证这些路由,则不会将 iBGP 获知路由安装到其路由表中。在路由器 bgp下发出no synchronization命令以禁用同步。这可以防止 BGP 验证 IGP 中的 iBGP 路由。有关更详细的说明,请参阅BGP 案例研究:同步。

iBGP 中有一条规则,即 iBGP 对等体不能通告通过 iBGP 学习到的任何前缀。这与 BGP 同步无关。这意味着您的 iBGP 对等体必须具有完整的网格(通过 IGP,或所有 BGP 对等体之间的直接连接),或者您必须使用缓解措施(路由反射器或联盟)。