一、shamlink实验
1.拓扑
2.CE1配置
sysname CE1
interface GigabitEthernet0/0/0
ip address 172.16.1.1 255.255.255.0
interface GigabitEthernet0/0/1
ip address 12.1.1.1 255.255.255.0
ospf cost 10
interface LoopBack0
ip address 1.1.5.5 255.255.255.0
ospf 1
area 0.0.0.0
network 1.1.5.5 0.0.0.0
network 12.1.1.0 0.0.0.255
network 172.16.1.0 0.0.0.255
[CE1]
3.PE1配置
sysname PE1
ip vpn-instance vpna
ipv4-family
route-distinguisher 100:1
vpn-target 100:1 export-extcommunity
vpn-target 100:1 import-extcommunity
mpls lsr-id 10.1.1.1
mpls
mpls ldp
interface GigabitEthernet0/0/0
ip binding vpn-instance vpna
ip address 172.16.1.2 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 10.1.12.1 255.255.255.0
mpls
mpls ldp
interface LoopBack0
ip address 10.1.1.1 255.255.255.0
interface LoopBack1
ip binding vpn-instance vpna
ip address 1.1.1.1 255.255.255.255
bgp 100
peer 10.1.4.4 as-number 100
peer 10.1.4.4 connect-interface LoopBack0
#
ipv4-family unicast
undo synchronization
peer 10.1.4.4 enable
#
ipv4-family vpnv4
policy vpn-target
peer 10.1.4.4 enable
#
ipv4-family vpn-instance vpna
network 1.1.1.1 255.255.255.255
import-route ospf 2
ospf 1
area 0.0.0.0
network 10.1.1.0 0.0.0.255
network 10.1.12.0 0.0.0.255
#
ospf 2 vpn-instance vpna
import-route bgp
area 0.0.0.0
network 172.16.1.0 0.0.0.255
sham-link 1.1.1.1 4.4.4.4
4.P1配置
sysname P1
mpls lsr-id 10.1.2.2
mpls
mpls ldp
interface GigabitEthernet0/0/0
ip address 10.1.12.2 255.255.255.0
mpls
mpls ldp
interface GigabitEthernet0/0/1
ip address 10.1.23.2 255.255.255.0
mpls
mpls ldp
interface LoopBack0
ip address 10.1.2.2 255.255.255.0
ospf 1
area 0.0.0.0
network 10.1.2.2 0.0.0.0
network 10.1.12.0 0.0.0.255
network 10.1.23.0 0.0.0.255
5.P2配置
sysname P2
mpls lsr-id 10.1.3.3
mpls
mpls ldp
interface GigabitEthernet0/0/0
ip address 10.1.23.3 255.255.255.0
mpls
mpls ldp
#
interface GigabitEthernet0/0/1
ip address 10.1.34.3 255.255.255.0
mpls
mpls ldp
interface LoopBack0
ip address 10.1.3.3 255.255.255.0
#
ospf 1
area 0.0.0.0
network 10.1.3.3 0.0.0.0
network 10.1.23.0 0.0.0.255
network 10.1.34.0 0.0.0.255
6.PE2配置
sysname PE2
ip vpn-instance vpna
ipv4-family
route-distinguisher 100:1
vpn-target 100:1 export-extcommunity
vpn-target 100:1 import-extcommunity
mpls lsr-id 10.1.4.4
mpls
mpls ldp
interface GigabitEthernet0/0/0
ip address 10.1.34.4 255.255.255.0
mpls
mpls ldp
#
interface GigabitEthernet0/0/1
ip binding vpn-instance vpna
ip address 172.16.2.2 255.255.255.0
interface LoopBack0
ip address 10.1.4.4 255.255.255.0
#
interface LoopBack1
ip binding vpn-instance vpna
ip address 4.4.4.4 255.255.255.255
#
bgp 100
peer 10.1.1.1 as-number 100
peer 10.1.1.1 connect-interface LoopBack0
#
ipv4-family unicast
undo synchronization
peer 10.1.1.1 enable
#
ipv4-family vpnv4
policy vpn-target
peer 10.1.1.1 enable
#
ipv4-family vpn-instance vpna
network 4.4.4.4 255.255.255.255
import-route ospf 2
#
ospf 1
area 0.0.0.0
network 10.1.4.4 0.0.0.0
network 10.1.34.0 0.0.0.255
#
ospf 2 vpn-instance vpna
import-route bgp
area 0.0.0.0
network 172.16.2.0 0.0.0.255
sham-link 4.4.4.4 1.1.1.1
7.CE2配置
sysname CE2
interface GigabitEthernet0/0/0
ip address 172.16.2.1 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 12.1.1.2 255.255.255.0
ospf cost 3
#
interface LoopBack0
ip address 1.1.6.6 255.255.255.0
#
ospf 1
area 0.0.0.0
network 1.1.6.6 0.0.0.0
network 12.1.1.0 0.0.0.255
network 172.16.2.0 0.0.0.255
二、实验论证