Sub topic 8
VRFs, route distinguishers, route targets, and MP-BGP
This chapter assumes you know IPv4 addressing, basic routing, BGP at a conceptual level, and how to read router CLI output. It also assumes you know how MPLS labels are pushed, swapped, and popped. The goal is to see how one PE router keeps many customers' routes apart, even when two customers use the same addresses.
The problem: overlapping address space
Two customers may both use 192.168.10.0/24. A single routing table cannot hold both routes, because the router would see two prefixes with the same address and could not tell them apart. The provider needs separate routing tables per customer on the same router, and a way to carry those routes between PEs without mixing them up.
Three pieces solve this:
- A VRF (Virtual Routing and Forwarding instance) is a separate routing and forwarding table on a PE, bound to specific customer-facing interfaces.
- A route distinguisher (RD) is a 64-bit value prepended to an IPv4 prefix. This makes the prefix globally unique as a 96-bit VPNv4 prefix.
- A route target (RT) is a BGP extended community that controls which VRFs import or export a route.
What each piece does
The RD and the RT are easy to confuse. The RD only makes a route unique. It does not decide who receives the route. The RT decides who receives it.
| Item | Where it lives | Purpose |
|---|---|---|
| VRF | PE router | Separate routing table per customer |
| RD | Prefix prefix, for example 65000:100 | Keeps overlapping prefixes distinct in BGP |
| Export RT | Extended community on the route | Marks a route as belonging to a VPN |
| Import RT | VRF setting | Selects which received routes enter the VRF |
Configuration on a PE
This configuration creates a VRF named CUST_A, places a customer-facing interface in it, and exchanges routes with another PE using MP-BGP.
vrf definition CUST_A
rd 65000:100
address-family ipv4
route-target export 65000:100
route-target import 65000:100
exit-address-family
!
interface GigabitEthernet0/2
vrf forwarding CUST_A
ip address 192.168.10.1 255.255.255.252
no shutdown
!
router bgp 65000
neighbor 10.255.255.2 remote-as 65000
neighbor 10.255.255.2 update-source Loopback0
address-family vpnv4
neighbor 10.255.255.2 activate
neighbor 10.255.255.2 send-community extended
exit-address-family
address-family ipv4 vrf CUST_A
neighbor 192.168.10.2 remote-as 65010
neighbor 192.168.10.2 activate
exit-address-familyNote the order of operations. Applying vrf forwarding to an interface removes its existing IP address, so you set the address after the VRF. The send-community extended line is required, because RTs travel as extended communities. Without it, the remote PE receives routes with no RT and imports nothing.
How a route travels
MP-BGP (Multiprotocol BGP) is BGP extended to carry more than plain IPv4 prefixes. Between PEs it carries VPNv4 routes in the vpnv4 address family. The next hop is the originating PE's loopback, and the route also carries a VPN label.
The PE-to-PE path uses a two-label stack. The outer label gets the packet across the provider core to the remote PE. The inner VPN label tells the remote PE which VRF should receive the packet.
Common errors
- Missing
send-community extended. Routes arrive at the remote PE but are never imported. - RT mismatch. The export RT on one PE must match an import RT on the other.
- Using the global table for tests. Run
ping vrf CUST_A 192.168.10.2, not a plainping. Useful checks areshow ip route vrf CUST_Aandshow bgp vpnv4 unicast all. - Assuming the RD controls reachability. Different RDs with the same RT still share routes, which is often how you build a full mesh of sites.
Exercise
A remote PE shows the VPNv4 route for 192.168.10.0/24 in show bgp vpnv4 unicast all, but the route is missing from show ip route vrf CUST_A. Name one likely cause and where you would check it.
Show answer
The VRF's import RT does not match the RT carried by the route. Compare the route's extended community in the VPNv4 table with the route-target import line in the VRF definition on the remote PE.