HCIP——MPLS VPN实验

MPLS VPN

  • 一、实验
    • 1、实验拓扑及要求
    • 2、实验拓扑搭建以及IP地址划分
    • 3、实验步骤
      • 1、配置永不超时以及接口IP地址
      • 2、给R1,R2,R3,R4配置OSPF
      • 3、配置BGP非直连建邻,并开启V4路由传递功能
      • 4、配置MPLS
      • 5、在PE端做MPLS VPN
      • 6、给R1以及R5配置静态,并将单向重发布
      • 7、给R3以及R6配置RIP,并双向重发布
      • 8、给R4以及R7配置OSPF,并双向重发布
  • 二、实验二
    • 1、实验拓扑及要求
    • 2、实验拓扑搭建以及拓扑划分
    • 3、实验步骤
      • 1、配置永不超时以及接口环回
      • 2、给isp区域设备配置OSPF
      • 3、给ISP区域下的设备配置MPLS
      • 4、配置BGP非直连建邻,并打开V4路由传递功能
      • 5、在PE端做MPLS VPN
      • 6、R1与R2配置静态以及单向重发布
      • 7、R5与R7配置RIP,并双向重发布
      • 8、给R6以及R8配置OSPF并双向重发布
      • 9、测试

一、实验

1、实验拓扑及要求

HCIP——MPLS VPN实验_第1张图片
使用MPLS VPN实现全网可达

2、实验拓扑搭建以及IP地址划分

HCIP——MPLS VPN实验_第2张图片

3、实验步骤

1、配置永不超时以及接口IP地址

R1:

<Huawei>sys
[Huawei]sys R1
[R1]user-interface console 0
[R1-ui-console0]idle-timeout 0 0 
[R1-ui-console0]q
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip address 15.1.1.1 24
[R1-GigabitEthernet0/0/0]int l0
[R1-LoopBack0]ip address 1.1.1.1 32
[R1-LoopBack0]q
[R1]int g0/0/1
[R1-GigabitEthernet0/0/1]ip address 12.1.1.1 24
[R1-GigabitEthernet0/0/1]q
[R1]

R2:

<Huawei>sys
[Huawei]sys R2
[R2-ui-console0]idle-timeout 0 0 
[R2-ui-console0]int l0
[R2-LoopBack0]ip address 2.2.2.2 32
[R2-LoopBack0]int g0/0/0
[R2-GigabitEthernet0/0/0]ip address 12.1.1.2 24
[R2-GigabitEthernet0/0/0]int g0/0/1
[R2-GigabitEthernet0/0/1]ip address 23.1.1.1 24
[R2-GigabitEthernet0/0/1]int g0/0/2
[R2-GigabitEthernet0/0/2]ip address 24.1.1.1 24
[R2-GigabitEthernet0/0/2]q

R3:

[Huawei]sys R3
[R3]user-interface console 0
[R3-ui-console0]idle-timeout 0 0 
[R3-ui-console0]int g0/0/0
[R3-GigabitEthernet0/0/0]ip address 23.1.1.2 24
[R3-GigabitEthernet0/0/0]int g0/0/1
[R3-GigabitEthernet0/0/1]ip address 36.1.1.1 24
[R3-GigabitEthernet0/0/1]int l0
[R3-LoopBack0]ip address 3.3.3.3 32
[R3-LoopBack0]q
[R3]

R4:

[Huawei]sys R4
[R4]user-interface console 0
[R4-ui-console0]idle-timeout 0 0 
[R4-ui-console0]int g0/0/0
[R4-GigabitEthernet0/0/0]ip address 24.1.1.2 24
[R4-GigabitEthernet0/0/0]int g0/0/1
[R4-GigabitEthernet0/0/1]ip address 47.1.1.1 24
[R4-GigabitEthernet0/0/1]int l0
[R4-LoopBack0]ip address 4.4.4.4 32
[R4-LoopBack0]q
[R4]

R5:

<Huawei>sys
[Huawei]sys R5
[R5]user-interface console 0
[R5-ui-console0]idle-timeout 0 0 
[R5-ui-console0]int g0/0/0
[R5-GigabitEthernet0/0/0]ip address 15.1.1.2 24
[R5-GigabitEthernet0/0/0]int l0
[R5-LoopBack0]ip address 5.5.5.5 32
[R5-LoopBack0]q
[R5]

