BGP 路由反射器
{Back to Index}

Table of Contents

1 角色与反射规则

rr_role.png

Figure 1: 路由反射中的各种角色(只有 RR 才知道谁是 client)

1.1 学习自非 client

如果路由学习自非 client IBGP peer ,则 反射 给所有 client ,同时 传递 1 给 eBGP 邻居。

rr_learn_from_non_client.png

1.2 学习自 client

如果路由学习自 client ,则 反射 给所有 IBGP 邻居和其余所有 client ,同时 传递 给 eBGP 邻居。

rr_learn_from_client.png

1.3 学习自 EBGP

如果路由学习自 EBGP 邻居,则 传递 给所有 client 和非 client IBGP 邻居。

rr_learn_from_ebgp.png

2 防环设计

路由反射器需使用 ORIGINATOR_ID 和 CLUSTER_LIST 这两个属性来防止环路。

rr_anti_loop.png

2.1 ORIGINATOR_ID

  • 每当一条路由被反射时,该路由的始发 IBGP 路由器的 Router-ID 将会被存在路由的 originator_ID 属性中
  • 当一台路由器收到 IBGP 路由且其 originator_ID 与该路由器的 Router-ID 相同时,则路由器忽略该条路由
  • Originator_ID 及 Cluster-list 属性将会影响 BGP 选路决策 2

2.2 CLUSTER-LIST

  • 路由反射簇包括反射器及其 Client (Client并不知道自己属于反射簇,只有RR知道)
  • 每一个簇都有唯一的簇 ID
  • 每当一条路由被反射器反射后,该反射器的 Cluster_ID 就会被添加至路由的 Cluster_list 属性中
  • 每当反射器收到一条 Cluster_list 属性已经包含该簇的 Cluster_ID 的路由时,该路由将不被反射

3 配置示例

3.1 实验拓扑

rr_experiment.png

3.2 配置要点

  • R1

    router bgp 100
     bgp router-id 1.1.1.1
     bgp log-neighbor-changes
     network 100.0.1.0 mask 255.255.255.0
     network 100.0.2.0 mask 255.255.255.0
     neighbor 10.1.13.3 remote-as 345
    
  • R2

    router bgp 200
     bgp router-id 2.2.2.2
     bgp log-neighbor-changes
     neighbor 10.1.25.5 remote-as 345
    
  • R3

    router ospf 1
     router-id 3.3.3.3
     network 3.3.3.3 0.0.0.0 area 0
     network 10.1.34.3 0.0.0.0 area 0
    !
    router bgp 345
     bgp router-id 3.3.3.3
     bgp log-neighbor-changes
     neighbor 4.4.4.4 remote-as 345
     neighbor 4.4.4.4 update-source Loopback0
     neighbor 4.4.4.4 next-hop-self
     neighbor 10.1.13.1 remote-as 100
    
  • R4 (重点)

    router ospf 1
     router-id 4.4.4.4
     network 4.4.4.4 0.0.0.0 area 0
     network 10.1.34.4 0.0.0.0 area 0
     network 10.1.45.4 0.0.0.0 area 0
    !
    router bgp 345
     bgp router-id 4.4.4.4
     bgp cluster-id 4.4.4.4
     bgp log-neighbor-changes
     neighbor 3.3.3.3 remote-as 345
     neighbor 3.3.3.3 update-source Loopback0
     neighbor 3.3.3.3 route-reflector-client
     neighbor 5.5.5.5 remote-as 345
     neighbor 5.5.5.5 update-source Loopback0
    
  • R5

    router ospf 1
     router-id 5.5.5.5
     network 5.5.5.5 0.0.0.0 area 0
     network 10.1.45.5 0.0.0.0 area 0
    !
    router bgp 345
     bgp router-id 5.5.5.5
     bgp log-neighbor-changes
     neighbor 4.4.4.4 remote-as 345
     neighbor 4.4.4.4 update-source Loopback0
     neighbor 10.1.25.2 remote-as 200
    

3.3 实验结果

R5#sh ip b
BGP table version is 3, local router ID is 5.5.5.5
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
              x best-external, a additional-path, c RIB-compressed,
              t secondary path,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
*>i  100.0.1.0/24     3.3.3.3                  0    100      0 100 i
*>i  100.0.2.0/24     3.3.3.3                  0    100      0 100 i
R5#sh ip b 100.0.1.0
BGP routing table entry for 100.0.1.0/24, version 2
Paths: (1 available, best #1, table default)
Flag: 0x100
  Advertised to update-groups:
     1
  Refresh Epoch 3
  100
    3.3.3.3 (metric 21) from 4.4.4.4 (4.4.4.4)
      Origin IGP, metric 0, localpref 100, valid, internal, best
      Originator: 3.3.3.3, Cluster list: 4.4.4.4
      rx pathid: 0, tx pathid: 0x0

Footnotes:

1

反射 是需要添加 ORIGINATOR_ID 和 CLUSTER_LIST 属性的,而 传递 并不涉及这两个属性

2

参见 BGP 13 条选路规则

Author: Hao Ruan (ruanhao1116@gmail.com)

Created: 2021-05-15 Sat 22:32

Updated: 2021-08-17 Tue 11:23

Emacs 27.1 (Org mode 9.3)