bgp路由反射器学习试验
验证路由反射器通告路由的三条规则
RFC 1966定义了三个规则,根据学习到路由的途径,RR通过这三条规则来决定
将路由公布给谁:
(1)如果路由是从非客户的IBGP对等学习到的,只将它反射给客户。
(2)如果路由是从客户处学习到的,将它反射给除了发起该路由的客户外的所有
非客户以及客户。
(3)如果路由是从EBGP对等处学习到的,将它反射给所有的客户和非客户
下面逐一进行验证:
[初始配置]R1分别和R2,R3,R4建立IBGP邻居关系,查看各自BGP
R1#sh ip bg
BGP table version is 4, local router ID is 14.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 &am p;am p;nb sp; Metric LocPrf Weight Path
*>i2.2.2.0/24 12.1.1.2 0 100 0 i *>i3.3.3.0/24 13.1.1.3 0 100 0 i *>i4.4.4.0/24 14.1.1.4 0 100 0 i r2#sh ip bg
BGP table version is 2, 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 &am p;am p;nb sp; Metric LocPrf Weight Path
*> 2.2.2.0/24 0.0.0.0 0 32768 i R3#sh ip bg
BGP table version is 2, local router ID is 3.3.3.3
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 &am p;am p;nb sp; Metric LocPrf Weight Path
*> 3.3.3.0/24 0.0.0.0 0 32768 i R4#sh ip bg
BGP table version is 2, local router ID is 4.4.4.4
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 &am p;am p;nb sp; Metric LocPrf Weight Path
*> 4.4.4.0/24 0.0.0.0 0 32768 i
可以看到由于BGP的水平分割原则,造成了R1不会将从R2,R3,R4学习到
的IBGP路由再相互通告给它们
[案例一]将R3配置为RR客户
R1(config-router)#nei 13.1.1.3 route-reflector-client
*Sep 26 13:16:20.803: %BGP-5-ADJCHANGE: neighbor 13.1.1.3 Down RR client config change
*Sep 26 13:16:48.075: %BGP-5-ADJCHANGE: neighbor 13.1.1.3 Up 等到邻居重新建立起来以后,查看BGP表
r2#sh ip bg
BGP table version is 2, 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 &am p;am p;nb sp; Metric LocPrf Weight Path
*> 2.2.2.0/24 0.0.0.0 0 32768 i * i3.3.3.0/24 13.1.1.3 0 100 0 i R3#sh ip bg
BGP table version is 2, local router ID is 3.3.3.3
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 &am p;am p;nb sp; Metric LocPrf Weight Path
* i2.2.2.0/24 12.1.1.2 0 100 0 i
*> 3.3.3.0/24 0.0.0.0 0 32768 i * i4.4.4.0/24 14.1.1.4 0 100 0 i
R4#sh ip bg
BGP table version is 2, local router ID is 4.4.4.4
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 &am p;am p;nb sp; Metric LocPrf Weight
Path
* i3.3.3.0/24 13.1.1.3 0 100 0 i
*> 4.4.4.0/24 0.0.0.0 0 32768 i 可以发现R2,R4没有互相学习到各自发布的BGP路由信息,而R3学习到了R2,
R4通告的BGP路由,可见规则一(如果路由是从非客户的IBGP对等学习到的,
只将它反射给客户)是成立的。
同时R2,R4学习到了R3通告的BGP路由,
规则二的前面一种可能(如果
路由是从客户处学习到的,将它反射给除了发起该路由的客户外的所有非客户)
是正确的。
[案例二]添加R4为RRC
R1(config-router)#nei 14.1.1.4 route-reflector-client
*Sep 26 13:23:30.903: %BGP-5-ADJCHANGE: neighbor 14.1.1.4 Down RR client config change
*Sep 26 13:23:57.923: %BGP-5-ADJCHANGE: neighbor 14.1.1.4 Up 查看BGP路由表
R4#sh ip bg
BGP table version is 2, local router ID is 4.4.4.4
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 &am p;am p;nb sp; Metric LocPrf Weight
Path
* i2.2.2.0/24 12.1.1.2 0 100 0 i * i3.3.3.0/24 13.1.1.3 0 100 0 i *> 4.4.4.0/24 0.0.0.0 0 32768 i 原来R4作为非客户可以得到客户通告的BGP路由,现在作为客户仍然可以得
到R3通告的BGP路由,由此证明了规则二的后一种可 能(如果路由是从客户
处学习到的,将它反射给除了发起该路由的客户外的所有客户)是正确的。
[案例三]将R4改为 AS64510,和R1建立EBGP关系
邻居建立完成,查看R2,R3的BGP路由表:
r2#sh ip bg
BGP table version is 2, 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 &am p;am p;nb sp; Metric LocPrf Weight Path 458110672
*> 2.2.2.0/24 0.0.0.0 0 32768 i * i3.3.3.0/24 13.1.1.3 0 100 0 i * i4.4.4.0/24 14.1.1.4 0 100 0 64510 i
R3#sh ip bg
BGP table version is 2, local router ID is 3.3.3.3
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 &am p;am p;nb sp; Metric LocPrf Weight
Path
* i2.2.2.0/24 12.1.1.2 0 100 0 i *> 3.3.3.0/24 0.0.0.0 0 32768 i * i4.4.4.0/24 14.1.1.4 0 100 0 64510 i
可以看到R2作为非客户,R3作为客户都收到了反射器R1发送过来的其EBGP
邻居的路由更新,由此证明规则三(如果路由是从EBGP对等处学习到的,将
它反射给所有的客户和非客户)是正确的
总结:值得注意的是规则一,非客户之间的IBGP路由信息是不能通过反射器相
互通告的,因此在做路由反射器的时候客户的配置不要遗漏,以免造成路由缺失。
补充:大家可以注意一下在使用了RR后,IBGP之间通告的下一跳问题,是没
有改变的。