What an MPLS L3VPN is
An L3VPN (RFC 4364, also called BGP/MPLS IP VPN) is the service a provider uses to connect a company's sites over its own network: the customer sees a private IP network and the provider routes its traffic separately from other customers'. Each site has a CE (Customer Edge) router that talks to a provider PE (Provider Edge); the P routers in the core know nothing about the customers.
Four pieces work together: an IGP (IS-IS here) so the PEs can reach each other, LDP for the transport labels, VRFs on the PEs to separate each customer, and MP-BGP between the PEs to exchange customer routes with a second label, the VPN label.
VRF, RD and RT
| Piece | What it is | In this lab |
|---|---|---|
| VRF | A separate routing table inside the PE, one per customer | CL, on PE1 and PE2 |
| RD (Route Distinguisher) | 8 bytes in front of the prefix: they make the route unique in BGP even if two customers use the same addresses | 64500:10 |
| RT (Route Target) | Extended community: decides which VRF imports each route (export when advertising, import when receiving) | 64500:10 both ways |
| VPNv4 route | RD + IPv4 prefix, with its label, in MP_REACH_NLRI (AFI 1, SAFI 128) | 64500:10:192.168.40.0/24 |
| VPN label | Assigned by the egress PE to each VRF prefix; it goes under the transport label | 24 on PE2, 19 on PE1 |
The RD and the RT often have the same value, but they do different things: the RD only keeps two identical routes from clashing inside BGP; the RT decides the VPN topology. With several RTs you can build extranets or hub-and-spoke topologies.
How it works: from the control plane to traffic
Six steps: the VPNv4 session, the Toronto route, the Vancouver route, the outbound ping link by link, the reply and the keepalives.
iBGP VPNv4 between the Loopbacks
PE1 and PE2 are in the same AS (64500): they are iBGP neighbors between their Loopbacks, even with P1 in the middle. In the OPEN they advertise the multiprotocol capability for VPNv4 instead of IPv4 unicast, because they have no bgp default ipv4-unicast. Look at the path: what PE1 sends to 10.255.0.3 leaves with LDP label 21, and what comes from PE2 arrives unlabeled, because P1 removed the label (PHP). P1 doesn't speak BGP.
UPDATE from PE2: the Toronto network
PE2 has a static route in VRF CL to 192.168.40.0/24 (behind R3) and redistributes it into BGP. The UPDATE carries it inside MP_REACH_NLRI as a VPNv4 route: RD 64500:10 + 192.168.40.0/24, with VPN label 24 and next hop 10.255.0.3. The extended community carries RT 64500:10. PE1 has route-target import 64500:10 in VRF CL, so it imports it: B 192.168.40.0/24 [200/0] via 10.255.0.3.
UPDATE from PE1: the Vancouver network
PE1 does the same with 192.168.10.0/24, Ana's network behind R1: RD 64500:10, RT 64500:10 and VPN label 19, which it assigned itself. Each PE picks the labels for its own prefixes; the other one uses them to send it traffic. Like everything going to PE2's Loopback, this UPDATE also crosses the core with transport label 21.
Outbound: no label, two, one, none
R1 sends the ping to PE1 as a normal IP packet. PE1 receives it on a VRF CL interface, looks up 192.168.40.0/24 in that table and pushes two labels: the VPN label at the bottom (24, the one PE2 advertised) and the transport label on top (21, to reach PE2). P1 only looks at the top one; as the penultimate hop, it removes it (PHP). PE2 receives label 24, knows it belongs to VRF CL, removes it and sends the IP packet to R3.
Return: PE1's labels
The server replies and R3 sends the packet to PE2. PE2 looks up 192.168.10.0/24 in its VRF CL and pushes VPN label 19 (PE1's) and transport label 20 (the one P1 advertised for 10.255.0.1). P1 removes the transport label and PE1 receives only 19: it looks it up in its MPLS forwarding table, sees it belongs to VRF CL and delivers the packet to R1 without a label. The TTL drops by 1 at each router, P1 included.
KEEPALIVE every 60 s
With no changes, PE1 and PE2 only exchange a KEEPALIVE every 60 s. If the customer adds a network in Vancouver, PE1 will send a new UPDATE with its label; if the session drops, the Toronto routes disappear from VRF CL. Another customer could use the same addresses (192.168.10.0/24) in another VRF: its RD would make it a different route in BGP and its RT, a different table in each PE.
The two labels
| Label | Who assigns it | Which protocol | Who looks at it |
|---|---|---|---|
| Transport (top) | Each LSR, for each Loopback | LDP | The core P routers: they swap it or, at the penultimate hop, remove it |
| VPN (bottom, S = 1) | The egress PE, for each VRF prefix | MP-BGP | Only the egress PE, to know which VRF and which CE it goes to |
Thanks to the VPN label, the P routers don't need to know any customer route: reaching the egress PE's Loopback is enough. That's why the core scales to thousands of customers.
How the PE learns the customer's networks
| Between CE and PE | When it's used |
|---|---|
| Static route (as here) | Small sites with a single network behind the CE |
| eBGP | The most common: the customer advertises its networks with its own AS |
| OSPF or EIGRP in the VRF | When the customer already uses that protocol in its network |
In all three cases, the PE redistributes those routes into BGP under address-family ipv4 vrf and advertises them to the other PEs as VPNv4 routes.
The commands in Cisco IOS XE
| Command | What it does or shows |
|---|---|
vrf definition CL · rd 64500:10 | Creates the VRF and gives it its RD. |
route-target export|import 64500:10 | Which RT it puts on the routes it advertises and which ones it imports. |
vrf forwarding CL (on the interface) | Puts the interface toward the CE in the VRF (it removes its IP: enter it again). |
address-family vpnv4 · neighbor … send-community extended | Enables VPNv4 with the other PE and sends the RTs. |
address-family ipv4 vrf CL | The customer's routes in BGP: redistribute, or the CEs' eBGP neighbors. |
show bgp vpnv4 unicast all [summary | labels] | VPNv4 routes by RD, the session and the VPN labels. |
show ip route vrf CL · show ip cef vrf CL | The VRF table and the two labels for each destination. |
show mpls forwarding-table vrf CL | The VPN labels this PE assigned. |
L3VPNs aren't in the CCNA v2.0 exam topics: they're one step further toward CCNP Enterprise, whose ENARSI exam (300-410) asks you to describe MPLS layer 3 VPNs, and toward CCNP Service Provider (SPCOR 350-501).
Frequently asked questions
Why are two labels needed?
The transport label takes the packet to the egress PE and the P routers swap it. The VPN label tells that PE which VRF the packet belongs to; without it, the PE would have to look up the IP in a table without knowing which customer it is.
What happens if two customers use 192.168.10.0/24?
Each one is in its VRF with its RD. In BGP they are different routes (RD1:192.168.10.0/24 and RD2:192.168.10.0/24) and each PE imports them into the right VRF according to the RT.
Do the RD and RT have to match?
No. It's customary to use the same value in simple topologies, but the RD only makes the route unique and the RT decides where it's imported.
Does P1 need BGP?
No. P1 only switches on the transport label, which it learns via LDP. That's why this design is called a BGP-free core.
Why does the Toronto route have distance 200?
Because it was learned via iBGP. eBGP routes have 20; iBGP routes, 200.
What you take away
- Each customer has its VRF: a separate routing table on the PE.
- The PEs exchange VPNv4 routes (RD + prefix) over MP-BGP, AFI 1 and SAFI 128.
- The RD makes the route unique; the RT decides which VRF imports it.
- In the core, the packet carries two labels: transport (LDP) on top and VPN (BGP) underneath.
- P routers only look at the transport label and don't know the customer routes.
- With PHP, the egress PE receives only the VPN label.
NEXT STEP
From the provider core to the Career Plan
L3VPNs are the providers' flagship service and appear in the CCNP Enterprise ENARSI exam. You'll see them in detail in The House of Routing master classes. We'll let you know when there's news.
Upcoming protocol lessons
Sources
- RFC 4364 · BGP/MPLS IP Virtual Private Networks (VPNs)
- RFC 4760 · Multiprotocol Extensions for BGP-4
- RFC 4360 · BGP Extended Communities Attribute
- RFC 8277 · Using BGP to Bind MPLS Labels to Address Prefixes
- RFC 3443 · Time To Live (TTL) Processing in MPLS Networks
- Cisco · MPLS: Layer 3 VPNs Configuration Guide, Cisco IOS XE
Lesson prepared with AI assistance and checked against the sources cited. The bytes of every packet are generated according to the standard and verified with an independent tool.