实验要求
1.AS1与AS2使用直接接口建立BGP邻居
2.AS2内部使用环回接口建立IBGP邻居,R2与R3使用BGP联邦64512,R4与R5为64513
3.AS2与AS3之间使用换回接口建立BGP邻居
4.实现所有换回互通
R1与R2使用12.1.1.0/24,R2与R3使用23.1.1.0/24,以此类推
R1环回为1.1.1.0/24,R2环回为2.2.2.0/24,以此类推
一、
地址配置完成,先启用ospf协议
R2
ospf 1 router-id 2.2.2.2
area 0.0.0.0
network 2.2.2.0 0.0.0.255
network 23.1.1.0 0.0.0.255
R3
ospf 1 router-id 3.3.3.3
area 0.0.0.0
network 3.3.3.0 0.0.0.255
network 23.1.1.0 0.0.0.255
network 34.1.1.0 0.0.0.255
R4
ospf 1 router-id 4.4.4.4
area 0.0.0.0
network 4.4.4.0 0.0.0.255
network 34.1.1.0 0.0.0.255
network 45.1.1.0 0.0.0.255
R5
ospf 1 router-id 5.5.5.5
area 0.0.0.0
network 5.5.5.0 0.0.0.255
network 45.1.1.0 0.0.0.255
二、
建立BGP邻居
R1
bgp 1
router-id 1.1.1.1
peer 12.1.1.2 as-number 2
R2
bgp 64512
router-id 2.2.2.2
confederation id 2
peer 3.3.3.3 as-number 64512
peer 3.3.3.3 connect-interface LoopBack0
peer 12.1.1.1 as-number 1
R3
bgp 64512
router-id 3.3.3.3
confederation id 2
confederation peer-as 64513//声明对端的小AS号
peer 2.2.2.2 as-number 64512
peer 2.2.2.2 connect-interface LoopBack0
peer 4.4.4.4 as-number 64513
peer 4.4.4.4 ebgp-max-hop 2
peer 4.4.4.4 connect-interface LoopBack0
R4
bgp 64513
router-id 4.4.4.4
confederation id 2
confederation peer-as 64512
peer 3.3.3.3 as-number 64512
peer 3.3.3.3 ebgp-max-hop 2
peer 3.3.3.3 connect-interface LoopBack0
peer 5.5.5.5 as-number 64513
peer 5.5.5.5 connect-interface LoopBack0
R5
bgp 64513
router-id 5.5.5.5
confederation id 2
peer 4.4.4.4 as-number 64513
peer 4.4.4.4 connect-interface LoopBack0
peer 6.6.6.6 as-number 3
peer 6.6.6.6 ebgp-max-hop 2 //用环回接口建立BGP邻居需要修改TTL值
peer 6.6.6.6 connect-interface LoopBack0
ip route-static 6.6.6.6 255.255.255.255 56.1.1.2//换回接口建立邻居需要路由
ip route-static 6.6.6.6 255.255.255.255 65.1.1.2
R6
bgp 3
router-id 6.6.6.6
peer 5.5.5.5 as-number 2
peer 5.5.5.5 ebgp-max-hop 2
peer 5.5.5.5 connect-interface LoopBack0
ip route-static 5.5.5.5 255.255.255.255 56.1.1.1
ip route-static 5.5.5.5 255.255.255.255 65.1.1.1
三、
通告路由
R1只需通告自己路由
bgp 1
network 1.1.1.0 255.255.255.0
R6只需通告自己路由
bgp 3
network 6.6.6.0 255.255.255.0
R2需要通告R2/3/4/5的路由
bgp 64512
network 2.2.2.0 255.255.255.0
network 3.3.3.0 255.255.255.0
network 4.4.4.0 255.255.255.0
network 5.5.5.0 255.255.255.0
peer 3.3.3.3 next-hop-local //对R3传递路由时修改下一跳为本地
R5同理
bgp 64513
network 2.2.2.0 255.255.255.0
network 3.3.3.0 255.255.255.0
network 4.4.4.0 255.255.255.0
network 5.5.5.0 255.255.255.0
peer 4.4.4.4 next-hop-local
最后即可实现环回互通,不一一演示了
<Huawei>ping -a 1.1.1.1 6.6.6.6
PING 6.6.6.6: 56 data bytes, press CTRL_C to break
Reply from 6.6.6.6: bytes=56 Sequence=1 ttl=251 time=120 ms
Reply from 6.6.6.6: bytes=56 Sequence=2 ttl=251 time=50 ms
Reply from 6.6.6.6: bytes=56 Sequence=3 ttl=251 time=60 ms
Reply from 6.6.6.6: bytes=56 Sequence=4 ttl=251 time=60 ms
Reply from 6.6.6.6: bytes=56 Sequence=5 ttl=251 time=70 ms
--- 6.6.6.6 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 50/72/120 ms