HCIP实验5-mpls实验

发布时间:2024年01月24日

搭建实验拓扑图

要求

全网可达

实验开始

配置IP地址及环回

这里已经配置好,不再赘述,具体可参考之前实验

OSPF,RIP

r7配置OSPF,r8配置RIP,这里已配置好?

配置mpls

步骤:

1、IP可达--- 使用路由协议全网可达
2、配置MPLS – LDP
[r2]mpls lsr-id 2.2.2.2? ? ? //必须先定义mpls的router-id,要为本地设备的真实ip地址,且邻居可达,因为该地址将用于建立TCP会话,建议使用环回地址
[r2]mpls? ? ? ? ? ? ? ? ? ? ? ? //再开启mpls协议
[r2-mpls]mpls ldp? ? ? ? ?//再激活LDP协议
[r2-mpls-ldp]q
之后需要在所有标签经过的接口上开启协议
[r2]interface GigabitEthernet 0/0/1
[r2-GigabitEthernet0/0/1]mpls? ? ? ? ? ? //先开启MPLS
[r2-GigabitEthernet0/0/1]mpls ldp? ? ? //再激活LDP协议
[r2]route recursive-lookup tunnel? ? ? ? //开启隧道递归

r2

[r2]mpls lsr-id 2.2.2.2
[r2]mpls
[r2-mpls]mpls ld
[r2-mpls-ldp]q
[r2]int g0/0/1
[r2-GigabitEthernet0/0/1]mpls 
[r2-GigabitEthernet0/0/1]mpls ldp
[r2]int g0/0/2
[r2-GigabitEthernet0/0/2]mpls 
[r2-GigabitEthernet0/0/2]mpls ldp
[r2]ip vpn-instance 1   
[r2-vpn-instance-1]route-distinguisher 1:1   
[r2-vpn-instance-1-af-ipv4]vpn-target 5:5 6:6 import-extcommunity 
 IVT Assignment result: 
Info: VPN-Target assignment is successful. 
[r2-vpn-instance-1-af-ipv4]vpn-target 1:1 export-extcommunity 
[r2-GigabitEthernet0/0/0]undo ip add
[r2-GigabitEthernet0/0/0]ip binding vpn-instance 1     //注:这里需先把ip地址删除
[r2-GigabitEthernet0/0/0]ip add 12.1.1.2 24               //再配上ip
[r2]ip route-static vpn-instance 1 1.1.1.1 32 12.1.1.1
[r2]bgp 1
[r2-bgp]ipv4-family vpn-instance 1   
[r2-bgp-1]import-route static 

r3,r4配置相同 (这里以r3为例)

[r3]mpls lsr-id 3.3.3.3
[r3]mpls 
[r3-mpls]mpls ld
[r3-mpls-ldp]q
[r3]int g0/0/0
[r3-GigabitEthernet0/0/0]mpls
[r3-GigabitEthernet0/0/0]mpls ldp

[r3]int g0/0/1
[r3-GigabitEthernet0/0/1]mpls 
[r3-GigabitEthernet0/0/1]mpls ldp

[r3]int g0/0/2
[r3-GigabitEthernet0/0/2]mpls 
[r3-GigabitEthernet0/0/2]mpls ldp

r5

[r5]mpls lsr-id 5.5.5.5
[r5]mpls
Info: Mpls starting, please wait... OK!
[r5-mpls]mpls ldp
[r5-mpls-ldp]q
[r5]int g0/0/0
[r5-GigabitEthernet0/0/0]mpls
[r5-GigabitEthernet0/0/0]mpls ldp
[r5]int g0/0/1
[r5-GigabitEthernet0/0/1]mpls
[r5-GigabitEthernet0/0/1]mpls ldp
[r5]ip vpn    
[r5]ip vpn-instance 2 
[r5-vpn-instance-2]route-distinguisher 5:5  
[r5-vpn-instance-2-af-ipv4]vpn-target 1:1 6:6 import-extcommunity 
 IVT Assignment result: 
Info: VPN-Target assignment is successful.
[r5-vpn-instance-2-af-ipv4]vpn-target 5:5 export-extcommunity 
 EVT Assignment result: 
Info: VPN-Target assignment is successful.
[r5-vpn-instance-2-af-ipv4]q
[r5-vpn-instance-2]q
[r5]int g0/0/2
[r5-GigabitEthernet0/0/2]undo ip add   
[r5-GigabitEthernet0/0/2]ip binding vpn-instance 2
[r5-GigabitEthernet0/0/2]ip add 57.1.1.1 24
[r5]rip 1 vpn-instance 2
[r5-rip-1]version 2
[r5-rip-1]network 57.0.0.0
[r5-rip-1]import-router bgp
[r5-rip-1]q
[r5]bgp 100
[r5-bgp]ipv4-family vpn-instance 2
[r5-bgp-2]import-route rip 1

?r6

[r6]ip vpn    
[r6]ip vpn-instance 3
[r6-vpn-instance-3]rou    
[r6-vpn-instance-3]route-distinguisher 6:6
[r6-vpn-instance-3-af-ipv4]vpn-target 1:1 5:5 import-extcommunity 
 IVT Assignment result: 
Info: VPN-Target assignment is successful.  
[r6-vpn-instance-3-af-ipv4]vpn-target 6:6 export-extcommunity 
 EVT Assignment result: 
Info: VPN-Target assignment is successful.
[r6-vpn-instance-3-af-ipv4]q
[r6-vpn-instance-3]q
[r6]int g0/0/2
[r6-GigabitEthernet0/0/2]ip add 68.1.1.1 24
[r6]ospf 2 vpn    
[r6]ospf 2 vpn-instance 3
[r6-ospf-2]area 0  
[r6-ospf-2-area-0.0.0.0]network 68.1.1.1 0.0.0.0
[r6]bgp 100
[r6-bgp]ipv4-family vpn-instance 3
[r6-bgp-3]import-route ospf 2

测试

?在r1上ping 8.8.8.8

至此,实验结束

文章来源:https://blog.csdn.net/2201_75769266/article/details/135825501
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。