当一个as中包含的ibgp对等体太多时,配置全互联就比较麻烦,这时候可以起路由反射器。将一个路由器配置成路由反射器(RR),其他的ibgp路由器当做客户,这些客户只与RR建立对等体关系,而不是与另外的每个路由器对等。(可以大大的减少配置)
反躲规则:
1)如果路由是从非客户过来则反躲给客户,不会给非客户;
2)如果路由是从客户过来,会反射给客户和非客户;
3)如果路由是从EBGP邻居过来,反射给客户和非客户。
!
hostname R1
!
router ospf 1
router-id 1.1.1.1
log-adjacency-changes
network 0.0.0.0 255.255.255.255 area 0
!
router bgp 100
no synchronization
bgp log-neighbor-changes
network 172.16.1.0 mask 255.255.255.0
network 172.16.2.0 mask 255.255.255.0
network 172.16.3.0 mask 255.255.255.0
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
neighbor 4.4.4.4 remote-as 100
neighbor 4.4.4.4 update-source Loopback0
no auto-summary
!
hostname R2
!
router ospf 1
router-id 2.2.2.2
log-adjacency-changes
network 0.0.0.0 255.255.255.255 area 0
!
router bgp 100
no synchronization
bgp log-neighbor-changes
network 172.16.1.0 mask 255.255.255.0
network 172.16.4.0 mask 255.255.255.0
network 172.16.5.0 mask 255.255.255.0
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
neighbor 3.3.3.3 route-reflector-client
neighbor 4.4.4.4 remote-as 100
neighbor 4.4.4.4 update-source Loopback0
no auto-summary
!
hostname R3
!
router ospf 1
router-id 3.3.3.3
log-adjacency-changes
passive-interface Serial1/0
network 0.0.0.0 255.255.255.255 area 0
!
router bgp 100
no synchronization
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 172.16.6.5 remote-as 200
no auto-summary
!
hostname R4
!
router ospf 1
router-id 4.4.4.4
log-adjacency-changes
network 0.0.0.0 255.255.255.255 area 0
!
router bgp 100
no synchronization
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
no auto-summary
!
hostname R5
!
router bgp 200
no synchronization
bgp log-neighbor-changes
network 172.16.6.0 mask 255.255.255.0
network 192.168.1.0
network 192.168.2.0
neighbor 172.16.6.3 remote-as 100
no auto-summary
R4#show ip bgp
BGP table version is 25, 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 Metric LocPrf Weight Path
r i172.16.1.0/24 2.2.2.2 0 100 0 i
r>i 1.1.1.1 0 100 0 i
r i172.16.2.0/24 1.1.1.1 0 100 0 i
r>i 1.1.1.1 0 100 0 i
r i172.16.3.0/24 1.1.1.1 0 100 0 i
r>i 1.1.1.1 0 100 0 i
r>i172.16.4.0/24 2.2.2.2 0 100 0 i
r>i172.16.5.0/24 2.2.2.2 0 100 0 i
r i172.16.6.0/24 172.16.6.5 0 100 0 200 i
r>i 172.16.6.5 0 100 0 200 i
*>i192.168.1.0 172.16.6.5 0 100 0 200 i
* i 172.16.6.5 0 100 0 200 i
*>i192.168.2.0 172.16.6.5 0 100 0 200 i
* i 172.16.6.5 0 100 0 200 i
R4#show ip bgp 192.168.1.0
BGP routing table entry for 192.168.1.0/24, version 24
Paths: (2 available, best #1, table Default-IP-Routing-Table)
Not advertised to any peer
200
172.16.6.5 (metric 192) from 1.1.1.1 (1.1.1.1)
Origin IGP, metric 0, localpref 100, valid, internal, best
Originator: 3.3.3.3, Cluster list: 1.1.1.1
200
172.16.6.5 (metric 192) from 2.2.2.2 (2.2.2.2)
Origin IGP, metric 0, localpref 100, valid, internal
Originator: 3.3.3.3, Cluster list: 2.2.2.2
为了节省开销,当在同一个区域时,两 个RR中通过指定同一个cluster-id,可以节省内存存放学过来的路由条目,因为缺省情况下,一个RR就是一个cluster,这个两 个RR之间相互发放路由,就多出一倍,如果将两 个RR同指定为一个cluster后,就可以减少开销
R1(config-router)#bgp cluster-id 1
R2(config-router)#bgp cluster-id 1
在没有指定之前:
R1#show ip bgp
BGP table version is 35, 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
* i172.16.1.0/24 2.2.2.2 0 100 0 i
*> 0.0.0.0 0 32768 i
*> 172.16.2.0/24 0.0.0.0 0 32768 i
*> 172.16.3.0/24 0.0.0.0 0 32768 i
r>i172.16.4.0/24 2.2.2.2 0 100 0 i
r>i172.16.5.0/24 2.2.2.2 0 100 0 i
r i172.16.6.0/24 172.16.6.5 0 100 0 200 i
r>i 172.16.6.5 0 100 0 200 i
* i192.168.1.0 172.16.6.5 0 100 0 200 i
*>i 172.16.6.5 0 100 0 200 i
* i192.168.2.0 172.16.6.5 0 100 0 200 i
*>i 172.16.6.5 0 100 0 200 i
R2#show ip bgp
BGP table version is 26, 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
* i172.16.1.0/24 1.1.1.1 0 100 0 i
*> 0.0.0.0 0 32768 i
r>i172.16.2.0/24 1.1.1.1 0 100 0 i
r>i172.16.3.0/24 1.1.1.1 0 100 0 i
*> 172.16.4.0/24 0.0.0.0 0 32768 i
*> 172.16.5.0/24 0.0.0.0 0 32768 i
r i172.16.6.0/24 172.16.6.5 0 100 0 200 i
r>i 172.16.6.5 0 100 0 200 i
* i192.168.1.0 172.16.6.5 0 100 0 200 i
*>i 172.16.6.5 0 100 0 200 i
* i192.168.2.0 172.16.6.5 0 100 0 200 i
*>i 172.16.6.5 0 100 0 200 i
指定之后:
R1#show ip bgp
BGP table version is 35, 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
* i172.16.1.0/24 2.2.2.2 0 100 0 i
*> 0.0.0.0 0 32768 i
*> 172.16.2.0/24 0.0.0.0 0 32768 i
*> 172.16.3.0/24 0.0.0.0 0 32768 i
r>i172.16.4.0/24 2.2.2.2 0 100 0 i
r>i172.16.5.0/24 2.2.2.2 0 100 0 i
r>i172.16.6.0/24 172.16.6.5 0 100 0 200 i
*>i192.168.1.0 172.16.6.5 0 100 0 200 i
*>i192.168.2.0 172.16.6.5 0 100 0 200 i
R2#show ip bgp
BGP table version is 26, 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
* i172.16.1.0/24 1.1.1.1 0 100 0 i
*> 0.0.0.0 0 32768 i
r>i172.16.2.0/24 1.1.1.1 0 100 0 i
r>i172.16.3.0/24 1.1.1.1 0 100 0 i
*> 172.16.4.0/24 0.0.0.0 0 32768 i
*> 172.16.5.0/24 0.0.0.0 0 32768 i
r>i172.16.6.0/24 172.16.6.5 0 100 0 200 i
*>i192.168.1.0 172.16.6.5 0 100 0 200 i
*>i192.168.2.0 172.16.6.5 0 100 0 200 i
在R4上看到:
R4#show ip bgp 192.168.1.0
BGP routing table entry for 192.168.1.0/24, version 33
Paths: (2 available, best #1, table Default-IP-Routing-Table)
Not advertised to any peer
200
172.16.6.5 (metric 192) from 1.1.1.1 (1.1.1.1)
Origin IGP, metric 0, localpref 100, valid, internal, best
Originator: 3.3.3.3, Cluster list: 0.0.0.1
200
172.16.6.5 (metric 192) from 2.2.2.2 (2.2.2.2)
Origin IGP, metric 0, localpref 100, valid, internal
Originator: 3.3.3.3, Cluster list: 0.0.0.1
本文出自 “xiaomu205.com” 博客,转载请与作者联系!