MPLS实验

实验拓扑图:MPLS实验

实验要求:

1:R2、 R3、R4、R5、R6为运营商,跑MPLS

2:R1、R7、R8为CE端,要求R1使用静态与运营商连接,R7用ospf、R8用rip

3:R1、R7、R8互相可以ping通

一、配置底层与环回

二、在R2、3、4、6、7上做ospf

[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.1 0.0.0.0
[r2-ospf-100-area-0.0.0.0]network 26.1.1.1 0.0.0.0
[r2-ospf-100-area-0.0.0.0]net 2.2.2.2 0.0.0.0
[r3]ospf 100 router-id 3.3.3.3
[r3-ospf-100]area 0
[r3-ospf-100-area-0.0.0.0]net    
[r3-ospf-100-area-0.0.0.0]network 0.0.0.0 255.255.255.255
[r4]ospf 100 router-id 4.4.4.4  
[r4-ospf-100]area 0   
[r4-ospf-100-area-0.0.0.0]network 5.5.5.5 0.0.0.0
[r4-ospf-100-area-0.0.0.0]network 34.1.1.2 0.0.0.0
[r4-ospf-100-area-0.0.0.0]network 46.1.1.1 0.0.0.0
[r6]ospf 100 router-id  6.6.6.6 
[r6-ospf-100]area 0
[r6-ospf-100-area-0.0.0.0]network 0.0.0.0 255.255.255.255
[r6]ospf 100 router-id  6.6.6.6  
[r6-ospf-100]area 0
[r6-ospf-100-area-0.0.0.0]network 0.0.0.0 255.255.255.255
[r7]ospf 100 router-id 7.7.7.7
[r7-ospf-100]area 0
[r7-ospf-100-area-0.0.0.0]network 7.7.7.7 0.0.0.0
[r7-ospf-100-area-0.0.0.0]network 67.1.1.2 0.0.0.0
[r7-ospf-100-area-0.0.0.0]net 37.1.1.2 0.0.0.0

三、R2-6起MPLS

起[r2]mpls lsr-id 2.2.2.2    
[r2]mpls     
[r2-mpls]mpls ldp
[r2-mpls-ldp]int g0/0/1
[r2-GigabitEthernet0/0/1]mpls
[r2-GigabitEthernet0/0/1]mpls ld    
[r2-GigabitEthernet0/0/1]mpls ldp 
[r2-GigabitEthernet0/0/1]int g0/0/2
[r2-GigabitEthernet0/0/2]mpls
[r2-GigabitEthernet0/0/2]mpls ldp

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

[r4]mpls lsr-id 4.4.4.4
[r4]mpls        
[r4-mpls]mpls ldp
[r4-mpls-ldp]int g0/0/0
[r4-GigabitEthernet0/0/0]mpls    
[r4-GigabitEthernet0/0/0]mpls ldp 
[r4-GigabitEthernet0/0/0]int g0/0/2
[r4-GigabitEthernet0/0/2]mpls    
[r4-GigabitEthernet0/0/2]mpls ldp

[r6]mpls lsr-id 4.4.4.4
[r6]mpls    
[r6-mpls]mpls ldp
[r6-mpls-ldp]int g0/0/0
[r6-GigabitEthernet0/0/0]mpls    
[r6-GigabitEthernet0/0/0]mpls ldp 
[r6-GigabitEthernet0/0/0]int g0/0/1
[r6-GigabitEthernet0/0/1]mpls    
[r6-GigabitEthernet0/0/1]mpls ldp 
[r6-GigabitEthernet0/0/1]int g0/0/2
[r6-GigabitEthernet0/0/2]mpls
[r6-GigabitEthernet0/0/2]mpls ldp
[r6-GigabitEthernet0/0/2]int g4/0/0
[r6-GigabitEthernet4/0/0]mpls    
[r6-GigabitEthernet4/0/0]mpls ldp 

[r7]mpls lsr-id 7.7.7.7
[r7]mpls    
[r7-mpls]mpls ldp
[r7]int g0/0/0
[r7-GigabitEthernet0/0/0]mpls    
[r7-GigabitEthernet0/0/0]mpls ldp 
[r7-GigabitEthernet0/0/0]int g0/0/2
[r7-GigabitEthernet0/0/2]mpls     
[r7-GigabitEthernet0/0/2]mpls ldp

四、为了使R2--R7通,需要做BGP,且R2、R5、R6为PE 端,在pe端做bgp

[r2]ip vpn-instance a    
[r2-vpn-instance-a]ipv4-family
[r2-vpn-instance-a-af-ipv4]route-distinguisher 1:1
[r2-vpn-instance-a-af-ipv4]vpn-target 1:1    
[r2-vpn-instance-a-af-ipv4]vpn-target 2:2 import-extcommunity     
[r2-vpn-instance-a-af-ipv4]vpn-target 3:3 import-extcommunity 
[r2]int g0/0/0
[r2-GigabitEthernet0/0/0]undo ip add     
[r2-GigabitEthernet0/0/0]ip binding vpn-instance a
[r2-GigabitEthernet0/0/0]ip add 12.1.1.2 24

[r4]ip vpn-instance b    
[r4-vpn-instance-b]ipv4-family
[r4-vpn-instance-b-af-ipv4]route-distinguisher 2:2    
[r4-vpn-instance-b-af-ipv4]vpn-target 2:2    
[r4-vpn-instance-b-af-ipv4]vpn-target 1:1 import-extcommunity     
[r4-vpn-instance-b-af-ipv4]vpn-target 3:3 import-extcommunity 
[r4]int g0/0/1
[r4-GigabitEthernet0/0/1]undo ip add     
[r4-GigabitEthernet0/0/1]ip binding vpn-instance b
[r4-GigabitEthernet0/0/1]ip add 45.1.1.1 24

[r7]ip vpn-instance c
[r7-vpn-instance-c]ipv4-family
[r7-vpn-instance-c-af-ipv4]route-distinguisher 3:3    
[r7-vpn-instance-c-af-ipv4]vpn-target 3:3    
[r7-vpn-instance-c-af-ipv4]vpn-target 1:1 import-extcommunity     
[r7-vpn-instance-c-af-ipv4]vpn-target 2:2 import-extcommunity 
[r7]int g0/0/1
[r7-GigabitEthernet0/0/1]undo ip add 
[r7-GigabitEthernet0/0/1]ip binding vpn-instance c
[r7-GigabitEthernet0/0/1]ip add 78.1.1.1 24

五、R1、R2之间跑静态,R7跑ospf,R8跑rip

[r1]ip route-static 0.0.0.0 0 12.1.1.2

[r2]ip route-static vpn-instance a 1.1.1.1 24 12.1.1.1
[r2]bgp 100
[r2-bgp]ipv4-family vpn-instance a    
[r2-bgp-a]import-route static     
[r2-bgp-a]import-route direct 

[r4]ospf 101 vpn-instance b    
[r4-ospf-101]area 0
[r4-ospf-101-area-0.0.0.0]network 45.1.1.2 0.0.0.0
[r4-ospf-101]import-route bgp 
[r4]bgp 100
[r4-bgp]ipv4-family vpn-instance b    
[r4-bgp-b]import-route ospf 101

[r5]ospf 100 router-id 5.5.5.5    
[r5-ospf-100]area 0
[r5-ospf-100-area-0.0.0.0]network 0.0.0.0 255.255.255.255

[r7]rip 1 vpn-instance c    
[r7-rip-1]import-route bgp 
[r7]bgp 100
[r7-bgp]ipv4-family vpn-instance c    
[r7-bgp-c]import-route rip 1

MPLS实验

 试验成功

上一篇:minikube start ,国内环境


下一篇:vpn spa fwknop install