iBGP之间只可以发送自身产生的前缀信息,不可以转发接受自其他iBGP对等体的前缀信息,这是BGP的防环机制。

解决IBGP间路由发送的限制一般有三种方法:

1.       建立full-mesh的对等体连接

2.       建立联盟

3.       建立RR(路由反射器)


在RR中引入了originator-id和cluster-id这两个属性来防止环路。

Originator是指产生首发该路由的路由器的RID,cluster-id可以手工配置,也可以有系统默认生成(RR的RID)。

系统为RR默认配置的cluster-id就是RR的RID。这样,当一个系统中有多个RR时,他们是同簇的。不同簇的RR会以一般的RR与非客户端对等体的反射原则来传递路由信息。

那么,如果同一级别的RR拥有相同的cluster-id,那么,他们之间就不会反射路由信息了!


 

下面的试验讨论的是同一个AS中,有多个同级RR时,路由传递的一些特性。


 

拓扑如下:

 

BGP RR 优缺点 bgp的rr_BGP RR 优缺点


R1,R2,R3,R4在同一个AS中,其中R1和R2作为RR,R3,R4作为客户端对等体被两个RR共同拥有,R3与R4之间没有建立对等体。

基本配置:
R1
R1#sh ip int b
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0/0            unassigned      YES manual up                    up      
FastEthernet0/0.12         12.1.1.1        YES manual up                    up      
FastEthernet0/0.13         13.1.1.1        YES manual up                    up      
FastEthernet0/0.14         14.1.1.1        YES manual up                    up      
Loopback0                  10.1.1.1        YES manual up                    up      
。。。。(omit)

 
R1#sh run | b router 
router bgp 1
 no synchronization
 bgp router-id 1.1.1.1
 bgp log-neighbor-changes
 network 10.1.1.0 mask 255.255.255.0
 neighbor 12.1.1.2 remote-as 1
 neighbor 13.1.1.3 remote-as 1
 neighbor 13.1.1.3 route-reflector-client
 neighbor 14.1.1.4 remote-as 1
 neighbor 14.1.1.4 route-reflector-client
 no auto-summary

 
R2
R2#sh ip int b
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0/0            unassigned      YES manual up                    up      
FastEthernet0/0.12         12.1.1.2        YES manual up                    up      
FastEthernet0/0.23         23.1.1.2        YES manual up                    up      
FastEthernet0/0.24         24.1.1.2        YES manual up                    up      
Loopback0                  20.1.1.1        YES manual up                    up      
……(omit)

 
R2#sh run | b router 
router bgp 1
 no synchronization
 bgp router-id 2.2.2.2
 bgp log-neighbor-changes
 network 20.1.1.0 mask 255.255.255.0
 neighbor 12.1.1.1 remote-as 1
 neighbor 23.1.1.3 remote-as 1
 neighbor 23.1.1.3 route-reflector-client
 neighbor 24.1.1.4 remote-as 1
 neighbor 24.1.1.4 route-reflector-client
 no auto-summary

 
R3
R3#sh ip int b
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0/0            unassigned      YES manual up                    up      
FastEthernet0/0.13         13.1.1.3        YES manual up                    up      
FastEthernet0/0.23         23.1.1.3        YES manual up                    up        
Loopback0                  30.1.1.1        YES manual up                    up      
…..(omit)

 
R3#sh run | b router 
router bgp 1
 no synchronization
 bgp router-id 3.3.3.3
 bgp log-neighbor-changes
 network 30.1.1.0 mask 255.255.255.0
 neighbor 13.1.1.1 remote-as 1
 neighbor 23.1.1.2 remote-as 1
 no auto-summary

 
R4配置与R3基本一致,略。

 
1.
看看R1向R2反射了那些路由
R1#sh ip b nei 12.1.1.2 advertised-routes 
BGP table version is 9, local router ID is 1.1.1.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

 
   Network          Next Hop            Metric LocPrf Weight Path
