From point A to point B
Point A: you can route with OSPF and BGP. Each router looks at the destination IP, checks its table and decides. Point B: by the end of this chapter you will understand why an MPLS router switches on labels, what the impose, swap and dispose operations do, and what role the P, PE and CE routers play.
This chapter is free and opens the MPLS Masterclass. It goes with the first part of Day 1, where Jesús explains MPLS from scratch before touching the console.
- How the masterclass is organized and what to know beforehand
- Why MPLS is “layer 2.5”: swap instead of a routing lookup
- The MPLS header field by field, and the MTU
- Impose, swap, dispose and penultimate hop popping
- The P, PE and CE roles, and what LDP does
The MPLS Masterclass
The masterclass is two marathons that Jesús Espinoza recorded live in March 2021, with Cisco routers in GNS3. They were part of his preparation for the CCIE Enterprise Infrastructure. The goal: explain MPLS from the ground up and finish with working services.
| Day | Date | Marathon | Videos | What you build |
|---|---|---|---|---|
| Day 1 | 2021-03-13 | 1st MPLS-L3VPN Marathon | 7 | An MPLS core with OSPF and LDP, iBGP and VPNv4 between the PEs, the VRF for Customer A, and route target troubleshooting |
| Day 2 | 2021-03-20 | 2nd MPLS-VPLS Marathon | 5 | Layer 2 services over MPLS: VPLS, which emulates an Ethernet switch between sites with pseudowires between the PEs |
The suggested path
The class presentation proposes a four-stop path toward MPLS:
- CCNA: the networking basics.
- OSPF: internal routing for large networks.
- BGP: routing between autonomous systems.
- MPLS: brings it all together to transport data efficiently.
In the video, Jesús boils it down to three requirements: an IGP (OSPF or IS-IS), because LDP depends on it; intermediate BGP, because the route target is an extended community; and the MPLS concept itself.
And he adds a fourth: constant practice, block by block. “Wax on, wax off”, as in The Karate Kid.
Why MPLS: “layer 2.5”
In traditional routing, the router strips the layer 2 frame and finds an IP header. It looks up the destination IP in its RIB (routing information base): that is the control plane. The forwarding plane is what actually sends the packet. On Cisco devices it is CEF (Cisco Express Forwarding), with its precomputed table, the FIB.
MPLS changes what the router finds when it opens the frame. Behind the Ethernet header there is no IP header anymore: there is a label. The router looks up that label in its label table, takes the outgoing label and swaps. It does not do a routing lookup on the destination IP.
That is why MPLS is called “layer 2.5”. The label sits between layer 2 and layer 3. That layer does not exist in the OSI model.
The labels follow the path the IGP computed. In the class, Jesús explains it with numbers: a router receives the packet with label 100 and sends it with label 125, because its neighbor advertised 125 for that prefix. The neighbor repeats the operation with the label that the next router advertised to it.
Control plane and forwarding plane
The MPLS architecture separates the control plane, where decisions are made, from the forwarding plane, where packets are forwarded:
| Plane | IP | MPLS |
|---|---|---|
| Control | RIB (routing information base) | LIB (label information base) |
| Forwarding | FIB, built by CEF | LFIB (label forwarding information base) |
Underlay and overlay
The presentation uses two more words. The underlay is the physical network with its IGP: it gives basic IP connectivity between the provider routers. The overlay is the services that run on top, such as MPLS L3VPN and VPLS. Keeping them apart gives operational flexibility.
The presentation sums up the benefits in three: performance, scalability (thousands of VPNs on a shared infrastructure) and isolation between customers with VRFs and labels.
The MPLS header
The label travels in a short 4-byte (32-bit) header. It is inserted between the layer 2 header and the IP packet. RFC 3032 calls it a label stack entry and defines four fields:
| Field | Bits | What it is for |
|---|---|---|
| Label | 20 | The label value. Values 0 to 15 are reserved. |
| EXP / TC | 3 | Born as the “experimental” field; RFC 5462 renamed it Traffic Class. Used for QoS. |
| S | 1 | Bottom of stack: set to 1 only in the last label of the stack. |
| TTL | 8 | Time to live, as in IP: protects against loops. |
On Ethernet, an MPLS frame is marked with EtherType 0x8847. A packet can carry several stacked labels: that is the label stack. In an L3VPN, two of them travel.
An MPLS L3VPN frame carries two 32-bit labels between Ethernet and the IP packet. Diagram: The House of Routing.
Two labels in an L3VPN
- Transport label (outer label): created by LDP. It carries the packet from one PE to the other and changes at every hop.
- VPN label (inner label): advertised by MP-BGP with the VPNv4 address family. It tells the egress PE which VRF, that is, which customer, the packet belongs to. It does not change along the way.
With LDP alone, without a VPN, the frame carries a single label.
And the MTU
Each label adds 4 bytes. In an L3VPN that is 8 extra bytes on top of the IP packet. If the core uses the classic 1500-byte MTU, a 1500-byte IP packet no longer fits. The class recommendation is clear: enable jumbo frames across the whole core.
Impose, swap and dispose
The marathon slide defines MPLS in a few words: Multiprotocol Label Switching, routing based on labels, with three basic operations.
- Impose (push): the ingress router adds one or more labels.
- Swap: each core router replaces the incoming label with the outgoing one. RFC 3031 defines it this way: looking up the incoming label to determine the outgoing label.
- Dispose (pop): a router removes the label.
A packet from CE-A1 to CE-A2: impose on PE-1, swap on P1, pop on P2 and dispose on PE-2. Diagram: The House of Routing.
Follow the packet in figure 2. CE-A1 sends a normal IP packet. PE-1 imposes two labels: the VPN label, advertised by PE-2, and the transport label, advertised by P1. P1 swaps the transport label. The values are examples, taken from each router's range.
Penultimate hop popping
Look at P2. It is the penultimate hop before PE-2, and it removes the transport label before sending the packet. This is penultimate hop popping (PHP). PE-2 receives the packet with only the VPN label and does a single lookup: the VPN label tells it which VRF the packet goes to. Then it disposes of the label and delivers a clean IP packet to CE-A2.
How does P2 know it must remove the label? Because PE-2 asks it to. For its own prefixes, PE-2 advertises the reserved label 3, implicit null. That label never travels in a packet: it means “remove the label instead of swapping it”. In the Cisco forwarding table you will see this action as Pop Label.
And why is the final dispose done on the PE? Because the CE does not speak MPLS. If it received a labeled frame, it would not know what to do with it. The PE always delivers the plain IP packet to the customer.
The roles: P, PE and CE
| Role | Also called | What it does | Protocols it speaks |
|---|---|---|---|
| P | LSR, label switch router | Provider core router. Swaps labels. | IGP and LDP. No BGP. |
| PE | LER, label edge router | Provider edge. Imposes and disposes of labels, and holds the customer VRFs. | IGP, LDP, iBGP with VPNv4, and the protocol toward the CE. |
| CE | Customer edge | Customer router. Unaware that MPLS exists. | Whatever it agrees on with the provider: OSPF, EIGRP, eBGP, static routes… |
PEs are ingress or egress depending on the direction of traffic. The same router is ingress for what enters the core and egress for what leaves it. The role changes by itself, with no configuration.
In the class, Jesús puts it plainly: the PE does all the MPLS work and carries the heaviest load. The P only switches labels. The CE only hands over its routes; the provider carries them across its network to the other site.
LDP: the label distributor
LDP (Label Distribution Protocol) is not a routing protocol. The marathon slide gives it three functions:
- Discover neighbors: it sends hellos on the interfaces where it is enabled.
- Form LDP adjacencies: it sets up a session with each discovered neighbor.
- Advertise labels: it announces which label it assigned to each prefix.
LDP depends on the IGP
LDP assigns labels to prefixes that are already in the routing table. Cisco's guide to basic MPLS with OSPF explains it this way: an LFIB entry is created only when the label learned through LDP matches the IGP route in prefix, mask and next hop.
The consequence is direct. If the IGP fails, LDP fails. If you forgot a core interface in OSPF, that path will have no labels. Jesús says it with humor: LDP depends on the IGP “one million percent”. There is an IGP-LDP synchronization mechanism to avoid these incidents, but the foundation is always a healthy IGP.
Other ways to distribute labels
LDP is the de facto standard, but not the only option. BGP also distributes labels, as you will see with VPNv4, and RSVP does it for traffic engineering. Cisco's proprietary predecessor was TDP (Tag Distribution Protocol), which is no longer used.
In the Day 1 lab you will enable LDP on every core router. As a preview, this is the minimum you will see on an IOS router. The mpls ldp autoconfig command enables LDP on all OSPF interfaces in the given area, and it requires mpls ip in global mode:
! Preview of Day 1 lab: LDP on a core router (P1)
P1(config)# ip cef
P1(config)# mpls ip
P1(config)# mpls label protocol ldp
P1(config)# mpls label range 200 299
P1(config)# router ospf 1
P1(config-router)# mpls ldp autoconfig area 0
P1(config-router)# end
! Control plane (LIB) and forwarding plane (LFIB)
P1# show mpls ldp bindings
P1# show mpls forwarding-table
What MPLS is for
L3VPN and VPLS are just two of the many applications that run over MPLS. The marathon's use case slide lists four:
- Transparent tunnels: LDP builds label paths between the edge routers without configuring one tunnel per pair. Just like QinQ, VXLAN or GRE, but the tunnel comes from the labels.
- BGP free core: the P routers need neither BGP nor the full internet table. Only the PEs speak BGP. Jesús calls it “the star of MPLS”.
- L2 and L3 VPN: MPLS L3VPN is the providers' de facto standard for layer 3 VPNs, and VPLS carries layer 2 services.
- Traffic engineering: with RSVP, the provider decides where traffic goes, beyond the IGP shortest path.
The idea the class leaves you with: MPLS is not the same as L3VPN. It is a foundation for building tunnels, with or without a VPN.
Class videos
This chapter goes with the first video of Day 1. Jesús recorded it live on March 13, 2021: audio in Spanish, with subtitles in Spanish, English, French and Portuguese.
Recorded live; Spanish audio with Spanish, English, French and Portuguese subtitles. When you play it, the video loads from YouTube. Day 1 playlist on YouTube
Test what you learned
1. Why is MPLS called “layer 2.5”?
Answer. Because the label sits between the layer 2 header and the IP packet. The MPLS router switches on that label, with a swap, without a routing lookup on the destination IP.
2. A router receives a packet with label 203 and sends it with label 302. What operation did it perform, and who chose 302?
Answer. A swap. Label 302 was advertised through LDP by the next router on the path for that prefix; each router assigns its own labels.
3. Which label does the egress PE advertise so that the penultimate router removes the transport label?
Answer. Implicit null, the reserved value 3. It never travels in a packet: it tells the penultimate router to pop instead of swap.
4. How many bytes does MPLS L3VPN add to an IP packet, and what does the class recommend for the MTU?
Answer. 8 bytes: two 4-byte labels, the transport label and the VPN label. The recommendation is to enable jumbo frames across the whole core.
5. Does a P router need BGP in an MPLS L3VPN network?
Answer. No. The P router only needs the IGP and LDP to switch labels. This is the BGP free core paradigm: only the PEs speak BGP.
Key takeaways
- MPLS switches on labels: a swap instead of a routing lookup on the destination IP. The IGP still sets the path.
- Each label takes 32 bits: a 20-bit label, 3-bit EXP/TC, 1-bit S and 8-bit TTL.
- An L3VPN carries two labels: transport (LDP) and VPN (MP-BGP). That is 8 extra bytes: use jumbo frames in the core.
- Three operations: impose, swap and dispose. With PHP, the penultimate router removes the transport label.
- The P switches and does not speak BGP; the PE carries the MPLS workload; the CE does not know MPLS exists.
- LDP discovers neighbors, forms adjacencies and advertises labels, and it depends entirely on the IGP.
Official resources
- RFC 3031 · MPLS Architecturerfc-editor.org
- RFC 3032 · MPLS Label Stack Encodingrfc-editor.org
- RFC 5036 · LDP Specificationrfc-editor.org
- Cisco · Configuring Basic MPLS Using OSPFcisco.com
- Cisco · MPLS LDP Autoconfigurationcisco.com
Source and credits. Chapter written from the MPLS Masterclass that Jesús Espinoza recorded live in March 2021. Text drafted with AI assistance and reviewed; original diagrams by The House of Routing. Technical data and configuration were checked against official Cisco documentation and IETF RFCs.