参考配置
PE1
#
sysname PE1
#
ip vpn-instance vpn1 //创建VPN实例
ipv4-family
route-distinguisher 1:1
vpn-target 1:1 export-extcommunity
vpn-target 1:1 import-extcommunity
#
mpls lsr-id 1.1.1.1 //配置MPLS能力
mpls
#
mpls ldp
#
interface GigabitEthernet0/0/0
ip binding vpn-instance vpn1 //私网侧接口与VPN绑定
ip address 10.1.1.1 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 192.168.1.1 255.255.255.0
mpls
mpls ldp //公网侧接口使能mpls能力
#
interface LoopBack0
ip address 1.1.1.1 255.255.255.255
#
bgp 100
peer 2.2.2.2 as-number 100
peer 2.2.2.2 connect-interface LoopBack0 //使用32位掩码的Loopback接口地址来建立MP-IBGP对等体关系
#
ipv4-family unicast
undo synchronization
peer 2.2.2.2 enable
#
ipv4-family vpnv4 //使能对等体交换VPNv4路由信息的能力
policy vpn-target
peer 2.2.2.2 enable
#
ipv4-family vpn-instance vpn1
import-route static //将本端静态路由引入BGP-VPN实例IPv4地址族路由表
#
ospf 1 //使用OSPF发布PE之间的路由,到达Loopback接口的路由
area 0.0.0.0
network 1.1.1.1 0.0.0.0
network 192.168.1.0 0.0.0.255
#
ip route-static vpn-instance vpn1 10.137.1.0 255.255.255.0 10.1.1.2
#
return
#
PE2
#
sysname PE2
#
ip vpn-instance vpn1 //创建VPN实例
ipv4-family
route-distinguisher 1:1
vpn-target 1:1 export-extcommunity
vpn-target 1:1 import-extcommunity
#
mpls lsr-id 2.2.2.2 //配置MPLS能力
mpls
#
mpls ldp
#
interface GigabitEthernet0/0/0
ip binding vpn-instance vpn1 //私网侧接口与VPN绑定
ip address 10.1.2.1 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 192.168.1.2 255.255.255.0
mpls
mpls ldp //公网侧接口使能mpls能力
#
interface LoopBack0
ip address 2.2.2.2 255.255.255.255
#
bgp 100
peer 1.1.1.1 as-number 100
peer 1.1.1.1 connect-interface LoopBack0 //使用32位掩码的Loopback接口地址来建立MP-IBGP对等体关系
#
ipv4-family unicast
undo synchronization
peer 1.1.1.1 enable
#
ipv4-family vpnv4 //使能对等体交换VPNv4路由信息的能力
policy vpn-target
peer 1.1.1.1 enable
#
ipv4-family vpn-instance vpn1
import-route static //将本端静态路由引入BGP-VPN实例IPv4地址族路由表
#
ospf 1 //使用OSPF发布PE之间的路由,到达Loopback接口的路由
area 0.0.0.0
network 192.168.1.0 0.0.0.255
network 2.2.2.2 0.0.0.0
#
ip route-static vpn-instance vpn1 10.137.2.0 255.255.255.0 10.1.2.2
#
CE1
#
sysname CE1
#
interface GigabitEthernet0/0/0
ip address 10.137.1.1 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 10.1.1.2 255.255.255.0
#
ip route-static 0.0.0.0 0.0.0.0 10.1.1.1
#
return
CE2
#
sysname CE2
#
interface GigabitEthernet0/0/0
ip address 10.137.2.1 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 10.1.2.2 255.255.255.0
#
ip route-static 0.0.0.0 0.0.0.0 10.1.2.1
#
return