拓扑如下:
这里只放PE和ASBR的配置,CE配置较为简单,由于AS100和AS200的ASBR和PE配置相似,这里只放AS100内的PE和ASBR配置
PE1:
#
sysname PE1
#
ip vpn-instance PE1
route-distinguisher 2:2
vpn-target 1:1 import-extcommunity
vpn-target 1:1 export-extcommunity
#
ospf 1
area 0.0.0.0
network 2.2.2.2 0.0.0.0
network 10.0.23.2 0.0.0.0
#
ospf 2 vpn-instance PE1
import-route bgp
area 0.0.0.0
network 10.0.12.2 0.0.0.0
#
mpls lsr-id 2.2.2.2
#
vlan 1
#
mpls ldp
#
interface LoopBack0
ip address 2.2.2.2 255.255.255.255
#
interface GigabitEthernet0/0
port link-mode route
combo enable copper
ip binding vpn-instance PE1
ip address 10.0.12.2 255.255.255.0
#
interface GigabitEthernet0/1
port link-mode route
combo enable copper
ip address 10.0.23.2 255.255.255.0
mpls enable
mpls ldp enable
#
bgp 100
peer 3.3.3.3 as-number 100
peer 3.3.3.3 connect-interface LoopBack0
#
address-family vpnv4
peer 3.3.3.3 enable
#
ip vpn-instance PE1
#
address-family ipv4 unicast
import-route ospf 2
#
return
ASBR1:
#
sysname ASBR1
#
ospf 1
area 0.0.0.0
network 3.3.3.3 0.0.0.0
network 10.0.23.3 0.0.0.0
#
mpls lsr-id 3.3.3.3
#
vlan 1
#
mpls ldp
#
interface LoopBack0
ip address 3.3.3.3 255.255.255.255
#
interface GigabitEthernet0/0
port link-mode route
combo enable copper
ip address 10.0.23.3 255.255.255.0
mpls enable
mpls ldp enable
#
interface GigabitEthernet0/1
port link-mode route
combo enable copper
ip address 10.0.34.3 255.255.255.0
mpls enable
#
bgp 100
peer 2.2.2.2 as-number 100
peer 2.2.2.2 connect-interface LoopBack0
peer 10.0.34.4 as-number 200
#
address-family vpnv4
undo policy vpn-target
peer 2.2.2.2 enable
peer 10.0.34.4 enable
#
return
结果是,两端CE可以通过OSPF协议收到对方的路由信息,由于PE上是吧BGP引入OSPF中,应该产生LSA 5,但是由于机制则会产生LSA 3,为了保证两端CE OSPF的连续性