拓扑:

 

华为mpls vpn_mpls vpn

AR1配置:

#
sysname R1
#
undo info-center enable
#
router id 1.1.1.1
#
ip vpn-instance r1
ipv4-family
route-distinguisher 100:1
vpn-target 100:1 export-extcommunity
vpn-target 100:1 100:3 import-extcommunity
#
mpls lsr-id 1.1.1.1
mpls
#
mpls ldp
#
interface Ethernet0/0/0
ip binding vpn-instance r1
ip address 14.1.1.1 255.255.255.0
#
interface Serial0/0/0
link-protocol ppp
ip address 10.0.12.1 255.255.255.0
mpls
mpls ldp
#
interface LoopBack0
ip address 1.1.1.1 255.255.255.255
#
bgp 100
undo default ipv4-unicast
peer 3.3.3.3 as-number 100
peer 3.3.3.3 connect-interface LoopBack0
#
ipv4-family unicast
undo synchronization
peer 3.3.3.3 enable
#
ipv4-family vpnv4
policy vpn-target
peer 3.3.3.3 enable
#
ipv4-family vpn-instance r1
import-route ospf 1
#
ospf 1 router-id 14.1.1.1 vpn-instance r1
import-route bgp tag 100
area 0.0.0.0
network 14.1.1.0 0.0.0.255
#
ospf 100 router-id 1.1.1.1
area 0.0.0.0
network 10.0.12.0 0.0.0.255
network 1.1.1.1 0.0.0.0
#
AR2配置:

#
sysname R2
#
undo info-center enable
#
router id 2.2.2.2
#
mpls lsr-id 2.2.2.2
mpls
#
mpls ldp
#
interface Serial0/0/0
link-protocol ppp
ip address 10.0.12.2 255.255.255.0
mpls
mpls ldp
#
interface Serial0/0/1
link-protocol ppp
ip address 10.0.23.2 255.255.255.0
mpls
mpls ldp
interface LoopBack1
ip address 2.2.2.2 255.255.255.255
#
ospf 100 router-id 2.2.2.2
area 0.0.0.0
network 10.0.12.0 0.0.0.255
network 10.0.23.0 0.0.0.255
network 2.2.2.2 0.0.0.0
#

AR3配置:

#
sysname R3
#
undo info-center enable
#
router id 3.3.3.3
#
ip vpn-instance r3
ipv4-family
route-distinguisher 100:3
vpn-target 100:1 export-extcommunity
vpn-target 100:1 100:3 import-extcommunity
#
mpls lsr-id 3.3.3.3
mpls
#
mpls ldp
#
interface Ethernet0/0/0
ip binding vpn-instance r3
ip address 35.1.1.3 255.255.255.0
#
interface Serial0/0/1
link-protocol ppp
ip address 10.0.23.3 255.255.255.0
mpls
mpls ldp
#
interface LoopBack1
ip address 3.3.3.3 255.255.255.255
#
bgp 100
undo default ipv4-unicast
peer 1.1.1.1 as-number 100
peer 1.1.1.1 connect-interface LoopBack1
#
ipv4-family unicast
undo synchronization
peer 1.1.1.1 enable
#
ipv4-family vpnv4
policy vpn-target
peer 1.1.1.1 enable
#
ipv4-family vpn-instance r3
import-route ospf 2
#
ospf 2 router-id 35.1.1.3 vpn-instance r3
import-route bgp tag 100
area 0.0.0.0
network 35.1.1.0 0.0.0.255
#
ospf 100 router-id 3.3.3.3
area 0.0.0.0
network 10.0.23.0 0.0.0.255
network 3.3.3.3 0.0.0.0
#

AR4配置:

#
sysname r4
#
undo info-center enable
#
interface Ethernet0/0/0
ip address 14.1.1.4 255.255.255.0
#
interface LoopBack0
ip address 4.4.4.4 255.255.255.255
#
ospf 1 router-id 14.1.1.4
area 0.0.0.0
network 14.1.1.0 0.0.0.255
network 4.4.4.4 0.0.0.0

AR5配置:

#
sysname r5
#
undo info-center enable
#
interface Ethernet0/0/0
ip address 35.1.1.5 255.255.255.0
interface LoopBack0
ip address 5.5.5.5 255.255.255.255
#
ospf 2 router-id 35.1.1.5
area 0.0.0.0
network 35.1.1.0 0.0.0.255
network 5.5.5.5 0.0.0.0
#
user-interface con 0
user-interface vty 0 4
user-interface vty 16 20
#
验证:

华为mpls vpn_mpls vpn_02

 

华为mpls vpn_mpls vpn_03