MP-BGP/MPLS配置案例

MP-BGP/MPLS配置案例解析

实验拓扑

实验要求

如图,右边设备R5,R7分别为公司A,公司B的分部公司,现要求公司A能够与其分布进行相互访问,公司B能够与其分布进行相互访问,按照如图所示地址进行配置。蓝色表示运营商网络用ISIS做通

实验步骤

1.公网设备互通,运行ISIS,MPLS,LDP

[R2y]int g0/0/0
[R2y-GigabitEthernet0/0/0]ip add 10.0.12.2 24
Aug 23 2025 19:36:38-08:00 R2y %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
 on the interface GigabitEthernet0/0/0 has entered the UP state. 
[R2y-GigabitEthernet0/0/0]int g0/0/1
[R2y-GigabitEthernet0/0/1]ip add 10.0.23.2 24
Aug 23 2025 19:36:50-08:00 R2y %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
 on the interface GigabitEthernet0/0/1 has entered the UP state. 
[R2y-GigabitEthernet0/0/1]int l0
[R2y-LoopBack0]ip add 2.2.2.2 32
[R2y-LoopBack0]isis 1
[R2y-isis-1]net 49.0000.0000.0002.00
[R2y-isis-1]is-level level-2
[R2y-isis-1]int l0
[R2y-LoopBack0]isis en 1
[R2y-LoopBack0]int g0/0/0
[R2y-GigabitEthernet0/0/0]isis en 1
[R2y-GigabitEthernet0/0/0]int g0/0/1
[R2y-GigabitEthernet0/0/1]isis en 1
[R2y]mpls lsr-id 2.2.2.2
[R2y]mpls
Info: Mpls starting, please wait... OK!
[R2y-mpls]mpls ldp
[R2y-mpls-ldp]int g0/0/0
[R2y-GigabitEthernet0/0/0]mpls
[R2y-GigabitEthernet0/0/0]mpls ldp
[R2y-GigabitEthernet0/0/0]int g0/0/1
[R2y-GigabitEthernet0/0/1]mpls
[R2y-GigabitEthernet0/0/1]mpls ldp

通过R2查询到邻居正常建立并获取路由

查看是否有相关mpls表项

2.配置PE间的MP-BGP关系

[R1y]bgp 100
[R1y-bgp]router-id 1.1.1.1
[R1y-bgp]peer 3.3.3.3 as 100
[R1y-bgp]peer 3.3.3.3 connect-interface l0
[R1y-bgp]ipv4-family vpnv4
[R1y-bgp-af-vpnv4]peer 3.3.3.3 enable 

[R3Y-GigabitEthernet0/0/0]bgp 100
[R3Y-bgp]router-id 3.3.3.3
[R3Y-bgp]peer 1.1.1.1 as 100
[R3Y-bgp]peer 1.1.1.1 con l0
[R3Y-bgp]ipv4-family vpnv4
[R3Y-bgp-af-vpnv4]peer 1.1.1.1 en

3.配置VRF隔离用户

[R1y]ip vpn-instance a 	
[R1y-vpn-instance-a]ipv4-family 
[R1y-vpn-instance-a-af-ipv4]route-distinguisher 1:1
[R1y-vpn-instance-a-af-ipv4]vpn-target 10:10 both 

[R3Y]ip vpn-instance a 
[R3Y-vpn-instance-a]ipv4-family
[R3Y-vpn-instance-a-af-ipv4]route-distinguisher 1:2
[R3Y-vpn-instance-a-af-ipv4]vpn-target 10:10 both 

4.绑定物理接口至VRF

[R1y-GigabitEthernet0/0/1]ip binding vpn-instance a
Info: All IPv4 related configurations on this interface are removed!
[R1y-GigabitEthernet0/0/1]ip add 100.0.0.1 24

[R3Y-vpn-instance-a-af-ipv4]int g0/0/1	
[R3Y-GigabitEthernet0/0/1]ip bind vpn-instance a
Info: All IPv6 related configurations on this interface are removed!
[R3Y-GigabitEthernet0/0/1]ip add 100.0.0.3 24

5.配置路由协议使得两端互通,这里左边我配置ospf右边我配置bgp(和bgp相互引入不是和isis)


[R1y]ospf 1 vpn-instance a router-id 1.1.1.1 
[R1y-ospf-1]a 0
[R1y-ospf-1-area-0.0.0.0]net 100.0.0.0 0.0.0.255
[R1y-ospf-1-area-0.0.0.0]quit
[R1y-ospf-1]import-route bgp 
[R1y-ospf-1]bgp 100
[R1y-bgp]ipv4	
[R1y-bgp]ipv4-family vpn	
[R1y-bgp]ipv4-family vpn-instance a
[R1y-bgp-a]impor	
[R1y-bgp-a]import-route ospf 1


[R4a-LoopBack0]ospf 1 r 4.4.4.4
[R4a-ospf-1]a 0
[R4a-ospf-1-area-0.0.0.0]net 192.168.1.0 0.0.0.255
[R4a-ospf-1-area-0.0.0.0]net 100.0.0.0 0.0.0.255
[R4a-ospf-1-area-0.0.0.0]net 4.4.4.4 0.0.0.0
[R3Y]bgp 100
[R3Y-bgp]ipv4-family vpn-instance a
[R3Y-bgp-a]peer 100.0.0.5 as 200

[R5a-bgp]router-id 5.5.5.5
[R5a-LoopBack1]bgp 200
[R5a-bgp]peer 100.0.0.3 as 100
[R5a-bgp]net 192.168.2.0 24

成功让A公司内部互访

同理将B公司以同样方式接入(左边isis右边静态)


[R1y]ip vpn-instance b
[R1y]ipv4-family
[R1y-vpn-instance-b]route-distinguisher 2:1     
[R1y-vpn-instance-b]vpn-target 20:20 both 
[R1y-GigabitEthernet2/0/0]ip binding vpn-instance b
[R1y-GigabitEthernet2/0/0]ip address 100.0.0.1 255.255.255.0 
[R1y]isis 2 vpn-instance b 
[R1y-isis-2]net 49.0000.0000.0001.00
Aug 23 2025 20:50:27-08:00 R1y %%01ISIS/4/START_ENABLE_ISIS(l)[1]:ISIS 512 enabl
ed all ISIS modules. 
[R1y-isis-2]is-level level-1
[R1y-GigabitEthernet2/0/0]isis enable 2
[R1y-isis-2]import-route bgp
[R1y-isis-2]bgp 100
[R1y-bgp]ipv4-family vpn-instance b
[R1y-bgp-b]import-route isis 2
[R7B]ip route-static 0.0.0.0 0 10.0.37.3 

[R3Y]ip vpn-instance b
[R3Y-vpn-instance-b]ipv4-family	
[R3Y-vpn-instance-b-af-ipv4]route-distinguisher 2:2
[R3Y-vpn-instance-b-af-ipv4]vpn-target 20:20
[R3Y-vpn-instance-b-af-ipv4]int g2/0/0
[R3Y-GigabitEthernet2/0/0]ip binding vpn-instance b
Info: All IPv4 related configurations on this interface are removed!
Info: All IPv6 related configurations on this interface are removed!
[R3Y-GigabitEthernet2/0/0]ip add 10.0.37.3 24
Aug 23 2025 20:56:37-08:00 R3Y %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
 on the interface GigabitEthernet2/0/0 has entered the UP state. 
[R3Y-GigabitEthernet2/0/0]quit
[R3Y]ip route-static vpn-instance b 192.168.3.0 24 10.0.37.7
[R3Y-bgp]ipv4-family vpn-instance b
[R3Y-bgp-b]import-route static 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值