ip vrf test1
rd 1:1
route-target import 1:1
route-target export 1:1
!
ip vrf test2
rd 1:2
route-target import 1:2
route-target export 1:2
!
interface Loopback0
ip address 1.1.1.1 255.255.255.255
!
interface FastEthernet0/0
description Connection to PE1
ip address 10.1.1.1 255.255.255.0
mpls ip
!
interface FastEthernet0/1
description Connection to ASBR2
no ip address
!
interface FastEthernet0/1.10
encapsulation dot1q 10
ip vrf forwarding test1
ip address 172.17.1.1 255.255.255.0
!
interface FastEthernet0/1.20
encapsulation dot1q 20
ip vrf forwarding test2
ip address 172.16.2.1 255.255.255.0
!
router ospf 1
network 10.1.1.0 0.0.0.255 area 0
network 1.1.1.1 0.0.0.0 area 0
!
router bgp 1
no synchronization
bgp log-neighbor-changes
bgp router-id 1.1.1.1
no auto-summary
neighbor 1.1.1.2 remote-as 1
neighbor 1.1.1.2 update-source Loopback0
!
address-family vpnv4
neighbor 1.1.1.2 activate
exit-address-family
!
address-family ipv4 vrf test1
neighbor 172.17.1.2 remote-as 2
neighbor 172.17.1.2 activate
no auto-summary
no synchronization
exit-address-family
!
address-family ipv4 vrf test2
neighbor 172.16.2.2 remote-as 2
neighbor 2172.16.2.2 activate
no auto-summary
no synchronization
exit-address-family
!
ip vrf test1
rd 2:1
route-target import 2:1
route-target export 2:1
!
ip vrf test2
rd 2:2
route-target import 2:2
route-target export 2:2
!
interface Loopback0
ip address 2.2.2.2 255.255.255.255
!
interface FastEthernet0/0
description Connection to PE2
ip address 10.1.1.1 255.255.255.0
mpls ip
!
interface FastEthernet0/1
description Connection to ASBR2
no ip address
!
interface FastEthernet0/1.10
encapsulation dot1q 10
ip vrf forwarding test1
ip address 172.17.1.2 255.255.255.0
!
interface FastEthernet0/1.20
encapsulation dot1q 20
ip vrf forwarding test2
ip address 172.16.2.2 255.255.255.0
!
router ospf 1
passive-interface FastEthernet0/1
network 10.1.1.0 0.0.0.255 area 0
network 2.2.2.2 0.0.0.0 area 0
!
router bgp 1
no synchronization
bgp log-neighbor-changes
bgp router-id 2.2.2.2
neighbor 2.2.2.3 remote-as 1
neighbor 2.2.2.3 update-source Loopback0
!
address-family vpnv4
neighbor 2.2.2.3 activate
exit-address-family
!
address-family ipv4 vrf test1
neighbor 172.17.1.2 remote-as 2
neighbor 172.17.1.2 activate
no auto-summary
no synchronization
exit-address-family
!
address-family ipv4 vrf test2
neighbor 172.16.2.2 remote-as 2
neighbor 172.16.2.2 activate
no auto-summary
no synchronization
exit-address-family
!
Source: https://habr.com/ru/post/74556/
All Articles