锐捷mpls 解决BGP路由黑洞问题

本实验使用eve-ng模拟平台的锐捷设备实现
锐捷mpls 解决BGP路由黑洞问题_第1张图片

r1
ena
conf t
host r1
line con 0
exec-t 0 0
exit

int lo 0
ip add 10.1.1.1 255.255.255.255
!4个255表示前边网段只有一个ip地址
int lo 1
ip add 10.1.1.2 255.255.255.255
int g0/0
no switchport !锐捷RSR路由器要取消交换功能才可以配置ip地址
ip add 11.1.1.1 255.255.255.252
no shut !启用接口,默认启用
exit

router bgp 10 !进入bgp协议 ,as10
router-id 10.1.1.1 !声明bgp的router-id
nei 11.1.1.2 remote-as 20 !指定bgp邻居,和邻居的自治系统号,如果和自己的as号不一样,表示是EBGP邻居
net 10.1.1.1 mask 255.255.255.255 !使用network发布一个网段
redis conn !使用重发布方式发布一个直连网段

show this !锐捷设备可以在任何模式下查看当前 模式配置
show run
show ip bpg summary !查看bgp概要信息
show ip bpg !查看bgp的路由情况,表示可用,>表示最优路由,、
show ip route bgp !查看bgp的路由表,只有最优路由会加入到路由表中

======r2
ena
conf t
host r2
line con 0
exec-t 0 0
exit

int lo 0
ip add 10.2.1.1 255.255.255.255
int lo 1
ip add 10.2.1.2 255.255.255.255
int g0/0
no switchport
ip add 11.1.1.2 255.255.255.252
no shut
int g0/1
no switchport
ip add 12.1.1.1 255.255.255.252
no shut
exit

router ospf 1
router-id 10.2.1.1
yes !锐捷设备修改ospf的router-id要输入yes确认
net 10.2.1.1 0.0.0.0 area 0
network 12.1.1.0 0.0.0.3 area 0
exit

router bgp 20
bgp router-id 10.2.1.1
nei 11.1.1.1 remote-as 10
nei 10.4.1.1 remote-as 20 !r2有两个邻居一个内部邻居一个外部
network 10.2.1.2 mask 255.255.255.255
nei 10.4.1.1 update-source lo 0
!update-source ,IBGP一般使用回环接口建立,要使用这条命令来声明使用哪个回环接口
!IBGP邻居使用回环接口是一定要TCP可达,即通过内部协议可以通信,这个实验中使用的ospf,如果IBGP邻居处于active状态,有可能是回环接口间不可达。

======r3
ena
conf t
host r3
line con 0
exec-t 0 0
exit

int lo 0
ip add 10.3.1.1 255.255.255.255
int lo 1
ip add 10.3.1.2 255.255.255.255
int g0/0
no switchport
ip add 12.1.1.2 255.255.255.252
no shut
int g0/1
no switchport
ip add 13.1.1.1 255.255.255.252
no shut
exit

router ospf 1
router-id 10.3.1.1
yes
net 12.1.1.0 0.0.0.3 area 0
net 13.1.1.0 0.0.0.3 area 0
net 10.3.1.1 0.0.0.0 area 0
net 10.3.1.2 0.0.0.0 area 0
exit

======r4
ena
conf t
host r4
line con 0
exec-t 0 0
exit

int lo 0
ip add 10.4.1.1 255.255.255.255
int lo 1
ip add 10.4.1.2 255.255.255.255
int g0/0
no switchport
ip add 13.1.1.2 255.255.255.252
no shut
int g0/1
no switchport
ip add 14.1.1.1 255.255.255.252
no shut
exit

router ospf 1
router-id 10.4.1.1
net 13.1.1.0 0.0.0.3 area 0
net 10.4.1.1 0.0.0.0 area 0

exit

router bgp 20
bgp router-id 10.4.1.1
nei 14.1.1.2 remote-as 30
nei 10.2.1.1 remote-as 20
net 10.4.1.2 mask 255.255.255.255
nei 10.2.1.1 update-source lo 0

=====r5
ena
conf t
host r5
line con 0
exec-t 0 0
exit

int lo 0
ip add 10.5.1.1 255.255.255.255
int lo 1
ip add 10.5.1.2 255.255.255.255
int g0/0
no switchport
ip add 14.1.1.2 255.255.255.252
no shut
exit

router bgp 30
bgp router-id 10.5.1.1
nei 14.1.1.1 remote-as 20
net 10.5.1.1 mask 255.255.255.255
net 10.5.1.2 mask 255.255.255.255

验证:查看路由表,

但是数据传输不可达

原因:在AS20中R3路由器没有运行bgp,但是iBGP邻居可以跨设备建立,只要tcp/ip可达。!!bgp可以跨设备传递路由。但数据层面传输到R3时,r3查询不到目标的路由(目标路由是通过bgp发布的),将数据包丢弃,在网络中称为路由黑洞。
解决方法:1、将bgp路由发布到ospf中(重发布),但是ibgp内部路由器没法承受大量的路由。
2、r3等其它ibgp的设备都运行BGP,不是所有设备都可以很好的运行BGP协议。
3、使用MPLS技术(采用)

1:重发布方式
r2和r5上配置
router ospf 1
redis bgp sub

R1和r5可以通信

2、IBGP内部全部实现bgp协议
sw3上启用bgp,sw2,sw4上添加sw3做为bgp邻居
sw3:
router bgp 20
nei 10.2.1.1. remote-as 20
nei 10.4.1.1 remote-as 20
nei 10.2.1.1 update-source lo 0
nei 10.4.1.1 update-source lo 0
sw2,sw4略

可以看到并没有加入到路由表,原因是下一跳不可,因为,BGP的下一跳是以AS(自治系统)做为下一跳。
IBGp边界路由器要配置:”nei 邻居地址 next-hop-self” 意义是告诉邻居你的下一跳要本路由器。例如:r2(config-router)#nei 10.3.1.1 next-hop-self

4、使用MPLS解决,主要采用

本实验在R2,R3,R4上配置mpls
1)全局开启MPLS转发功能
R2(config)#mpls ip
2)全局开启LDP标签分发协议
R2(config)#mpls router ldp
R2(config-mpls-router)#ldp router-id interface loopback 0 forc
//建议此处指定LDP的router-id的时候,使用loopback接口且使用force的强制属性。
3)开启接口的标签交换能力
R2(config)#int gigabitEthernet 0/01
R2(config-GigabitEthernet 0/1)#label-switching
R2(config-GigabitEthernet 0/0.23)#mpls ip

配置完成以后,依然不能通信,有明白的朋友请留言指教,不知道是配置问题还是EVE-NG的问题。
在这里插入图片描述

你可能感兴趣的:(网络技术,网络协议)