R6:

<Huawei>sys
[r6]user-interface console 0
[r6-ui-console0]idle-timeout 0 0 
[r6-ui-console0]int l0
[r6-LoopBack0]ip address 6.6.6.6 32
[r6-LoopBack0]int g0/0/0
[r6-GigabitEthernet0/0/0]ip address 36.1.1.2 24
[r6-GigabitEthernet0/0/0]q
[r6]

R7:

<Huawei>sys
[Huawei]sys R7
[R7]user-interface console 0
[R7-ui-console0]idle-timeout 0 0 
[R7-ui-console0]int l0
[R7-LoopBack0]ip address 7.7.7.7 32
[R7-LoopBack0]int g0/0/0
[R7-GigabitEthernet0/0/0]ip address 47.1.1.2 24
[R7-GigabitEthernet0/0/0]q
[R7]

查看接口IP地址配置:
R1:

[R1]display ip interface brief 
Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              15.1.1.1/24          up         up        
GigabitEthernet0/0/1              12.1.1.1/24          up         up        
GigabitEthernet0/0/2              unassigned           down       down      
LoopBack0                         1.1.1.1/32           up         up(s)     
NULL0                             unassigned           up         up(s)     
[R1]

R2:

[R2]display ip interface brief 
Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              12.1.1.2/24          up         up        
GigabitEthernet0/0/1              23.1.1.1/24          up         up        
GigabitEthernet0/0/2              24.1.1.1/24          up         up        
LoopBack0                         2.2.2.2/32           up         up(s)     
NULL0                             unassigned           up         up(s)   
[R2]

R3:

[R3]display ip interface brief 
Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              23.1.1.2/24          up         up        
GigabitEthernet0/0/1              36.1.1.1/24          up         up        
GigabitEthernet0/0/2              unassigned           down       down      
LoopBack0                         3.3.3.3/32           up         up(s)     
NULL0                             unassigned           up         up(s)     
[R3]

R4:

[R4]display ip interface brief 
Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              24.1.1.2/24          up         up        
GigabitEthernet0/0/1              47.1.1.1/24          up         up        
GigabitEthernet0/0/2              unassigned           down       down      
LoopBack0                         4.4.4.4/32           up         up(s)     
NULL0                             unassigned           up         up(s)     
[R4]

R5:

[R5]display ip interface brief
Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              15.1.1.2/24          up         up        
GigabitEthernet0/0/1              unassigned           down       down      
GigabitEthernet0/0/2              unassigned           down       down      
LoopBack0                         5.5.5.5/32           up         up(s)     
NULL0                             unassigned           up         up(s)     
[R5]

R6:

[r6]display ip interface brief
Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              36.1.1.2/24          up         up        
GigabitEthernet0/0/1              unassigned           down       down      
GigabitEthernet0/0/2              unassigned           down       down      
LoopBack0                         6.6.6.6/32           up         up(s)     
NULL0                             unassigned           up         up(s)     
[r6]

R7:

[R7]display ip interface brief
Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              47.1.1.2/24          up         up        
GigabitEthernet0/0/1              unassigned           down       down      
GigabitEthernet0/0/2              unassigned           down       down      
LoopBack0                         7.7.7.7/32           up         up(s)     
NULL0                             unassigned           up         up(s)     
[R7]

2、给R1,R2,R3,R4配置OSPF

R1:

[R1]ospf 1 router-id 1.1.1.1
[R1-ospf-1]area 0
[R1-ospf-1-area-0.0.0.0]network 12.1.1.1 0.0.0.0
[R1-ospf-1-area-0.0.0.0]network 1.1.1.1 0.0.0.0
[R1-ospf-1-area-0.0.0.0]q
[R1-ospf-1]q
[R1]

R2:

[R2]ospf 1 router-id 2.2.2.2
[R2-ospf-1]area 0
[R2-ospf-1-area-0.0.0.0]network 0.0.0.0 255.255.255.255
[R2-ospf-1-area-0.0.0.0]q
[R2-ospf-1]q
[R2]

R3:

