实验内容:
通过本实验验证bgp路由反射器的规则
1. 从client收到的路由更新,反射到non-client和client,同时发送给EBGP邻居
2. 从non-client收到的路由更新,只反射到client,同时发送给EBGP邻居
3. 从EBGP邻居收到的路由更新,发送到所有的non-client和client
实验拓扑如图
实验配置如下:
基本配置:
路由器1
interface GigabitEthernet 0/0
no switchport
ip address 10.1.12.1 255.255.255.252
!
interface Loopback 0
ip address 1.1.1.1 255.255.255.255
!
interface Loopback 1
ip address 1.1.2.1 255.255.255.255
!
interface Loopback 2
ip address 1.1.3.1 255.255.255.255
!
interface Loopback 4
ip address 1.1.4.1 255.255.255.255
!
router bgp 100
neighbor 10.1.12.2 remote-as 200
network 1.1.1.1 mask 255.255.255.255
network 1.1.2.1 mask 255.255.255.255
network 1.1.3.1 mask 255.255.255.255
network 1.1.4.1 mask 255.255.255.255
路由器2
interface GigabitEthernet 0/0
no switchport
ip address 10.1.12.2 255.255.255.252
!
interface GigabitEthernet 0/1
no switchport
ip address 10.1.23.1 255.255.255.252
!
interface Loopback 0
ip address 2.2.2.2 255.255.255.255
!
router bgp 200
neighbor 3.3.3.3 remote-as 200
neighbor 3.3.3.3 update-source Loopback 0
neighbor 10.1.12.1 remote-as 100
neighbor 3.3.3.3 next-hop-self
!
router ospf 200
router-id 2.2.2.2
network 2.2.2.2 0.0.0.0 area 0
network 10.1.23.1 0.0.0.0 area 0
路由器3
!
interface GigabitEthernet 0/0
no switchport
ip address 10.1.34.1 255.255.255.252
!
interface GigabitEthernet 0/1
no switchport
ip address 10.1.23.2 255.255.255.252
!
interface GigabitEthernet 0/2
no switchport
ip address 10.1.35.1 255.255.255.252
!
interface Loopback 0
ip address 3.3.3.3 255.255.255.255
!
router bgp 200
neighbor 2.2.2.2 remote-as 200
neighbor 2.2.2.2 update-source Loopback 0
neighbor 4.4.4.4 remote-as 200
neighbor 4.4.4.4 update-source Loopback 0
neighbor 5.5.5.5 remote-as 200
neighbor 5.5.5.5 update-source Loopback 0
neighbor 2.2.2.2 next-hop-self
!
router ospf 200
router-id 3.3.3.3
network 3.3.3.3 0.0.0.0 area 0
network 10.1.23.2 0.0.0.0 area 0
network 10.1.34.1 0.0.0.0 area 0
network 10.1.35.1 0.0.0.0 area 0
路由器4
interface GigabitEthernet 0/0
no switchport
ip address 10.1.34.2 255.255.255.252
!
interface Loopback 0
ip address 4.4.4.4 255.255.255.255
!
router bgp 200
neighbor 3.3.3.3 remote-as 200
neighbor 3.3.3.3 update-source Loopback 0
!
router ospf 200
router-id 4.4.4.4
network 4.4.4.4 0.0.0.0 area 0
network 10.1.34.2 0.0.0.0 area 0
路由器5
interface GigabitEthernet 0/2
no switchport
ip address 10.1.35.2 255.255.255.252
!
interface Loopback 0
ip address 5.5.5.5 255.255.255.255
!
router bgp 200
neighbor 3.3.3.3 remote-as 200
neighbor 3.3.3.3 update-source Loopback 0
!
router ospf 200
route-id 5.5.5.5
network 5.5.5.5 0.0.0.0 area 0
network 10.1.35.2 0.0.0.0 area 0
此时的R4,R5的bgp表上应该是没有任何路由的,因为ibgp之间存在水平分割
接下来通过配置路由反射器来实现路由的传递
路由器3
router bgp 200
neighbor 2.2.2.2 route-reflector-client //将R2设置为client
不配置的ibgp邻居默认为no-client,此时的R4,R5上就可以看到R1传过来的路由了,路由反射器的规则1就验证完成了
路由器4
router bgp 200
network 4.4.4.4 mask 255.255.255.255 //用于验证规则2
路由器5
router bgp 200
network 5.5.5.5 mask 255.255.255.255 //用于验证规则2
这时的R2可以收到R4,R5发来的路由,而R4,R5之间收不到彼此发送的路由---规则2
此时R2,R4,R5的bgp表如下