*> 10.1.1.0/24      0.0.0.0                  0         32768 i
*>i30.1.1.0/24      13.1.1.3                 0    100      0 i
*>i40.1.1.0/24      14.1.1.4                 0    100      0 i

 
切到R2上,选取一条路由来研究,比如选了30.1.1.0/24这条路由
R2#sh ip b 30.1.1.0 
BGP routing table entry for 30.1.1.0/24, version 8
Paths: (2 available, best #1, table Default-IP-Routing-Table)   #选取1号来源为最佳路由
  Advertised to non peer-group peers:
  12.1.1.1 24.1.1.4     #R2将这条前缀反射给了非对等体组成员R1和R4
  Local, (Received from a RR-client)
    23.1.1.3 from 23.1.1.3 (3.3.3.3)
      Origin IGP, metric 0, localpref 100, valid, internal, best
  Local
    13.1.1.3 (inaccessible) from 12.1.1.1 (1.1.1.1)
      Origin IGP, metric 0, localpref 100, valid, internal
      Originator: 3.3.3.3, Cluster list: 1.1.1.1   #两个RR防环属性属性
R2收到两条关于30.1.1.0/24的更新,一条是来自于R3的,一条是来自于R1的。

 
2.
下面我们在R2上打开debug,然后在R1上软重启,看看路由更新的发送情况。
R2#deb ip b up
BGP updates debugging is on
R2#
*Mar  1 00:25:08.195: BGP(0): 12.1.1.1 rcvd UPDATE w/ attr: nexthop 12.1.1.1, origin i, localpref 100, metric 0
*Mar  1 00:25:08.195: BGP(0): 12.1.1.1 rcvd 10.1.1.0/24...duplicate ignored
*Mar  1 00:25:08.199: BGP(0): 12.1.1.1 rcvd UPDATE w/ attr: nexthop 14.1.1.4, origin i, localpref 100, metric 0, originator 4.4.4.4, clusterlist 1.1.1.1
*Mar  1 00:25:08.199: BGP(0): 12.1.1.1 rcvd 40.1.1.0/24...duplicate ignored
*Mar  1 00:25:08.199: BGP(0): 12.1.1.1 rcvd UPDATE w/ attr: nexthop 13.1.1.3, origin i, localpref 100, metric 0, originator 3.3.3.3, clusterlist 1.1.1.1
*Mar  1 00:25:08.199: BGP(0): 12.1.1.1 rcvd 30.1.1.0/24...duplicate ignored
如上所示,发送了三条更新。

 
3.
接下来在R1和R2上手动配置相同的cluster-id(前面说过了,默认情况下的cluster-id就是RR的RID)
R1(config)#router b 1
R1(config-router)#bgp clus
R1(config-router)#bgp cluster-id 12.1.1.1

 
R2(config)#router b 1
R2(config-router)#b clus
R2(config-router)#b cluster-id 12.1.1.1

 
4.
再来看看R1向R2发送了哪些更新

 
R1#sh ip b nei 12.1.1.2 ad
BGP table version is 9, local router ID is 1.1.1.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

 
   Network          Next Hop            Metric LocPrf Weight Path
*> 10.1.1.0/24      0.0.0.0                  0         32768 i
*>i30.1.1.0/24      13.1.1.3                 0    100      0 i
*>i40.1.1.0/24      14.1.1.4                 0    100      0 i

 
跟以前一样!
是不是上面的命令不起作用呢?
再来看看R2的路由表
R2#sh ip b 
BGP table version is 9, local router ID is 2.2.2.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

 
   Network          Next Hop            Metric LocPrf Weight Path
*>i10.1.1.0/24      12.1.1.1                 0    100      0 i
*> 20.1.1.0/24      0.0.0.0                  0         32768 i
*>i30.1.1.0/24      23.1.1.3                 0    100      0 i
*>i40.1.1.0/24      24.1.1.4                 0    100      0 i

 
如上所示,并没有R1向它发送更新。这时还是要通过debug来看看

 
R2#deb ip bgp up
BGP updates debugging is on
R2#
*Mar  1 00:35:02.671: BGP(0): 12.1.1.1 rcvd UPDATE w/ attr: nexthop 12.1.1.1, origin i, localpref 100, metric 0
*Mar  1 00:35:02.671: BGP(0): 12.1.1.1 rcvd 10.1.1.0/24...duplicate ignored
*Mar  1 00:35:02.675: BGP: 12.1.1.1 RR in same cluster. Reflected update dropped
*Mar  1 00:35:02.675: BGP(0): 12.1.1.1 rcv UPDATE w/ attr: nexthop 14.1.1.4, origin i, localpref 100, metric 0, originator 4.4.4.4, clusterlist 12.1.1.1, path , community , extended community 
*Mar  1 00:35:02.675: BGP(0): 12.1.1.1 rcv UPDATE about 40.1.1.0/24 -- DENIED due to: reflected from the same cluster;

 
   
  
*Mar  1 00:35:02.675: BGP: 12.1.1.1 RR in same cluster. Reflected update dropped
R2#
*Mar  1 00:35:02.675: BGP(0): 12.1.1.1 rcv UPDATE w/ attr: nexthop 13.1.1.3, origin i, localpref 100, metric 0, originator 3.3.3.3, clusterlist 12.1.1.1, path , community , extended community 
*Mar  1 00:35:02.675: BGP(0): 12.1.1.1 rcv UPDATE about 30.1.1.0/24 -- DENIED due to: reflected from the same cluster;
R2#

 

这样就明白了吧!

可能会有这样的疑问,10.1.1.0/24这个网段上面显示的也被拒绝了,为什么路由表里面还有?

这是因为如果一个路由条目是RR自身发起的话,那么他不会在这个条目上创建cluster-id。而且,RR从外部对等体学习到的路由信息,在反射给自己的客户端或者为非客户端时,也不会为这前缀创建cluster-id。

我们可以切到R3上来看看10.1.1.0/24这个信息被两个RR反射给R3时有携带的属性什么不同。

R3#sh ip b 10.1.1.0
BGP routing table entry for 10.1.1.0/24, version 7
Paths: (2 available, best #2, table Default-IP-Routing-Table)
  Not advertised to any peer
  Local
    12.1.1.1 (inaccessible) from 23.1.1.2 (2.2.2.2)
      Origin IGP, metric 0, localpref 100, valid, internal
Originator: 1.1.1.1, Cluster list: 12.1.1.1
  Local
    13.1.1.1 from 13.1.1.1 (1.1.1.1)
      Origin IGP, metric 0, localpref 100, valid, internal, best

 

第一个是从R2发过去的,下面的一个是从R1发过去的。很明显,从R1发送过去的没有携带originator和cluster-id这两个属性。

https://blog.51cto.com/edges/340412