Sub topic 7
MPLS Layer 3 VPNs: how a provider carries many customers
This chapter assumes you can read basic Cisco IOS configuration. You should also know how labels are pushed, swapped, and popped, and have a conceptual grasp of BGP. The next chapter covers VRFs, route distinguishers, and route targets in detail. Here we concentrate on the overall design and how a packet crosses it.
The problem a Layer 3 VPN solves
A provider with thousands of customers cannot build a separate network for each one. Customers also pick their own addresses, and many of them use the same private ranges, such as 192.168.1.0/24 or 10.0.0.0/8. The provider's shared core must carry all of this traffic without mixing it up and without learning every customer route on every core router.
An MPLS Layer 3 VPN (L3VPN) does this with a peer model. The customer's router exchanges IP routes with the provider's router. The provider keeps each customer's routes in a separate routing table and carries the traffic across the core as labeled packets. The customer sees the provider as a routed next hop, not as a set of point-to-point circuits.
The three router roles
| Role | Where it sits | What it knows |
|---|---|---|
| CE (customer edge) | At the customer site | Only the customer's own routes. It needs no MPLS. |
| PE (provider edge) | At the edge of the provider network, facing the CE | The customer routes for the VPNs it serves (one table per VPN), plus the provider's core routes. |
| P (provider core) | Inside the provider network | Only core routes and labels. It holds no customer routes. |
Because P routers hold no customer routes, the core scales with the size of the provider network. It does not scale with the number of customers or customer prefixes. Only PE routers carry customer state.
The control plane in four steps
Before any data flows, routes have to spread between sites.
- The CE advertises its site prefixes to the PE. The PE-CE protocol can be static routes, OSPF, EIGRP, or eBGP.
- The PE installs those prefixes in a VRF (virtual routing and forwarding instance). The VRF is the customer's private routing table on the PE, and the customer-facing interface is assigned to it.
- The PE turns each route into a VPNv4 route. It prepends a route distinguisher (RD) to the prefix so that overlapping customer prefixes stay unique. It attaches a route target (RT) extended community that says which VPNs may import the route. It also attaches a VPN label. It then sends the route to the other PEs over MP-BGP, usually via a route reflector.
- A remote PE imports the route into every VRF whose import RT matches. It then advertises the prefix to its own CE.
Separately, the provider core runs an IGP (such as OSPF or IS-IS) plus LDP. This gives every PE loopback address a label-switched path (LSP) to every other PE. The VPN routes ride in BGP, and the core only has to reach the BGP next hop, which is the remote PE's loopback.
The two-label stack
The data plane uses two labels at once:
- The outer label, or transport label, is distributed by LDP. It carries the packet across the core to the egress PE. P routers look only at this label.
- The inner label, or VPN label, is distributed by MP-BGP. It tells the egress PE which VRF or outgoing interface the packet belongs to. Core routers never read it.
Two customers can use the same prefix because the VPN label and the VRF keep their traffic apart at the edge. The core never sees the overlap.
Tracing one packet
Customer A has site 1 (192.168.1.0/24) and site 2 (192.168.2.0/24). Host 192.168.1.10 pings 192.168.2.10. PE2's loopback is 10.255.255.2, and PE2 told PE1 in a VPNv4 update that VPN label 30 leads to Customer A's site 2.
| Hop | Action | Packet on the wire |
|---|---|---|
| CE1 | Forwards by its default or static route toward PE1. | IP |
| PE1 | Looks up 192.168.2.10 in VRF CUST_A. The next hop is 10.255.255.2 with VPN label 30. LDP says to reach 10.255.255.2 use outer label 17. PE1 pushes both. | 17 / 30 / IP |
| P1 | Swaps outer label 17 for 22. | 22 / 30 / IP |
| P2 | Is the penultimate hop for PE2's loopback, so it pops the outer label (penultimate hop popping). | 30 / IP |
| PE2 | Reads label 30, finds the CUST_A VRF and the outgoing interface, pops the label. | IP |
| CE2 | Receives an ordinary IP packet. | IP |
If Customer B also uses 192.168.2.0/24, PE2 holds a different VPN label for it. The same destination address leads to a different VRF, and the traffic stays separate.
Configuring the PE-CE edge
The VRF and MP-BGP configuration on PE1 is the same as the example in the next chapter. Here is the other end. PE2 runs eBGP to its CE, and it uses as-override because both sites use AS 65010:
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.20.1 255.255.255.252
no shutdown
!
router bgp 65000
address-family ipv4 vrf CUST_A
neighbor 192.168.20.2 remote-as 65010
neighbor 192.168.20.2 activate
neighbor 192.168.20.2 as-override
exit-address-familyWithout as-override, the CE at site 2 would see its own AS number (65010) in the AS path of routes from site 1. BGP loop prevention would drop those routes. The alternative is allowas-in on the CE.
Verifying and troubleshooting
Always check each stage in order: PE-CE routing, VPNv4 exchange, core labels, then the forwarding table.
show ip route vrf CUST_A
show bgp vpnv4 unicast all summary
show bgp vpnv4 unicast vrf CUST_A 192.168.2.0
show mpls ldp neighbor
show mpls forwarding-table
show ip cef vrf CUST_A 192.168.2.0 detail
ping vrf CUST_A 192.168.2.1A plain ping from the PE uses the global routing table. Use ping vrf CUST_A or the test will say nothing about the customer's path.
| Symptom | Likely cause |
|---|---|
| Remote routes never appear in the VRF | The RT export on one PE does not match the RT import on the other. |
| VPNv4 neighbor is up but receives no routes | `send-community extended` is missing, so the RTs are stripped. |
| VPNv4 routes arrive but traffic is dropped | The core has no label path to the remote PE loopback, for example `mpls ip` is missing on a core link, or LDP is not advertising the loopback. |
| BGP session between PEs flaps or will not form | The session is not sourced from the loopback, or the loopback is not in the IGP. |
| Routes from another site of the same customer are rejected | Both sites use the same AS number and nothing overrides loop prevention. |
| Large packets fail but small ones work | Two labels add 8 bytes, which pushes full-size frames past the core MTU. |
Limits to keep in mind
- The provider is part of the customer's routing. A misconfigured RT can leak routes between customers, and the customer cannot see it.
- Customers depend on the provider's choice of PE-CE protocols, route limits, and service classes.
- Reaching sites that have no MPLS service, such as small branches, usually needs an internet VPN. This gap is one reason hybrid WANs exist, and a later chapter covers it.
Exercise
PE1 has a VPNv4 route for 192.168.2.0/24 with VPN label 30 and next hop 10.255.255.2. The core has two P routers between PE1 and PE2. Which labels does PE1 push, which label does the first P router read, and why does that P router not need a route to 192.168.2.0/24?
Show answer
PE1 pushes two labels. The outer label is the LDP label for the path to 10.255.255.2, and the inner label is VPN label 30. The first P router reads only the outer label and swaps it for the next one. It forwards on the label alone, never looking at the IP header or the VPN label, so it needs no customer routes. Only the PEs hold customer prefixes, in their VRFs.
Exercise
Two customers both use 192.168.1.0/24. How does the provider core keep their traffic apart, and which component makes the two prefixes distinct inside BGP?
Show answer
Each customer's routes live in a separate VRF on the PE. The route distinguisher (RD) is prepended to each prefix, which makes the VPNv4 routes unique in MP-BGP. At forwarding time, each route has its own VPN label, so the egress PE delivers each packet to the correct VRF.