当前位置:   article > 正文

HCIP——MPLS VPN实验

HCIP——MPLS VPN实验

一、实验

1、实验拓扑及要求

在这里插入图片描述
使用MPLS VPN实现全网可达

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

在这里插入图片描述

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]
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14

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
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12

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]
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11

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]
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11

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]
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10

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]
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9

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]
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10

查看接口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]
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

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]
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

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]
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

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]
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

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]
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

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]
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

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]
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

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]
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7

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]
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

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]
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7

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]
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7

查看OSPF路由表:
R1:
在这里插入图片描述
R2:
在这里插入图片描述
R3:
在这里插入图片描述

R4:
在这里插入图片描述
在这里插入图片描述

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

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 vpnv4
[R1-bgp-af-vpnv4]peer 3.3.3.3 enable 
[R1-bgp-af-vpnv4]peer 4.4.4.4 enable
[R1-bgp-af-vpnv4]q
[R1-bgp]q
[R1]
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12

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 vpnv4
[R3-bgp-af-vpnv4]peer 1.1.1.1 enable 
[R3-bgp-af-vpnv4]peer 4.4.4.4 enable 
[R3-bgp-af-vpnv4]q
[R3-bgp]q
[R3]
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12

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 vpnv4
[R4-bgp-af-vpnv4]peer 1.1.1.1 enable 
[R4-bgp-af-vpnv4]peer 3.3.3.3 enable 
[R4-bgp-af-vpnv4]q
[R4-bgp]q
[R4]
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12

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]
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10

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]
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16

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]
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10

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]
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9

5、在PE端做MPLS VPN

R1:

[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]undo ip address
[R1-GigabitEthernet0/0/0]q
[R1]ip vpn-instance 1
[R1-vpn-instance-1]route-distinguisher 1:1
[R1-vpn-instance-1-af-ipv4]vpn-target 3:3 4:4 import-extcommunity 
[R1-vpn-instance-1-af-ipv4]vpn-target 1:1 export-extcommunity 
[R1-vpn-instance-1-af-ipv4]q
[R1-vpn-instance-1]q
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip binding vpn-instance 1
[R1-GigabitEthernet0/0/0]ip address 15.1.1.1 24
[R1-GigabitEthernet0/0/0]q
[R1]
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14

R3:

[R3]int g0/0/1
[R3-GigabitEthernet0/0/1]undo ip address 
[R3-GigabitEthernet0/0/1]q
[R3]ip vpn-instance 2
[R3-vpn-instance-2]route-distinguisher 3:3
[R3-vpn-instance-2-af-ipv4]vpn-target 1:1 4:4 import-extcommunity 
[R3-vpn-instance-2-af-ipv4]vpn-target 3:3 export-extcommunity 
[R3-vpn-instance-2-af-ipv4]q
[R3-vpn-instance-2]q
[R3]int g0/0/1
[R3-GigabitEthernet0/0/1]ip binding vpn-instance 2
[R3-GigabitEthernet0/0/1]ip address 36.1.1.1 24
[R3-GigabitEthernet0/0/1]q
[R3]
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14

R4:

[R4]int g0/0/1
[R4-GigabitEthernet0/0/1]undo ip address 
[R4-GigabitEthernet0/0/1]q
[R4]ip vpn-instance 3
[R4-vpn-instance-3]route-distinguisher 4:4
[R4-vpn-instance-3-af-ipv4]vpn-target 1:1 3:3 import-extcommunity 
[R4-vpn-instance-3-af-ipv4]vpn-target 4:4 export-extcommunity 
[R4-vpn-instance-3-af-ipv4]q
[R4-vpn-instance-3]q
[R4]int g0/0/1
[R4-GigabitEthernet0/0/1]ip binding vpn-instance 3
[R4-GigabitEthernet0/0/1]ip address 47.1.1.1 24
[R4-GigabitEthernet0/0/1]q
[R4]
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14

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

R1:

[R1]ip route-static vpn-instance 1 5.5.5.5 32 15.1.1.2
[R1]bgp 1
[R1-bgp]ipv4-family vpn-instance 1
[R1-bgp-1]import-route static 
[R1-bgp-1]q
[R1-bgp]q
[R1]
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7

R5:

[R5]ip route-static 0.0.0.0 0.0.0.0 15.1.1.1
  • 1

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

R3:

[R3]rip 1 vpn-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 vpn-instance 2
[R3-bgp-2]import-route rip 1
[R3-bgp-2]q
[R3-bgp]q
[R3]
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11

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]
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

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

R4:

