Option A是背靠背的MPLS VPN,ASBR将与另一AS互联的接口认为是CE接口,配置VRF。
ASBR之间配置EBGP邻居,并在Addressfamily ipv4中设置EBGP邻居。
PE1:
ip vrf vpna
rd 100:1
route-target export 100:1
route-target import 100:1
interface Loopback0
ip address 1.1.1.1 255.255.255.255
!
interface Loopback1
ip vrf forwarding vpna
ip address 100.1.1.1 255.255.255.0
!
interface FastEthernet0/0
ip address 12.1.1.1 255.255.255.0
duplex auto
speed auto
mpls ip
!
router ospf 1
log-adjacency-changes
network 1.1.1.1 0.0.0.0 area 0
network 12.1.1.0 0.0.0.255 area 0
!
router bgp 100
no synchronization
bgp log-neighbor-changes
neighbor 2.2.2.2 remote-as 100
neighbor 2.2.2.2 update-source Loopback0
no auto-summary
!
address-family vpnv4
neighbor 2.2.2.2 activate
neighbor 2.2.2.2 send-community extended
exit-address-family
!
address-family ipv4 vrf vpna
redistribute connected
no synchronization
exit-address-family
ASBR1:
ip vrf vpna
rd 100:1
route-target export 100:1
route-target import 100:1
interface Loopback0
ip address 2.2.2.2 255.255.255.255
!
interface FastEthernet0/0
ip address 12.1.1.2 255.255.255.0
duplex auto
speed auto
mpls ip
!
interface FastEthernet1/0
ip vrf forwarding vpna
ip address 23.1.1.1 255.255.255.0
duplex auto
speed auto
!
router ospf 1
log-adjacency-changes
network 2.2.2.2 0.0.0.0 area 0
network 12.1.1.0 0.0.0.255 area 0
!
router bgp 100
no synchronization
bgp log-neighbor-changes
neighbor 1.1.1.1 remote-as 100
neighbor 1.1.1.1 update-source Loopback0
neighbor 23.1.1.2 remote-as 200
no auto-summary
!
address-family vpnv4
neighbor 1.1.1.1 activate
neighbor 1.1.1.1 send-community extended
exit-address-family
!
address-family ipv4 vrf vpna
neighbor 23.1.1.2 remote-as 200
neighbor 23.1.1.2 activate
no synchronization
exit-address-family
ASBR2:
ip vrf vpna
rd 100:1
route-target export 100:1
route-target import 100:1
interface Loopback0
ip address 3.3.3.3 255.255.255.255
!
interface FastEthernet0/0
ip vrf forwarding vpna
ip address 23.1.1.2 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet1/0
ip address 34.1.1.1 255.255.255.0
duplex auto
speed auto
mpls ip
!
router ospf 1
log-adjacency-changes
network 3.3.3.3 0.0.0.0 area 0
network 34.1.1.0 0.0.0.255 area 0
!
router bgp 200
no synchronization
bgp log-neighbor-changes
neighbor 4.4.4.4 remote-as 200
neighbor 4.4.4.4 update-source Loopback0
neighbor 23.1.1.1 remote-as 100
no auto-summary
!
address-family vpnv4
neighbor 4.4.4.4 activate
neighbor 4.4.4.4 send-community extended
exit-address-family
!
address-family ipv4 vrf vpna
neighbor 23.1.1.1 remote-as 100
neighbor 23.1.1.1 activate
no synchronization
exit-address-family
PE2:
ip vrf vpna
rd 100:1
route-target export 100:1
route-target import 100:1
interface Loopback0
ip address 4.4.4.4 255.255.255.255
!
interface Loopback1
ip vrf forwarding vpna
ip address 200.1.1.1 255.255.255.0
!
interface FastEthernet0/0
ip address 34.1.1.2 255.255.255.0
duplex auto
speed auto
mpls ip
!
router ospf 1
log-adjacency-changes
network 4.4.4.4 0.0.0.0 area 0
network 34.1.1.0 0.0.0.255 area 0
!
router bgp 200
no synchronization
bgp log-neighbor-changes
neighbor 3.3.3.3 remote-as 200
neighbor 3.3.3.3 update-source Loopback0
no auto-summary
!
address-family vpnv4
neighbor 3.3.3.3 activate
neighbor 3.3.3.3 send-community extended
exit-address-family
!
address-family ipv4 vrf vpna
redistribute connected
no synchronization
exit-address-family
查看vrf路由表:
PE1:
100.0.0.0/24 is subnetted, 1 subnets
C100.1.1.0 is directly connected, Loopback1
B200.1.1.0/24 [200/0] via 2.2.2.2, 00:18:54
ASBR1:
100.0.0.0/24 is subnetted, 1 subnets
B100.1.1.0 [200/0] via 1.1.1.1, 02:34:21
B200.1.1.0/24 [20/0] via 23.1.1.2, 00:19:44
23.0.0.0/24 is subnetted, 1 subnets
C23.1.1.0 is directly connected, FastEthernet1/0