要求:通过使用BGP来实现所有设备的环回都能ping通
实验的思路
完成所有路由器的IGP配置
使用直连接口建立EBGP对等体关系
使用环回接口建立IBGP对等体关系
使用connect-interface命令修改IBGP的源IP地址
使用next-hop-local命令修改路由传递的下一跳属性
IGP
R1/2和R4/5
R4与R5之间要配置静态
首先,配置IP地址,本人习惯,左边为x.x.x.1 右边为 x.x.x.2
随后,AS200自治区域内进行ospf配置
R2:
ospf 1 router-id 2.2.2.2
area 0.0.0.0
network 2.2.2.2 0.0.0.0
network 23.0.0.1 0.0.0.0
R3:
ospf 1 router-id 3.3.3.3
area 0.0.0.0
network 3.3.3.3 0.0.0.0
network 23.0.0.2 0.0.0.0
network 34.0.0.1 0.0.0.0
R4:
ospf 1 router-id 4.4.4.4
area 0.0.0.0
network 4.4.4.4 0.0.0.0
network 34.0.0.2 0.0.0.0
随后,进行BGP的配置
R1:
bgp 100
router-id 1.1.1.1
peer 12.0.0.2 as-number 200
network 1.1.1.1 255.255.255.255
R2:
bgp 200
router-id 2.2.2.2
peer 3.3.3.3 as-number 200
peer 3.3.3.3 connect-interface LoopBack0
peer 4.4.4.4 as-number 200
peer 4.4.4.4 connect-interface LoopBack0
peer 12.0.0.1 as-number 100
network 2.2.2.2 255.255.255.255
import-route ospf 1
peer 3.3.3.3 next-hop-local
peer 4.4.4.4 next-hop-local
peer 2.2.2.2 next-hop-local
R3:
bgp 200
router-id 3.3.3.3
peer 2.2.2.2 as-number 200
peer 2.2.2.2 connect-interface LoopBack0
peer 4.4.4.4 as-number 200
peer 4.4.4.4 connect-interface LoopBack0
network 3.3.3.3 255.255.255.255
peer 4.4.4.4 next-hop-local
R4:
bgp 200
peer 2.2.2.2 as-number 200
peer 2.2.2.2 connect-interface LoopBack0
peer 3.3.3.3 as-number 200
peer 3.3.3.3 connect-interface LoopBack0
peer 30.1.1.1 as-number 300 -----------这是我配置的r5环回1的地址,为了防止链路终端
peer 30.1.1.1 ebgp-max-hop 2
peer 30.1.1.1 connect-interface LoopBack0
network 4.4.4.4 255.255.255.255
peer 2.2.2.2 next-hop-local
peer 3.3.3.3 next-hop-local
R5:
bgp 300
router-id 5.5.5.5
peer 4.4.4.4 as-number 200
peer 4.4.4.4 ebgp-max-hop 2
peer 4.4.4.4 connect-interface LoopBack1
network 5.5.5.5 255.255.255.255
ping通检验:
至此,实验完成