HCIP实验(MPLS)

 要求:

使用MPLS VPN技术实现全网可达 

一、配置IP地址

例r1

[r1]int g0/0/0
[r1-GigabitEthernet0/0/0]ip ad 12.1.1.1 24
Jan 11 2023 19:43:18-08:00 r1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state. 
[r1-GigabitEthernet0/0/0]int l0
[r1-LoopBack0]ip ad 1.1.1.1 32

二、启用动态路由协议

isp区启用ospf协议,其他按图所示

例isp区域r2

[r2]ospf 100 router-id 2.2.2.2
[r2-ospf-100]area 0
[r2-ospf-100-area-0.0.0.0]network 23.1.1.2 0.0.0.0
[r2-ospf-100-area-0.0.0.0]network 24.1.1.2 0.0.0.0
[r2-ospf-100-area-0.0.0.0]network 2.2.2.2 0.0.0.0

三、启用MPLS协议

在isp区域的路由器上启用MPLS协议

例r6

[r6]mpls lsr-id 6.6.6.6
[r6]mpls 
Info: Mpls starting, please wait... OK!
[r6-mpls]mpls ld
[r6-mpls-ldp]q
[r6]int g0/0/0
[r6-GigabitEthernet0/0/0]mpls 
[r6-GigabitEthernet0/0/0]mpls ldp 
[r6-GigabitEthernet0/0/0]int g0/0/2
[r6-GigabitEthernet0/0/2]mpls 
[r6-GigabitEthernet0/0/2]mpls ldp 

四、建立BGP对等体关系

r2-r5-r6之间建立ibgp对等体

[r2]bgp 1
[r2-bgp]router-id 2.2.2.2
[r2-bgp]peer 5.5.5.5 as-number 1
[r2-bgp]peer 5.5.5.5 connect-interface l0
[r2-bgp]peer 5.5.5.5 next-hop-local
[r2-bgp]peer 6.6.6.6 as-number 1
[r2-bgp]peer 6.6.6.6 connect-interface l0
[r2-bgp]peer 6.6.6.6 next-hop-local

建立后

五、启用vpn

在 r2-r5-r6之间建立vpn通道

例r2,r5、r6同

[r2]bgp 1
[r2-bgp]ipv4-family vpnv4
[r2-bgp-af-vpnv4]peer 5.5.5.5 enable 
[r2-bgp-af-vpnv4]
[r2-bgp-af-vpnv4]peer 6.6.6.6 enable 
[r2-bgp]q
[r2]ip vpn-instance 2
[r2-vpn-instance-2]route-distinguisher 2:2
[r2-vpn-instance-2-af-ipv4]vpn-target 5:5 6:6 import-extcommunity 
 IVT Assignment result: 
Info: VPN-Target assignment is successful.
[r2-vpn-instance-2-af-ipv4]vpn-target 2:2 export-extcommunity 
 EVT Assignment result: 
Info: VPN-Target assignment is successful.
[r2-vpn-instance-2-af-ipv4]
[r2-vpn-instance-2-af-ipv4]q
[r2-vpn-instance-2]q
[r2]int g0/0/0
[r2-GigabitEthernet0/0/0]undo ip ad 
Jan 11 2023 20:55:42-08:00 r2 %%01IFNET/4/LINK_STATE(l)[8]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the DOWN state. 
[r2-GigabitEthernet0/0/0]ip binding vpn-instance 2
Info: All IPv4 related configurations on this interface are removed!
Info: All IPv6 related configurations on this interface are removed!
[r2-GigabitEthernet0/0/0]ip ad 12.1.1.2 24
Jan 11 2023 20:56:21-08:00 r2 %%01IFNET/4/LINK_STATE(l)[9]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state. 

六、导入路由

将r2上方区域的静态导入bgp

[r2]ip route-static vpn-instance 2 1.1.1.1 32 12.1.1.1
[r2]bgp 1
[r2-bgp]ipv6-family vpn-instance 2
Error: The VPN instance IPv6 address family is not enabled.
[r2-bgp]ipv4-family vpn-instance 2
[r2-bgp-2]import-route static 

将r5下方的rip协议学习的路由做双向重发布

[r5]rip 1 vpn-instance 3
[r5-rip-1]version 2
[r5-rip-1]network 57.0.0.0
[r5-rip-1]import-route bgp 
[r5-rip-1]q
[r5]bgp 1
[r5-bgp]ipv4-family vpn-instance 3
[r5-bgp-3]import-route rip 1

将r6下方的ospf协议学习的路由做双向重发布

[r6]ospf 1 vpn-instance 4 router-id 6.6.6.6
[r6-ospf-1]area 0
[r6-ospf-1-area-0.0.0.0]network 68.1.1.6 0.0.0.0
[r6-ospf-1-area-0.0.0.0]q
[r6-ospf-1]import-route bgp 
[r6-ospf-1]q
[r6-bgp]ipv4-family vpn-instance 4
[r6-bgp-4]import-route ospf 1

查看

 ping测试

 

实验结束…… 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值