局域网组网 实验7 MPLS VNP

在这里插入图片描述
在这里插入图片描述
配置:
AR1:

#
interface GigabitEthernet0/0/0
 ip address 10.1.2.1 255.255.255.0 
#
interface GigabitEthernet0/0/1
#
interface GigabitEthernet0/0/2
#
interface NULL0
#
interface LoopBack0
 ip address 10.1.1.1 255.255.255.255 
#
ip route-static 10.1.3.0 255.255.255.0 10.1.2.2
ip route-static 10.1.4.0 255.255.255.0 10.1.2.2

AR2:

#
interface GigabitEthernet0/0/0
 ip address 10.1.2.1 255.255.255.0
#
interface LoopBack0
 ip address 10.1.1.1 255.255.255.0 
#
rip 1
 version 2
 network 10.0.0.0
AR3:
#
ip vpn-instance a1
 ipv4-family
  route-distinguisher 2:2
  vpn-target 2:2 export-extcommunity
  vpn-target 2:2 import-extcommunity
#
ip vpn-instance b1
 ipv4-family
  route-distinguisher 1:1
  vpn-target 1:1 export-extcommunity
  vpn-target 1:1 import-extcommunity
#
mpls lsr-id 3.3.3.3
mpls
#
mpls ldp
#
interface GigabitEthernet0/0/0
 ip binding vpn-instance b1
 ip address 10.1.2.2 255.255.255.0 
#
interface GigabitEthernet0/0/1
 ip binding vpn-instance a1
 ip address 10.1.2.2 255.255.255.0 
#
interface GigabitEthernet0/0/2
 ip address 34.1.1.3 255.255.255.0 
 mpls
 mpls ldp
#
interface LoopBack0
 ip address 3.3.3.3 255.255.255.255 
#
bgp 1
 router-id 3.3.3.3
 peer 5.5.5.5 as-number 1 
 peer 5.5.5.5 connect-interface LoopBack0
 #
 ipv4-family unicast
  undo synchronization
  peer 5.5.5.5 enable
 # 
 ipv4-family vpnv4
  policy vpn-target
  peer 5.5.5.5 enable
 #
 ipv4-family vpn-instance a1 
  import-route rip 1
 #
 ipv4-family vpn-instance b1 
  import-route direct
  import-route static
#
ospf 1 router-id 3.3.3.3 
 area 0.0.0.0 
  network 3.3.3.3 0.0.0.0 
  network 34.1.1.3 0.0.0.0 
#
rip 1 vpn-instance a1
 undo summary
 version 2
 network 10.0.0.0
 import-route bgp
#
ip route-static vpn-instance b1 10.1.1.0 255.255.255.0 10.1.2.1

AR4:

#
mpls lsr-id 4.4.4.4
mpls
#
mpls ldp
#
interface GigabitEthernet0/0/0
 ip address 45.1.1.4 255.255.255.0 
 mpls
 mpls ldp
#
interface GigabitEthernet0/0/1
#
interface GigabitEthernet0/0/2
 ip address 34.1.1.4 255.255.255.0 
 mpls
 mpls ldp
#
interface LoopBack0
 ip address 4.4.4.4 255.255.255.0 
#
ospf 1 router-id 4.4.4.4 
 area 0.0.0.0 
  network 4.4.4.4 0.0.0.0 
  network 34.1.1.4 0.0.0.0 
  network 45.1.1.4 0.0.0.0 
AR5:
#
ip vpn-instance a2
 ipv4-family
  route-distinguisher 2:2
  vpn-target 2:2 export-extcommunity
  vpn-target 2:2 import-extcommunity
#
ip vpn-instance b2
 ipv4-family
  route-distinguisher 1:1
  vpn-target 1:1 export-extcommunity
  vpn-target 1:1 import-extcommunity
#
mpls lsr-id 5.5.5.5
mpls
#
mpls ldp
#
firewall zone Local
 priority 15
#
interface GigabitEthernet0/0/0
 ip address 45.1.1.5 255.255.255.0 
 mpls
 mpls ldp
#
interface GigabitEthernet0/0/1
 ip binding vpn-instance b2
 ip address 10.1.3.2 255.255.255.0 
#
interface GigabitEthernet0/0/2
 ip address 57.1.1.5 255.255.255.0 
#
interface GigabitEthernet2/0/0
 ip binding vpn-instance a2
 ip address 10.1.3.2 255.255.255.0 
#
interface LoopBack0
 ip address 5.5.5.5 255.255.255.0 
#
bgp 1
 router-id 5.5.5.5
 peer 3.3.3.3 as-number 1 
 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 a2 
  import-route ospf 2
 #
 ipv4-family vpn-instance b2 
  import-route direct
  import-route static
#
ospf 1 router-id 5.5.5.5 
 silent-interface GigabitEthernet0/0/2
 area 0.0.0.0 
  network 5.5.5.5 0.0.0.0 
  network 45.1.1.5 0.0.0.0 
  network 57.1.1.5 0.0.0.0 
#
ospf 2 vpn-instance a2
 import-route bgp
 area 0.0.0.0 
  network 10.1.3.0 0.0.0.255 
#
ip route-static vpn-instance b2 10.1.4.0 255.255.255.0 10.1.3.1

AR6:

#
interface GigabitEthernet0/0/1
 ip address 10.1.3.1 255.255.255.0 
#
interface LoopBack0
 ip address 10.1.4.1 255.255.255.0 
#
ip route-static 10.1.1.0 255.255.255.0 10.1.3.2
ip route-static 10.1.2.0 255.255.255.0 10.1.3.2
AR7:
#
interface GigabitEthernet0/0/1
 ip address 10.1.3.1 255.255.255.0 
#
interface GigabitEthernet0/0/2
 ip address 57.1.1.7 255.255.255.0 
#
interface LoopBack0
 ip address 10.1.4.2 255.255.255.0 
#
ospf 1 
 area 0.0.0.0 
  network 10.1.3.1 0.0.0.0 
  network 10.1.4.0 0.0.0.255 
#
ip route-static 0.0.0.0 0.0.0.0 57.1.1.5

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