BGP RR的环路避免机制
RR的环路避免机制
*其中箭头方向为Client方向
Platform:cisco iou
step 1:底层连接
step 2:R1/R2/R3/R4在AS100,并运行OSPF 100
show ip ospf neighbor
show ip route ospf
step 3:按拓扑建立iBGP邻居关系(注意反射器的指定)
r1#show ip bg
BGP table version is 11, 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
* i100.4.4.0/24 34.1.1.4 0 100 0 i
*>i 34.1.1.4 0 100 0 i
r1#show ip bg 100.4.4.0
BGP routing table entry for 100.4.4.0/24, version 11
Paths: (2 available, best #2, table default)
Advertised to update-groups:
7
Local
34.1.1.4 (metric 20) from 12.1.1.2 (2.2.2.2)
Origin IGP, metric 0, localpref 100, valid, internal
Originator: 4.4.4.4, Cluster list: 2.2.2.2, 3.3.3.3
Local, (Received from a RR-client)
34.1.1.4 (metric 20) from 13.1.1.3 (3.3.3.3)
Origin IGP, metric 0, localpref 100, valid, internal, best
Originator: 4.4.4.4, Cluster list: 3.3.3.3
因为经过一个簇就相当于经过一个特殊的AS号来进行策略选路
step 4:R1指定从R2学习过来的BGP条目weight值设置为222(大于0即可)
R1(config-router)#neighbor 2.2.2.2 weight 222
show ip bgp 100.4.4.0
r1#show ip bg
BGP table version is 12, 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
*>i100.4.4.0/24 34.1.1.4 0 100 222 i
* i 34.1.1.4 0 100 0 i
r1#show ip bg 100.4.4.0
BGP routing table entry for 100.4.4.0/24, version 12
Paths: (2 available, best #1, table default)
Advertised to update-groups:
9
Local
34.1.1.4 (metric 20) from 12.1.1.2 (2.2.2.2)
Origin IGP, metric 0, localpref 100, weight 222, valid, internal, best
Originator: 4.4.4.4, Cluster list: 2.2.2.2, 3.3.3.3
Local, (Received from a RR-client)
34.1.1.4 (metric 20) from 13.1.1.3 (3.3.3.3)
Origin IGP, metric 0, localpref 100, valid, internal
Originator: 4.4.4.4, Cluster list: 3.3.3.3
step 5:R4通告loopback 1 100.4.4.0/24,R1关于这个条目会选择从R2最优
注明:默认情况下,R1关于这个条目要选择R3最优,因为经过的簇最多
--->从R3学,经过的簇为:3.3.3.3
--->从R2学,经过的簇为:2.2.2.2,3.3.3.3
show ip bgp nei 3.3.3.3 advertised-routes | received-routes(查看给邻居发送/接收条目)
反射器和它的客户端构成一个簇,在BGP进程下一个簇是由Cluster-ID标识!默认情况下Cluster-ID由反射器用Router-ID填充(可以通过bgp cluster-id来手动指定Cluster-ID)
step 6:R1查看更新给R3的BGP条目,会将从R2学习过来的100.4.4.0更新给R3,但R3不接收!这就是RR的环路避免机制之一
cluster-list:任何携带本地反射所在簇的Cluster-ID的条目,本地反射器都将拒绝该路由
R1#show ip bgp neighbors 3.3.3.3 advertised-routes
r1#show ip bg nei 13.1.1.3 advertised-routes
BGP table version is 15, 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
Originating default network 0.0.0.0
Network Next Hop Metric LocPrf Weight Path
*>i100.4.4.0/24 34.1.1.4
簇之间是使用Originator-ID避免环路
*其中箭头方向为Client方向
从EBGP邻居学习过来的路由(或RR本地注入的路由)RR不会创建cluster-list,这个时候的环路避免依靠是Originator-ID
r2#show ip bg
BGP table version is 3, 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
*>i100.4.4.4/32 4.4.4.4 0 100 0 i
* i 4.4.4.4 0 100 0 i
r2#show ip bg 100.4.4.4
BGP routing table entry for 100.4.4.4/32, version 3
Paths: (2 available, best #1, table default)
Advertised to update-groups:
4
Local, (Received from a RR-client)
4.4.4.4 (metric 21) from 1.1.1.1 (1.1.1.1)
Origin IGP, metric 0, localpref 100, valid, internal, best
Originator: 4.4.4.4, Cluster list: 1.1.1.1
Local
4.4.4.4 (metric 21) from 3.3.3.3 (3.3.3.3)
Origin IGP, metric 0, localpref 100, valid, internal
Originator: 4.4.4.4, Cluster list: 3.3.3.3
Originator-ID由第一个RR创建且不能更改,Originator-ID是以这些路由器的BGP RID
本地AS始发路由的BGP宣告者
EBGP学习到的路由,就是学习到该路由的边界路由器
R1++++++++++++++++++++++++++++++++++++++++++++++++++++
interface Loopback0
ip address 1.1.1.1 255.255.255.255
!
interface Ethernet0/0
no sh
!
interface Ethernet0/0.12
encapsulation dot1Q 12
ip address 12.1.1.1 255.255.255.0
!
interface Ethernet0/0.13
encapsulation dot1Q 13
ip address 13.1.1.1 255.255.255.0
!
router ospf 100
network 0.0.0.0 255.255.255.255 area 0
!
router bgp 100
bgp log-neighbor-changes
neighbor 2.2.2.2 remote-as 100
neighbor 2.2.2.2 update-source Loopback0
neighbor 3.3.3.3 remote-as 100
neighbor 3.3.3.3 update-source Loopback0
neighbor 3.3.3.3 route-reflector-client
no auto-summary
!
R2++++++++++++++++++++++++++++++++++++++++++++++
interface Loopback0
ip address 2.2.2.2 255.255.255.255
!
interface Ethernet0/0
no sh
!
interface Ethernet0/0.12
encapsulation dot1Q 12
ip address 12.1.1.2 255.255.255.0
!
interface Ethernet0/0.23
encapsulation dot1Q 23
ip address 23.1.1.2 255.255.255.0
!
router ospf 100
network 0.0.0.0 255.255.255.255 area 0
!
router bgp 100
bgp log-neighbor-changes
neighbor 1.1.1.1 remote-as 100
neighbor 1.1.1.1 update-source Loopback0
neighbor 1.1.1.1 route-reflector-client
neighbor 3.3.3.3 remote-as 100
neighbor 3.3.3.3 update-source Loopback0
no auto-summary
!
R3+++++++++++++++++++++++++++++++++++++++++++++++++++++
interface Loopback0
ip address 3.3.3.3 255.255.255.255
!
interface Ethernet0/0
no sh
!
interface Ethernet0/0.13
encapsulation dot1Q 13
ip address 13.1.1.3 255.255.255.0
!
interface Ethernet0/0.23
encapsulation dot1Q 23
ip address 23.1.1.3 255.255.255.0
!
interface Ethernet0/0.34
encapsulation dot1Q 34
ip address 34.1.1.3 255.255.255.0
!
router ospf 100
network 0.0.0.0 255.255.255.255 area 0
!
router bgp 100
bgp log-neighbor-changes
neighbor 1.1.1.1 remote-as 100
neighbor 1.1.1.1 update-source Loopback0
neighbor 2.2.2.2 remote-as 100
neighbor 2.2.2.2 update-source Loopback0
neighbor 2.2.2.2 route-reflector-client
neighbor 4.4.4.4 remote-as 100
neighbor 4.4.4.4 update-source Loopback0
neighbor 4.4.4.4 route-reflector-client
no auto-summary
R4++++++++++++++++++++++++++++++++++++++++++++++++++++++++
interface Loopback0
ip address 4.4.4.4 255.255.255.255
!
interface Loopback1
ip address 100.4.4.4 255.255.255.0
!
interface Ethernet0/0
no sh
!
interface Ethernet0/0.34
encapsulation dot1Q 34
ip address 34.1.1.4 255.255.255.0
!
router ospf 100
network 0.0.0.0 255.255.255.255 area 0
!
router bgp 100
bgp log-neighbor-changes
network 100.4.4.0 mask 255.255.255.0
neighbor 3.3.3.3 remote-as 100
neighbor 3.3.3.3 update-source Loopback0
no auto-summary