目录
MPLS隧道——带RR的跨域解决方案讲解(B、C1、C2方案)-CSDN博客
根据图配置接口的IP地址和IGP协议
配置BGP邻居的建立
PE1和RR1建立IBGP邻居、RR1和ASBR1建立IBGP邻居(RR1作为反射器)
PE1和RR1建立MP-IBGP邻居(RR1传给PE1的Vpnv4路由要求更改下一跳-默认)
ASBR1和ASBR2建立EBGP邻居
ASBR2和RR2建立IBGP邻居、RR2和PE2建立IBGP邻居(RR2作为反射器)
PE2和RR2建立MP-IBGP邻居(RR2传给PE2的Vpnv4路由要求更改下一跳-默认)
PE1和RR1建立IBGP邻居(RR1为反射器)和MP-IBGP邻居
PE1
bgp 100
peer 7.7.7.7 as-number 100
peer 7.7.7.7 connect-interface LoopBack0
#
ipv4-family unicast
undo synchronization
peer 7.7.7.7 enable
ipv4-family vpnv4
policy vpn-target
peer 7.7.7.7 enable
RR1
bgp 100
peer 1.1.1.1 as-number 100
peer 1.1.1.1 connect-interface LoopBack0
ipv4-family unicast
peer 1.1.1.1 enable
peer 1.1.1.1 reflect-client 配置1.1.1.1为反射客户端(本端为反射器)
ipv4-family vpnv4
undo policy vpn-target 取消RT值检测
peer 1.1.1.1 enable 配置MP-BGP邻居
RR1和ASBR1建立IBGP邻居(RR1为反射器,ASBR1配置从EBGP学到的路由传给IBGP时更改下一跳)
RR1
bgp 100
peer 3.3.3.3 as-number 100
peer 3.3.3.3 connect-interface LoopBack0
ipv4-family unicast
peer 3.3.3.3 enable
peer 3.3.3.3 reflect-client
ASBR1
bgp 100
peer 7.7.7.7 as-number 100
peer 7.7.7.7 connect-interface LoopBack0
ipv4-family unicast
peer 7.7.7.7 enable
peer 7.7.7.7 next-hop-local
ASBR1和ASBR2建立EBGP邻居
ASBR1
bgp 100
peer 100.0.34.4 as-number 200
ipv4-family unicast
peer 100.0.34.4 enable
ASBR2
bgp 200
peer 100.0.34.3 as-number 100
ipv4-family unicast
peer 100.0.34.3 enable
ASBR2和RR2建立IBGP邻居(RR2为反射器,ASBR2配置从EBGP学到的路由传给IBGP时更改下一跳)
ASBR2
bgp 200
peer 8.8.8.8 as-number 200
peer 8.8.8.8 connect-interface LoopBack0
ipv4-family unicast
peer 8.8.8.8 enable
peer 8.8.8.8 next-hop-local
RR2
bgp 200
peer 4.4.4.4 as-number 200
peer 4.4.4.4 connect-interface LoopBack0
ipv4-family unicast
peer 4.4.4.4 enable
peer 4.4.4.4 reflect-client
RR2和PE2建立IBGP邻居和MP-IBGP邻居(RR2为反射器)
RR2
bgp 200
peer 6.6.6.6 as-number 200
peer 6.6.6.6 connect-interface LoopBack0
ipv4-family unicast
peer 6.6.6.6 enable
peer 6.6.6.6 reflect-client
ipv4-family vpnv4
undo policy vpn-target
peer 6.6.6.6 enable
PE2
bgp 200
peer 8.8.8.8 as-number 200
peer 8.8.8.8 connect-interface LoopBack0
ipv4-family unicast
undo synchronization
peer 8.8.8.8 enable
ipv4-family vpnv4
policy vpn-target
peer 8.8.8.8 enable
配置MPLS LDP
除了ASBR之间相连的接口、PE与CE相连接口,其余的接口都开启MPLS LDP
以PE1的配置为例(其余设备的配置同PE1)——ASBR之间的接口只开启MPLS
全局开启MPLS LDP
mpls lsr-id 1.1.1.1
mpls
mpls ldp
接口下配置MPLS LDP
interface GigabitEthernet0/0/1
mpls
mpls ldp
配置RR之间的MP-BGP邻居
RR1和RR2建立MP-EBGP邻居
(RR1传给RR2、RR2传给RR1的Vpnv4路由要求更改下一跳-默认会更改)
在ASBR上通过BGP邻居将RR1的路由传给RR2、将RR2的路由传给RR1
ASBR1
bgp 100
ipv4-family unicast
network 1.1.1.1 255.255.255.255
ASBR2
bgp 200
ipv4-family unicast
network 6.6.6.6 255.255.255.255
配置RR之间的MP-EBGP邻居
RR1
bgp 100
peer 8.8.8.8 as-number 200
peer 8.8.8.8 ebgp-max-hop 10
peer 8.8.8.8 connect-interface LoopBack0
ipv4-family unicast
undo peer 8.8.8.8 enable
ipv4-family vpnv4
undo policy vpn-target
peer 8.8.8.8 enable
peer 8.8.8.8 next-hop-invariable
RR2
bgp 200
peer 7.7.7.7 as-number 100
peer 7.7.7.7 ebgp-max-hop 10
peer 7.7.7.7 connect-interface LoopBack0
ipv4-family unicast
undo peer 7.7.7.7 enable
ipv4-family vpnv4
undo policy vpn-target
peer 7.7.7.7 enable
peer 7.7.7.7 next-hop-invariable
此时双方虽然有对端的路由,但是无法建立邻居,此时需要在ASBR为RR手动分配标签
ASBR1为RR1分配标签给ASBR2;ASBR2为RR2分配标签给ASBR1
ASBR之间相连接口开启MPLS
int g0/0/0
mplsASBR1
ip ip-prefix PE1-RR1 index 10 permit 7.7.7.7 32
route-policy PE1-RR1 permit node 10 此路由策略的目的为匹配7.7.7.7路由,为其分配标签
if-match ip-prefix PE1-RR1
apply mpls-label
bgp 100
ipv4-family unicast
peer 100.0.34.4 route-policy PE1-RR1 export 向100.0.34.4的邻居应用此路由策略
peer 100.0.34.4 label-route-capability 向100.0.34.4的邻居开启标签转发能力(可以向此邻居转发带标签的BGP路由)
ASBR2
ip ip-prefix PE2-RR2 index 20 permit 8.8.8.8 32
route-policy PE2-RR2 permit node 10
if-match ip-prefix PE2-RR2
apply mpls-label
bgp 200
ipv4-family unicast
peer 100.0.34.3 route-policy PE2-RR2 export
peer 100.0.34.3 label-route-capability
ASBR2获得RR1的标签后,重新分配标签分发给RR2
ASBR2
route-policy label permit node 10
if-match mpls-label
apply mpls-label
bgp 200
ipv4-family unicast
peer 8.8.8.8 route-policy label export
peer 8.8.8.8 label-route-capability
RR2
bgp 200
ipv4-family unicast
peer 4.4.4.4 label-route-capability
ASBR1获得RR2的标签后,重新分配标签分发给RR1
ASBR1
route-policy label permit node 10
if-match mpls-label
apply mpls-label
bgp 200
ipv4-family unicast
peer 7.7.7.7 route-policy label export
peer 7.7.7.7 label-route-capability
RR1
bgp 100
ipv4-family unicast
peer 3.3.3.3 label-route-capability
此时可以在RR上查看到关于对端RR的LSP标签路径,并且邻居建立RR邻居建立成功
此时RR将PE1上的Vpnv4路由传给PE2,PE2收到后,下一跳为8.8.8.8
此时CE2去往CE1的路由
PE2上封装RR2为CE1分配的私网标签,然后再封装LDP为RR2生成的公网标签
RR2收到后更改最内层标签,并封装RR1标签,再封装LDP标签发给ASBR;后续不做讲解,类似该标签的封装与解封装
![]()
PE和CE之间的配置不做介绍,同非RR场景下的的C1实验配置