HCIP实验5-mpls实验

搭建实验拓扑图

HCIP实验5-mpls实验_第1张图片

要求

全网可达

实验开始

配置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 -instance 1   
[r2--instance-1]route-distinguisher 1:1   
[r2--instance-1-af-ipv4]-target 5:5 6:6 import-extcommunity 
 IVT Assignment result: 
Info: VPN-Target assignment is successful. 
[r2--instance-1-af-ipv4]-target 1:1 export-extcommunity 
[r2-GigabitEthernet0/0/0]undo ip add
[r2-GigabitEthernet0/0/0]ip binding -instance 1     //注:这里需先把ip地址删除
[r2-GigabitEthernet0/0/0]ip add 12.1.1.2 24               //再配上ip
[r2]ip route-static -instance 1 1.1.1.1 32 12.1.1.1
[r2]bgp 1
[r2-bgp]ipv4-family -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     
[r5]ip -instance 2 
[r5--instance-2]route-distinguisher 5:5  
[r5--instance-2-af-ipv4]-target 1:1 6:6 import-extcommunity 
 IVT Assignment result: 
Info: VPN-Target assignment is successful.
[r5--instance-2-af-ipv4]-target 5:5 export-extcommunity 
 EVT Assignment result: 
Info: VPN-Target assignment is successful.
[r5--instance-2-af-ipv4]q
[r5--instance-2]q
[r5]int g0/0/2
[r5-GigabitEthernet0/0/2]undo ip add   
[r5-GigabitEthernet0/0/2]ip binding -instance 2
[r5-GigabitEthernet0/0/2]ip add 57.1.1.1 24
[r5]rip 1 -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 -instance 2
[r5-bgp-2]import-route rip 1

 r6

[r6]ip     
[r6]ip -instance 3
[r6--instance-3]rou    
[r6--instance-3]route-distinguisher 6:6
[r6--instance-3-af-ipv4]-target 1:1 5:5 import-extcommunity 
 IVT Assignment result: 
Info: VPN-Target assignment is successful.  
[r6--instance-3-af-ipv4]-target 6:6 export-extcommunity 
 EVT Assignment result: 
Info: VPN-Target assignment is successful.
[r6--instance-3-af-ipv4]q
[r6--instance-3]q
[r6]int g0/0/2
[r6-GigabitEthernet0/0/2]ip add 68.1.1.1 24
[r6]ospf 2     
[r6]ospf 2 -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 -instance 3
[r6-bgp-3]import-route ospf 2

测试

 在r1上ping 8.8.8.8

HCIP实验5-mpls实验_第2张图片

至此,实验结束

你可能感兴趣的:(网络)