实验目的:
l掌握BGP联邦工作原理
实验说明:
l通过此实验练习,可以灵活的使用BGP联邦
实验环境:
l五台支持SPSERVICES的IOS的路由器
l直通线
实验拓扑:
实验步骤:
R4(config)#interface f0/0
R4(config-if)#ip address 24.1.1.4 255.255.255.0
R4(config-if)#no shutdown
R4(config)#router bgp 1
R4(config-router)#bgp router-id 4.4.4.4
R4(config-router)#neighbor 24.1.1.2 remote-as 2
R2(config)#interface f0/0
R2(config-if)#ip address 24.1.1.2 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#int f1/0
R2(config-if)#ip address 12.1.1.2 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#int lo 0
R2(config-if)#ip address 2.2.2.2 255.255.255.255
R2(config)#router ospf 110
R2(config-router)#router-id 2.2.2.2
R2(config-router)#network 2.2.2.2 0.0.0.0 a 0
R2(config-router)#network 12.1.1.2 0.0.0.0 a 0
R2(config)#router bgp 21(创建bgp21)
R2(config-router)#bgp confederation identifier 2(表示真正的BGP为2)
R2(config-router)#neighbor 24.1.1.4 remote-as 1
R2(config-router)#neighbor 1.1.1.1 remote-as 21
R2(config-router)#neighbor 1.1.1.1 update-source lo 0
R2(config-router)#neighbor 1.1.1.1 next-hop-self
R1(config)#interface f1/0
R1(config-if)#ip address 12.1.1.1 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#int f1/1
R1(config-if)#ip address 13.1.1.1 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#int lo 0
R1(config-if)#ip address 1.1.1.1 255.255.255.255
R1(config)#router ospf 110
R1(config-router)#router-id 1.1.1.1
R1(config-router)#network 12.1.1.1 0.0.0.0 a 0
R1(config-router)#network 13.1.1.1 0.0.0.0 a 0
R1(config-router)#network 1.1.1.1 0.0.0.0 a 0
R1(config)#router bgp 21
R1(config-router)#bgp confederation identifier 2
R1(config-router)#neighbor 2.2.2.2 remote-as 21
R1(config-router)#neighbor 2.2.2.2 update-source lo 0
R1(config-router)#bgp confederation peers 22(定义与2.2.2.2建立EBGP邻居由于与2.2.2.2实际建立的是IBGP关系,因此通过此命令说明)
R1(config-router)#neighbor 3.3.3.3 remote-as 22
R1(config-router)#neighbor 3.3.3.3 update-source lo 0
R1(config-router)#neighbor 3.3.3.3 ebgp-multihop 2(在IBGP的环境下建立EBGP邻居通常建议使用环回口建立)
R3(config)#int f1/1
R3(config-if)#ip address 13.1.1.3 255.255.255.0
R3(config-if)#no shutdown
R3(config-if)#int f0/0
R3(config-if)#ip address 35.1.1.3 255.255.255.0
R3(config-if)#no shutdown
R3(config-if)#int lo 0
R3(config-if)#ip address 3.3.3.3 255.255.255.255
R3(config)#router ospf 110
R3(config-router)#router-id 3.3.3.3
R3(config-router)#network 13.1.1.3 0.0.0.0 a 0
R3(config-router)#network 3.3.3.3 0.0.0.0 a 0
R3(config)#router bgp 22
R3(config-router)#bgp confederation identifier 2
R3(config-router)#bgp confederation peers 21
R3(config-router)#neighbor 1.1.1.1 remote-as 21
R3(config-router)#neighbor 1.1.1.1 update-source lo 0
R3(config-router)#neighbor 1.1.1.1 ebgp-multihop 2
R3(config-router)#neighbor 35.1.1.5 remote-as 3
R5(config)#int f0/0
R5(config-if)#ip address 35.1.1.5 255.255.255.0
R5(config-if)#no shutdown
R5(config)#router bgp 3
R5(config-router)#bgp router-id 5.5.5.5
R5(config-router)#neighbor 35.1.1.3 remote-as 2
验证:
R4(config-if)#int lo 11
R4(config-if)#ip address 11.11.11.11 255.255.255.255
R4(config-if)#int lo 22
R4(config-if)#ip address 22.22.22.22 255.255.255.255
R4(config-if)#int lo 33
R4(config-if)#ip address 33.33.33.33 255.255.255.255
R4(config-if)#int lo 44
R4(config-if)#ip address 44.44.44.44 255.255.255.255
R4(config)#router bgp 1
R4(config-router)#network 11.11.11.11 mask 255.255.255.255
R4(config-router)#network 22.22.22.22 mask 255.255.255.255
R4(config-router)#network 33.33.33.33 mask 255.255.255.255
R4(config-router)#network 44.44.44.44 mask 255.255.255.255
此时查看R5收到的路由
R5#show ip bgp
Network Next Hop Metric LocPrf Weight Path
*> 11.11.11.11/32 35.1.1.3 0 2 1 i
*> 22.22.22.22/32 35.1.1.3 0 2 1 i
*> 33.33.33.33/32 35.1.1.3 0 2 1 i
*> 44.44.44.44/32 35.1.1.3 0 2 1 i
总结:
BGP联邦类似于RR技术,都是为了打破IBGP水平分割规则,简化IBGP的配置而设计,由于联邦在逻辑上更加难理解,因此在后期RR技术替代了联邦。