[R3]ospf 1 router-id 3.3.3.3
[R3-ospf-1]area 0
[R3-ospf-1-area-0.0.0.0]network 23.1.1.2 0.0.0.0
[R3-ospf-1-area-0.0.0.0]network 3.3.3.3 0.0.0.0
[R3-ospf-1-area-0.0.0.0]q
[R3-ospf-1]q
[R3]

R4:

[R4]ospf 1 router-id 4.4.4.4
[R4-ospf-1]area 0
[R4-ospf-1-area-0.0.0.0]network 24.1.1.2 0.0.0.0
[R4-ospf-1-area-0.0.0.0]network 4.4.4.4 0.0.0.0
[R4-ospf-1-area-0.0.0.0]q
[R4-ospf-1]q
[R4]

查看OSPF路由表:
R1:
HCIP——MPLS VPN实验_第3张图片
R2:
HCIP——MPLS VPN实验_第4张图片
R3:
HCIP——MPLS VPN实验_第5张图片

R4:
HCIP——MPLS VPN实验_第6张图片
HCIP——MPLS VPN实验_第7张图片

3、配置BGP非直连建邻,并开启V4路由传递功能

R1:

[R1]bgp 1
[R1-bgp]router-id 1.1.1.1
[R1-bgp]peer 3.3.3.3 as-number 1
[R1-bgp]peer 3.3.3.3 connect-interface LoopBack 0
[R1-bgp]peer 4.4.4.4 as-number 1
[R1-bgp]peer 4.4.4.4 connect-interface LoopBack 0
[R1-bgp]ipv4-family v4
[R1-bgp-af-v4]peer 3.3.3.3 enable 
[R1-bgp-af-v4]peer 4.4.4.4 enable
[R1-bgp-af-v4]q
[R1-bgp]q
[R1]

R2:

[R3]bgp 1
[R3-bgp]router-id 3.3.3.3
[R3-bgp]peer 1.1.1.1 as-number 1
[R3-bgp]peer 1.1.1.1 connect-interface LoopBack 0
[R3-bgp]peer 4.4.4.4 as-number 1
[R3-bgp]peer 4.4.4.4 connect-interface LoopBack 0
[R3-bgp]ipv4-family v4
[R3-bgp-af-v4]peer 1.1.1.1 enable 
[R3-bgp-af-v4]peer 4.4.4.4 enable 
[R3-bgp-af-v4]q
[R3-bgp]q
[R3]

R4:

[R4]bgp 1
[R4-bgp]router-id 4.4.4.4
[R4-bgp]peer 1.1.1.1 as-number 1
[R4-bgp]peer 1.1.1.1 connect-interface LoopBack 0
[R4-bgp]peer 3.3.3.3 as-number 1
[R4-bgp]peer 3.3.3.3 connect-interface LoopBack 0
[R4-bgp]ipv4-family v4
[R4-bgp-af-v4]peer 1.1.1.1 enable 
[R4-bgp-af-v4]peer 3.3.3.3 enable 
[R4-bgp-af-v4]q
[R4-bgp]q
[R4]

4、配置MPLS

R1:

[R1]mpls lsr-id 1.1.1.1
[R1]mpls 
Info: Mpls starting, please wait... OK!
[R1-mpls]mpls ldp
[R1-mpls-ldp]q
[R1]int g0/0/1
[R1-GigabitEthernet0/0/1]mpls 
[R1-GigabitEthernet0/0/1]mpls ldp 
[R1-GigabitEthernet0/0/1]q
[R1]

R2:

