! PE (Provider Edge) Router Configuration
!
hostname PE-Router
!
! Create two VRFs
ip vrf VRF1
rd 1:100
route-target export 1:100
route-target import 1:100
!
ip vrf VRF2
rd 2:100
route-target export 2:100
route-target import 2:100
!
! Create a loopback interface to act as the BGP router ID, note it is not part of
! a vrf
! a vrf
interface Loopback0
ip address 100.1.1.1 255.255.255.255
!
! Create two more loopback interfaces, one in each VRF. This was just done to
! illustrate that you can use overlapping address space
interface Loopback1
ip vrf forwarding VRF1
ip address 1.1.1.1 255.255.255.255
!
interface Loopback2
ip vrf forwarding VRF2
ip address 1.1.1.1 255.255.255.255
!
interface FastEthernet0/0
no ip address
speed 100
full-duplex
!
! Create two subinterface with a dot1q tag and assign to each vrf
interface FastEthernet0/0.1
encapsulation dot1Q 1 native
ip vrf forwarding VRF1
ip address 192.168.1.1 255.255.255.0
!
interface FastEthernet0/0.2
encapsulation dot1Q 2
ip vrf forwarding VRF2
ip address 192.168.2.1 255.255.255.0
!
! Configure the BGP section
router bgp 1
no synchronization
bgp router-id 100.1.1.1
bgp log-neighbor-changes
no auto-summary
!
address-family ipv4 vrf VRF2
redistribute connected
neighbor 192.168.2.254 remote-as 100
neighbor 192.168.2.254 activate
no synchronization
exit-address-family
!
address-family ipv4 vrf VRF1
redistribute connected
neighbor 192.168.1.254 remote-as 100
neighbor 192.168.1.254 activate
no synchronization
exit-address-family
!
===============================================================
! CE (Customer Edge) Router Configuration
!
hostname CE-Router
!
! On this router we just create one VRF - the other received routes are going
! to go into the global routing table
ip vrf VRF2
rd 2:100
!
interface FastEthernet0/0
no ip address
speed 100
full-duplex
!
! Create subinterfaces with dot1q tags - note that only Fa0/0.2 has
! a vrf forwarding statement
! a vrf forwarding statement
interface FastEthernet0/0.1
encapsulation dot1Q 1 native
ip address 192.168.1.254 255.255.255.0
!
interface FastEthernet0/0.2
encapsulation dot1Q 2
ip vrf forwarding VRF2
ip address 192.168.2.254 255.255.255.0
!
interface FastEthernet0/1
no ip address
speed 100
full-duplex
!
! BGP configuration - note how one neighbour statement is in the global
! section and one is in the "address-family ipv4" section
router bgp 100
no synchronization
bgp log-neighbor-changes
redistribute connected
neighbor 192.168.1.1 remote-as 1
no auto-summary
!
address-family ipv4 vrf VRF2
redistribute connected
neighbor 192.168.2.1 remote-as 1
neighbor 192.168.2.1 activate
no synchronization
exit-address-family
!
===============================================================
On the PE router:
! Only the loopback0 interface is in the global routing table
PE-Router#sh ip ro
100.0.0.0/32 is subnetted, 1 subnets
C 100.1.1.1 is directly connected, Loopback0
PE-Router#sh ip route vrf VRF1
1.0.0.0/32 is subnetted, 1 subnets
C 1.1.1.1 is directly connected, Loopback1
C 192.168.1.0/24 is directly connected, FastEthernet0/0.1
PE-Router#sh ip route vrf VRF2
1.0.0.0/32 is subnetted, 1 subnets
C 1.1.1.1 is directly connected, Loopback2
C 192.168.2.0/24 is directly connected, FastEthernet0/0.2
PE-Router#sh ip bgp vpnv4 all
BGP table version is 14, local router ID is 100.1.1.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
Route Distinguisher: 1:100 (default for vrf VRF1)
*> 1.1.1.1/32 0.0.0.0 0 32768 ?
* 192.168.1.0 192.168.1.254 0 0 100 ?
*> 0.0.0.0 0 32768 ?
Route Distinguisher: 2:100 (default for vrf VRF2)
*> 1.1.1.1/32 0.0.0.0 0 32768 ?
* 192.168.2.0 192.168.2.254 0 0 100 ?
*> 0.0.0.0 0 32768 ?
On the CE router:
CE-Router#sh ip ro
1.0.0.0/32 is subnetted, 1 subnets
B 1.1.1.1 [20/0] via 192.168.1.1, 00:44:36
C 192.168.1.0/24 is directly connected, FastEthernet0/0.1
CE-Router#sh ip route vrf VRF2
1.0.0.0/32 is subnetted, 1 subnets
B 1.1.1.1 [20/0] via 192.168.2.1, 00:39:49
C 192.168.2.0/24 is directly connected, FastEthernet0/0.2
CE-Router#sh ip bgp summary
BGP router identifier 192.168.1.254, local AS number 100
BGP table version is 4, main routing table version 4
2 network entries using 234 bytes of memory
3 path entries using 156 bytes of memory
3/2 BGP path/bestpath attribute entries using 372 bytes of memory
1 BGP AS-PATH entries using 24 bytes of memory
0 BGP route-map cache entries using 0 bytes of memory
0 BGP filter-list cache entries using 0 bytes of memory
BGP using 786 total bytes of memory
BGP activity 5/1 prefixes, 7/1 paths, scan interval 60 secs
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
192.168.1.1 4 1 54 53 4 0 0 00:45:31 2
CE-Router#sh ip bgp vpnv4 all
BGP table version is 7, local router ID is 192.168.1.254
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
Route Distinguisher: 2:100 (default for vrf VRF2)
*> 1.1.1.1/32 192.168.2.1 0 0 1 ?
* 192.168.2.0 192.168.2.1 0 0 1 ?
*> 0.0.0.0 0 32768 ?