[R4]ospf 2 vpn-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 vpn-instance 3
[R4-bgp-3]import-route ospf 2
[R4-bgp-3]q
[R4-bgp]q
[R4]
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11

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]
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

查看R6路由表:
在这里插入图片描述
在这里插入图片描述
实验一结束。

二、实验二

1、实验拓扑及要求

在这里插入图片描述
使用MPLS VPN全网可达

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

在这里插入图片描述

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]
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10

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]
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14

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]
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14

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]
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14

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]
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14

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]
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14

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]
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10

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]
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10

查看接口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]
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

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]
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

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]
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

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]
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

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]
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

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]
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

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]
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

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]
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

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]
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

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]
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

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]
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

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]
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

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]
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

查看R2路由表:
在这里插入图片描述
在这里插入图片描述

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]
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13

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]
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16

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]
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17

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]
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13

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]
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13

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

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 vpnv4 
[R2-bgp-af-vpnv4]peer 5.5.5.5 enable 
[R2-bgp-af-vpnv4]peer 6.6.6.6 enable 
[R2-bgp-af-vpnv4]q
[R2-bgp]q
[R2]
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12

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 vpnv4
[R5-bgp-af-vpnv4]peer 2.2.2.2 enable 
[R5-bgp-af-vpnv4]peer 6.6.6.6 enable 
[R5-bgp-af-vpnv4]q
[R5-bgp]q
[R5]
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12

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 vpnv4
[R6-bgp-af-vpnv4]peer 2.2.2.2 enable 
[R6-bgp-af-vpnv4]peer 5.5.5.5 enable 
[R6-bgp-af-vpnv4]q
[R6-bgp]q
[R6]
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12

在这里插入图片描述

5、在PE端做MPLS VPN

R2:

[R2]ip vpn-instance 1
[R2-vpn-instance-1]route-distinguisher 2:2
[R2-vpn-instance-1-af-ipv4]vpn-target 5:5 6:6 import-extcommunity 
[R2-vpn-instance-1-af-ipv4]vpn-target 2:2 export-extcommunity 
[R2-vpn-instance-1-af-ipv4]q
[R2-vpn-instance-1]q
[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]undo ip address 
[R2-GigabitEthernet0/0/0]ip binding vpn-instance 1
[R2-GigabitEthernet0/0/0]ip address 12.1.1.2 24
[R2-GigabitEthernet0/0/0]q
[R2]
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12

R5:

[R5]ip vpn-instance 2
[R5-vpn-instance-2]route-distinguisher 5:5
[R5-vpn-instance-2-af-ipv4]vpn-target 5:5 export-extcommunity 
[R5-vpn-instance-2-af-ipv4]vpn-target 2:2 6:6 import-extcommunity 
[R5-vpn-instance-2-af-ipv4]q
[R5-vpn-instance-2]q
[R5]
[R5]int g0/0/1
[R5-GigabitEthernet0/0/1]undo ip address 
[R5-GigabitEthernet0/0/1]ip binding vpn-instance 2
[R5-GigabitEthernet0/0/1]ip address 57.1.1.1 24
[R5-GigabitEthernet0/0/1]q
[R5]
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13

R6:

[R6]ip vpn-instance 3
[R6-vpn-instance-3]route-distinguisher 6:6
[R6-vpn-instance-3-af-ipv4]vpn-target 6:6 export-extcommunity
[R6-vpn-instance-3-af-ipv4]vpn-target 2:2 5:5 import-extcommunity 
[R6-vpn-instance-3-af-ipv4]q
[R6-vpn-instance-3]q
[R6]int g0/0/1
[R6-GigabitEthernet0/0/1]undo ip address 
[R6-GigabitEthernet0/0/1]ip binding vpn-instance 3
[R6-GigabitEthernet0/0/1]ip address 68.1.1.1 24
[R6-GigabitEthernet0/0/1]q
[R6]
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12

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

R1:

[R1]ip route-static 0.0.0.0 0 12.1.1.2
  • 1

R2:

[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 
[R2-bgp-1]q
[R2-bgp]q
[R2]
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7

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

R5:

[R5]rip 1 vpn-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 vpn-instance 2
[R5-bgp-2]import-route rip 1
[R5-bgp-2]q
[R5-bgp]q
[R5]
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11

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]
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

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

R6:

[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-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 vpn-instance 3
[R6-bgp-3]import-route ospf 2
[R6-bgp-3]q
[R6-bgp]q
[R6]
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12

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]
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

在这里插入图片描述
在这里插入图片描述

9、测试

在这里插入图片描述
实验结束。

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/很楠不爱3/article/detail/567687
推荐阅读
  

闽ICP备14008679号