3:BGP路由协议配置
事先声明:此实验并不保证正确,但助教让我过了。。
准备在思科模拟器上操作时提示没有BGP协议就没上思科了。。但应该是可以做的。
配置规划
PC1:
IP:10.1.1.2
PC2:
IP:40.1.1.2
RA:
E0:10.1.1.1
E1:20.1.1.2
RB:
E0:20.1.1.1
E1:30.1.1.1
RC:
E0:30.1.1.2
E1:40.1.1.1
代码:
A:
配置IP:
conf
interface fa 0/0
ip address 10.1.1.1 255.255.255.0
exit
interface fa 0/1
ip address 20.1.1.2 255.255.255.0
exit
interface loopback 0
ip address 1.1.1.1 255.255.255.255
exit
启用ospf,把对应接口通告到ospf进程,使得loopback接口可达
router ospf 1
network 10.1.1.1 0.0.0.0 area 0
network 20.1.1.2 0.0.0.0 area 0
network 1.1.1.1 0.0.0.0 area 0
exit
配置IBGP邻居
router bgp 100
neighbor 2.2.2.2 remote-as 100
neighbor 2.2.2.2 update-source loopback 0
exit
B:
配置IP:
conf
interface fa 0/0
ip address 20.1.1.1 255.255.255.0
exit
interface fa 0/1
ip address 30.1.1.1 255.255.255.0
exit
启用ospf,把对应接口通告到ospf进程,使得loopback接口可达
router ospf 1
network 20.1.1.1 0.0.0.0 area 0
network 30.1.1.1 0.0.0.0 area 0
exit
配置IBGP邻居
router bgp 100
neighbor 20.1.1.2 remote-as 100
neighbor 30.1.1.2 remote-as 200
exit
C:
配置IP:
conf
interface fa 0/0
ip address 40.1.1.1 255.255.255.0
exit
interface fa 0/1
ip address 30.1.1.2 255.255.255.0
exit
配置IBGP邻居
router bgp 200
neighbor 30.1.1.1 remote-as 100
exit
通告:
线路配好后:
RA:
router bgp 100
network 10.1.1.0 mask 255.255.255.0
exit
RC:
router bgp 200
network 40.1.1.0 mask 255.255.255.0
exit
1)network命令,在BGP里面是将哪些路由通告到BGP进程,并非对哪些接口启用BGP协议(与rip和ospf含义是不一样),network命令通告的路由,必须本地show ip route有这条路由,且掩码与mask参数的掩码一致,才能通告到BGP进程。
SW1(config)#router bgp 123
SW1(config-router)#network 10.1.1.0 mask 255.255.255.0
SW1(config-router)#exit
SW3(config)#router bgp 123
SW3(config-router)#network 10.4.1.0 mask 255.255.255.0
SW3(config-router)#exit
另外提供一份锐捷官方的示例:
设备连接和图上是一致的
要求至少是:
使用show ip route显示路由器之间使用BGP连接
使用show ip bgp summary 显示BGP通路
在实验中我的RB路由两个端口没有设置OSPF所以无法联通,然后我就设置了一个OSPF使其能联通,所以在show ip route时只显示了一个B(B表示BGP)
我寻思也没哪个前辈做这个。。但这个确实不难就留个纪念8️⃣