MPLS VPN
- 一、实验
- 1、实验拓扑及要求
- 2、实验拓扑搭建以及IP地址划分
- 3、实验步骤
- 1、配置永不超时以及接口IP地址
- 2、给R1,R2,R3,R4配置OSPF
- 3、配置BGP非直连建邻,并开启vpnV4路由传递功能
- 4、配置MPLS
- 5、在PE端做MPLS VPN
- 6、给R1以及R5配置静态,并将其导入BGP
- 7、给R3以及R6配置RIP,并将其导入BGP
- 8、给R4以及R7配置OSPF,并导入BGP
一、实验
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]
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:
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]
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]
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]
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 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]
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]
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]
6、给R1以及R5配置静态,并将其导入BGP
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]
R5:
[R5]ip route-static 0.0.0.0 0.0.0.0 15.1.1.1
7、给R3以及R6配置RIP,并将其导入BGP
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]
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,并导入BGP
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]
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路由表:
实验一结束。