[R2]mpls lsr-id 2.2.2.2
[R2]mpls
Info: Mpls starting, please wait... OK!
[R2-mpls]mpls ldp
[R2-mpls-ldp]q
[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]mpls 
[R2-GigabitEthernet0/0/0]mpls ldp 
[R2-GigabitEthernet0/0/0]int g0/0/1
[R2-GigabitEthernet0/0/1]mpls 
[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 
[R2-GigabitEthernet0/0/2]q
[R2]

R3:

[R3]mpls lsr-id 3.3.3.3
[R3]mpls 
Info: Mpls starting, please wait... OK!
[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-GigabitEthernet0/0/0]q
[R3]

R4:

[R4]mpls lsr-id 4.4.4.4[R4]mpls 
Info: Mpls starting, please wait... OK!
[R4-mpls]mpls ldp
[R4-mpls-ldp]q
[R4]int g0/0/0
[R4-GigabitEthernet0/0/0]mpls 
[R4-GigabitEthernet0/0/0]mpls ldp
[R4-GigabitEthernet0/0/0]q
[R4]

5、在PE端做MPLS VPN

R1:

[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]undo ip address
[R1-GigabitEthernet0/0/0]q
[R1]ip -instance 1
[R1--instance-1]route-distinguisher 1:1
[R1--instance-1-af-ipv4]-target 3:3 4:4 import-extcommunity 
[R1--instance-1-af-ipv4]-target 1:1 export-extcommunity 
[R1--instance-1-af-ipv4]q
[R1--instance-1]q
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip binding -instance 1
[R1-GigabitEthernet0/0/0]ip address 15.1.1.1 24
[R1-GigabitEthernet0/0/0]q
[R1]

R3:

[R3]int g0/0/1
[R3-GigabitEthernet0/0/1]undo ip address 
[R3-GigabitEthernet0/0/1]q
[R3]ip -instance 2
[R3--instance-2]route-distinguisher 3:3
[R3--instance-2-af-ipv4]-target 1:1 4:4 import-extcommunity 
[R3--instance-2-af-ipv4]-target 3:3 export-extcommunity 
[R3--instance-2-af-ipv4]q
[R3--instance-2]q
[R3]int g0/0/1
[R3-GigabitEthernet0/0/1]ip binding -instance 2
[R3-GigabitEthernet0/0/1]ip address 36.1.1.1 24
[R3-GigabitEthernet0/0/1]q
[R3]

R4:

[R4]int g0/0/1
[R4-GigabitEthernet0/0/1]undo ip address 
[R4-GigabitEthernet0/0/1]q
[R4]ip -instance 3
[R4--instance-3]route-distinguisher 4:4
[R4--instance-3-af-ipv4]-target 1:1 3:3 import-extcommunity 
[R4--instance-3-af-ipv4]-target 4:4 export-extcommunity 
[R4--instance-3-af-ipv4]q
[R4--instance-3]q
[R4]int g0/0/1
[R4-GigabitEthernet0/0/1]ip binding -instance 3
[R4-GigabitEthernet0/0/1]ip address 47.1.1.1 24
[R4-GigabitEthernet0/0/1]q
[R4]

6、给R1以及R5配置静态,并将单向重发布

R1:

[R1]ip route-static -instance 1 5.5.5.5 32 15.1.1.2
[R1]bgp 1
[R1-bgp]ipv4-family -instance 1
[R1-bgp-1]import-route static 
[R1-bgp-1]q
[R1-bgp]q
[R1]

R5:

[R5]ip route-static 0.0.0.0 0.0.0.0 15.1.1.1

7、给R3以及R6配置RIP,并双向重发布

R3:

[R3]rip 1 -instance 2
[R3-rip-1]version 2
[R3-rip-1]network 36.0.0.0
[R3-rip-1]import-route bgp 
[R3-rip-1]q
[R3]bgp 1
[R3-bgp]ipv4-family -instance 2
[R3-bgp-2]import-route rip 1
[R3-bgp-2]q
[R3-bgp]q
[R3]

R6:

[r6]rip 1
[r6-rip-1]version 2
[r6-rip-1]network 36.0.0.0
[r6-rip-1]network 6.0.0.0
[r6-rip-1]q
[r6]

8、给R4以及R7配置OSPF,并双向重发布

R4:

[R4]ospf 2 -instance 3
[R4-ospf-2]area 0
[R4-ospf-2-area-0.0.0.0]network 47.1.1.1 0.0.0.0
[R4-ospf-2]import-route bgp 
[R4-ospf-2]q
[R4]bgp 1
[R4-bgp]ipv4-family -instance 3
[R4-bgp-3]import-route ospf 2
[R4-bgp-3]q
[R4-bgp]q
[R4]

R7:

[R7]ospf 2 router-id 7.7.7.7
[R7-ospf-2]area 0
[R7-ospf-2-area-0.0.0.0]network 0.0.0.0 255.255.255.255
[R7-ospf-2-area-0.0.0.0]q
[R7-ospf-2]q
[R7]

查看R6路由表:
HCIP——MPLS VPN实验_第8张图片
HCIP——MPLS VPN实验_第9张图片
实验一结束。

二、实验二

1、实验拓扑及要求

HCIP——MPLS VPN实验_第10张图片
使用MPLS VPN全网可达

2、实验拓扑搭建以及拓扑划分

HCIP——MPLS VPN实验_第11张图片

3、实验步骤

1、配置永不超时以及接口环回

R1:

<Huawei>sys
[Huawei]user-interface console 0
[Huawei-ui-console0]idle-timeout 0 0 
[Huawei-ui-console0]int l0
[Huawei-LoopBack0]ip address 1.1.1.1 32
[Huawei-LoopBack0]int g0/0/0
[Huawei-GigabitEthernet0/0/0]ip address 12.1.1.1 24
[Huawei-GigabitEthernet0/0/0]q
[Huawei]sys R1
[R1]

R2:

<Huawei>sys
[Huawei]sys R2
[R2]user-interface console 0
[R2-ui-console0]idle-timeout 0 0
[R2-ui-console0]int g0/0/0
[R2-GigabitEthernet0/0/0]ip address 12.1.1.2 24
[R2-GigabitEthernet0/0/0]int l0
[R2-LoopBack0]ip address 2.2.2.2 32
[R2-LoopBack0]int g0/0/1
[R2-GigabitEthernet0/0/1]ip address 23.1.1.1 24
[R2-GigabitEthernet0/0/1]int g0/0/2
[R2-GigabitEthernet0/0/2]ip address 24.1.1.1 24
[R2-GigabitEthernet0/0/2]q
[R2]

R3:

<Huawei>sys
[Huawei]sys R3
[R3]user-interface console 0
[R3-ui-console0]idle-timeout 0 0 
[R3-ui-console0]int l0
[R3-LoopBack0]ip address 3.3.3.3 32
[R3-LoopBack0]int g0/0/0
[R3-GigabitEthernet0/0/0]ip address 23.1.1.2 24
[R3-GigabitEthernet0/0/0]int g0/0/1
[R3-GigabitEthernet0/0/1]ip address 35.1.1.1 24
[R3-GigabitEthernet0/0/1]int g0/0/2
[R3-GigabitEthernet0/0/2]ip address 36.1.1.1 24
[R3-GigabitEthernet0/0/2]q
[R3]

R4:

<Huawei>sys
[Huawei]sys R4
[R4]user-interface console 0
[R4-ui-console0]idle-timeout 0 0
[R4-ui-console0]int l0
[R4-LoopBack0]ip address 4.4.4.4 32
[R4-LoopBack0]int g0/0/0
[R4-GigabitEthernet0/0/0]ip address 24.1.1.2 24
[R4-GigabitEthernet0/0/0]int g0/0/1
[R4-GigabitEthernet0/0/1]ip address 46.1.1.1 24
[R4-GigabitEthernet0/0/1]int g0/0/2
[R4-GigabitEthernet0/0/2]ip address 45.1.1.1 24
[R4-GigabitEthernet0/0/2]q
[R4]

R5:

<Huawei>sys
[Huawei]sys R5
[R5]user-interface console 0
[R5-ui-console0]idle-timeout 0 0 
[R5-ui-console0]int l0
[R5-LoopBack0]ip address 5.5.5.5 32
[R5-LoopBack0]int g0/0/0
[R5-GigabitEthernet0/0/0]ip address 35.1.1.2 24
[R5-GigabitEthernet0/0/0]int g0/0/1
[R5-GigabitEthernet0/0/1]ip address 37.1.1.1 24
[R5-GigabitEthernet0/0/1]int g0/0/2
[R5-GigabitEthernet0/0/2]ip address 45.1.1.2 24
[R5-GigabitEthernet0/0/2]q
[R5]

R6:

<Huawei>sys
[Huawei]sys R6
[R6]user-interface console 0
[R6-ui-console0]idle-timeout 0 0 
[R6-ui-console0]int l0
[R6-LoopBack0]ip address 6.6.6.6 32
[R6-LoopBack0]int g0/0/0
[R6-GigabitEthernet0/0/0]ip address 46.1.1.2 24
[R6-GigabitEthernet0/0/0]int g0/0/1
[R6-GigabitEthernet0/0/1]ip address 68.1.1.1 24
[R6-GigabitEthernet0/0/1]int g0/0/2
[R6-GigabitEthernet0/0/2]ip address 36.1.1.2 24
[R6-GigabitEthernet0/0/2]q
[R6]

R7:

<Huawei>sys
[Huawei]sys R7
[R7]user-interface console 0
[R7-ui-console0]idle-timeout 0 0
[R7-ui-console0]int l0
[R7-LoopBack0]ip address 7.7.7.7 32
[R7-LoopBack0]int g0/0/0
[R7-GigabitEthernet0/0/0]ip address 57.1.1.2 24
[R7-GigabitEthernet0/0/0]q
[R7]

R8:

<Huawei>sys
[Huawei]sys R8
[R8]user-interface console 0
[R8-ui-console0]idle-timeout 0 0
[R8-ui-console0]int l0
[R8-LoopBack0]ip address 8.8.8.8 32
[R8-LoopBack0]int g0/0/0
[R8-GigabitEthernet0/0/0]ip address 68.1.1.2 24
[R8-GigabitEthernet0/0/0]q
[R8]

查看接口IP配置情况:
R1:

[R1]display ip interface brief
Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              12.1.1.1/24          up         up        
GigabitEthernet0/0/1              unassigned           down       down      
GigabitEthernet0/0/2              unassigned           down       down      
LoopBack0                         1.1.1.1/32           up         up(s)     
NULL0                             unassigned           up         up(s)     
[R1]

R2:

[R2]display ip interface brief
Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              12.1.1.2/24          up         up        
GigabitEthernet0/0/1              23.1.1.1/24          up         up        
GigabitEthernet0/0/2              24.1.1.1/24          up         up        
LoopBack0                         2.2.2.2/32           up         up(s)     
NULL0                             unassigned           up         up(s)     
[R2]

R3:

[R3]display ip interface brief
Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              23.1.1.2/24          up         up        
GigabitEthernet0/0/1              35.1.1.1/24          up         up        
GigabitEthernet0/0/2              36.1.1.1/24          up         up        
LoopBack0                         3.3.3.3/32           up         up(s)     
NULL0                             unassigned           up         up(s)     
[R3]

R4:

[R4]display ip interface brief 
Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              24.1.1.2/24          up         up        
GigabitEthernet0/0/1              46.1.1.1/24          up         up        
GigabitEthernet0/0/2              45.1.1.1/24          up         up        
LoopBack0                         4.4.4.4/32           up         up(s)     
NULL0                             unassigned           up         up(s)     
[R4]

R5:

[R5]display ip interface brief 
Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              35.1.1.2/24          up         up        
GigabitEthernet0/0/1              37.1.1.1/24          up         up        
GigabitEthernet0/0/2              45.1.1.2/24          up         up        
LoopBack0                         5.5.5.5/32           up         up(s)     
NULL0                             unassigned           up         up(s)     
[R5]

R6:

[R6]display ip interface brief
Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              46.1.1.2/24          up         up        
GigabitEthernet0/0/1              68.1.1.1/24          up         up        
GigabitEthernet0/0/2              36.1.1.2/24          up         up        
LoopBack0                         6.6.6.6/32           up         up(s)     
NULL0                             unassigned           up         up(s)     
[R6]

R7:

[R7]display ip interface brief
Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              57.1.1.2/24          up         up        
GigabitEthernet0/0/1              unassigned           down       down      
GigabitEthernet0/0/2              unassigned           down       down      
LoopBack0                         7.7.7.7/32           up         up(s)     
NULL0                             unassigned           up         up(s)     
[R7]

R8:

[R8]display ip interface brief 
Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              68.1.1.2/24          up         up        
GigabitEthernet0/0/1              unassigned           down       down      
GigabitEthernet0/0/2              unassigned           down       down      
LoopBack0                         8.8.8.8/32           up         up(s)     
NULL0                             unassigned           up         up(s)     
[R8]

2、给isp区域设备配置OSPF

R2:

[R2]ospf 1 router-id 2.2.2.2
[R2-ospf-1]area 0
[R2-ospf-1-area-0.0.0.0]network 2.2.2.2 0.0.0.0
[R2-ospf-1-area-0.0.0.0]network 23.1.1.1 0.0.0.0
[R2-ospf-1-area-0.0.0.0]network 24.1.1.1 0.0.0.0
[R2-ospf-1-area-0.0.0.0]q
[R2-ospf-1]q
[R2]

R3:

[R3]ospf 1 router-id 3.3.3.3
[R3-ospf-1]area 0
[R3-ospf-1-area-0.0.0.0]network 0.0.0.0 255.255.255.255
[R3-ospf-1-area-0.0.0.0]q
[R3-ospf-1]q
[R3]

R4:

[R4]ospf 1 router-id 4.4.4.4
[R4-ospf-1]area 0
[R4-ospf-1-area-0.0.0.0]network 0.0.0.0 255.255.255.255
[R4-ospf-1-area-0.0.0.0]q
[R4-ospf-1]q
[R4]

R5:

[R5]ospf 1 router-id 5.5.5.5
[R5-ospf-1]area 0
[R5-ospf-1-area-0.0.0.0]network 35.1.1.2 0.0.0.0
[R5-ospf-1-area-0.0.0.0]network 45.1.1.2 0.0.0.0
[R5-ospf-1-area-0.0.0.0]network 5.5.5.5 0.0.0.0
[R5-ospf-1-area-0.0.0.0]q
[R5-ospf-1]q
[R5]

R6:

[R6]ospf 1 router-id 6.6.6.6
[R6-ospf-1]area 0
[R6-ospf-1-area-0.0.0.0]network 46.1.1.2 0.0.0.0
[R6-ospf-1-area-0.0.0.0]network 36.1.1.2 0.0.0.0
[R6-ospf-1-area-0.0.0.0]network 6.6.6.6 0.0.0.0
[R6-ospf-1-area-0.0.0.0]q
[R6-ospf-1]q
[R6]

查看R2路由表:
HCIP——MPLS VPN实验_第12张图片
HCIP——MPLS VPN实验_第13张图片

3、给ISP区域下的设备配置MPLS

R2:

[R2]mpls lsr-id 2.2.2.2
[R2]mpls
Info: Mpls starting, please wait... OK!
[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-GigabitEthernet0/0/1]int g0/0/2
[R2-GigabitEthernet0/0/2]mpls		
[R2-GigabitEthernet0/0/2]mpls ldp 
[R2-GigabitEthernet0/0/2]q
[R2]

R3:

[R3]mpls lsr-id 3.3.3.3
[R3]mpls
Info: Mpls starting, please wait... OK!
[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-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]q
[R3]

R4:

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

R5:

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

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 
[R6-GigabitEthernet0/0/2]q
[R6]

4、配置BGP非直连建邻,并打开V4路由传递功能

R2:

[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 LoopBack 0
[R2-bgp]peer 6.6.6.6 as-number 1
[R2-bgp]peer 6.6.6.6 connect-interface LoopBack 0
[R2-bgp]ipv4-family v4 
[R2-bgp-af-v4]peer 5.5.5.5 enable 
[R2-bgp-af-v4]peer 6.6.6.6 enable 
[R2-bgp-af-v4]q
[R2-bgp]q
[R2]

R5:

[R5]bgp 1
[R5-bgp]router-id 5.5.5.5
[R5-bgp]peer 2.2.2.2 as-number 1	
[R5-bgp]peer 2.2.2.2 connect-interface LoopBack 0
[R5-bgp]peer 6.6.6.6 as-number 1
[R5-bgp]peer 6.6.6.6 connect-interface LoopBack 0
[R5-bgp]ipv4-family v4
[R5-bgp-af-v4]peer 2.2.2.2 enable 
[R5-bgp-af-v4]peer 6.6.6.6 enable 
[R5-bgp-af-v4]q
[R5-bgp]q
[R5]

R6:

[R6]bgp 1
[R6-bgp]router-id 6.6.6.6
[R6-bgp]peer 2.2.2.2 as-number 1	
[R6-bgp]peer 2.2.2.2 connect-interface LoopBack 0
[R6-bgp]peer 5.5.5.5 as-number 1	
[R6-bgp]peer 5.5.5.5 connect-interface LoopBack 0
[R6-bgp]ipv4-family v4
[R6-bgp-af-v4]peer 2.2.2.2 enable 
[R6-bgp-af-v4]peer 5.5.5.5 enable 
[R6-bgp-af-v4]q
[R6-bgp]q
[R6]

HCIP——MPLS VPN实验_第14张图片

5、在PE端做MPLS VPN

R2:

[R2]ip -instance 1
[R2--instance-1]route-distinguisher 2:2
[R2--instance-1-af-ipv4]-target 5:5 6:6 import-extcommunity 
[R2--instance-1-af-ipv4]-target 2:2 export-extcommunity 
[R2--instance-1-af-ipv4]q
[R2--instance-1]q
[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]undo ip address 
[R2-GigabitEthernet0/0/0]ip binding -instance 1
[R2-GigabitEthernet0/0/0]ip address 12.1.1.2 24
[R2-GigabitEthernet0/0/0]q
[R2]

R5:

[R5]ip -instance 2
[R5--instance-2]route-distinguisher 5:5
[R5--instance-2-af-ipv4]-target 5:5 export-extcommunity 
[R5--instance-2-af-ipv4]-target 2:2 6:6 import-extcommunity 
[R5--instance-2-af-ipv4]q
[R5--instance-2]q
[R5]
[R5]int g0/0/1
[R5-GigabitEthernet0/0/1]undo ip address 
[R5-GigabitEthernet0/0/1]ip binding -instance 2
[R5-GigabitEthernet0/0/1]ip address 57.1.1.1 24
[R5-GigabitEthernet0/0/1]q
[R5]

R6:

[R6]ip -instance 3
[R6--instance-3]route-distinguisher 6:6
[R6--instance-3-af-ipv4]-target 6:6 export-extcommunity
[R6--instance-3-af-ipv4]-target 2:2 5:5 import-extcommunity 
[R6--instance-3-af-ipv4]q
[R6--instance-3]q
[R6]int g0/0/1
[R6-GigabitEthernet0/0/1]undo ip address 
[R6-GigabitEthernet0/0/1]ip binding -instance 3
[R6-GigabitEthernet0/0/1]ip address 68.1.1.1 24
[R6-GigabitEthernet0/0/1]q
[R6]

6、R1与R2配置静态以及单向重发布

R1:

[R1]ip route-static 0.0.0.0 0 12.1.1.2

R2:

[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 
[R2-bgp-1]q
[R2-bgp]q
[R2]

7、R5与R7配置RIP,并双向重发布

R5:

[R5]rip 1 -instance 2
[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 -instance 2
[R5-bgp-2]import-route rip 1
[R5-bgp-2]q
[R5-bgp]q
[R5]

R7:

[R7]rip 1
[R7-rip-1]version 2
[R7-rip-1]network 7.0.0.0
[R7-rip-1]network 57.0.0.0
[R7-rip-1]q
[R7]

8、给R6以及R8配置OSPF并双向重发布

R6:

[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-ospf-2-area-0.0.0.0]q
[R6-ospf-2]import-route bgp 
[R6-ospf-2]q
[R6]bgp 1
[R6-bgp]ipv4-family -instance 3
[R6-bgp-3]import-route ospf 2
[R6-bgp-3]q
[R6-bgp]q
[R6]

R8:

[R8]ospf 2 router-id 8.8.8.8
[R8-ospf-2]area 0
[R8-ospf-2-area-0.0.0.0]network 0.0.0.0 255.255.255.255
[R8-ospf-2-area-0.0.0.0]q
[R8-ospf-2]q
[R8]

HCIP——MPLS VPN实验_第15张图片
HCIP——MPLS VPN实验_第16张图片

9、测试

HCIP——MPLS VPN实验_第17张图片
实验结束。

你可能感兴趣的:(HCIP,计算机网络,tcp/ip,网络,网络协议,web安全,安全,HCIP,MPLS)