MPLS MASTERCLASS · CHAPTER 1

What MPLS is and how it switches

From destination-based IP routing to label switching: the foundation of the whole masterclass.

14 min readVideo: Day 1, part 1Level: intermediate

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.

What you will see
  1. How the masterclass is organized and what to know beforehand
  2. Why MPLS is “layer 2.5”: swap instead of a routing lookup
  3. The MPLS header field by field, and the MTU
  4. Impose, swap, dispose and penultimate hop popping
  5. 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.

DayDateMarathonVideosWhat you build
Day 12021-03-131st MPLS-L3VPN Marathon7An MPLS core with OSPF and LDP, iBGP and VPNv4 between the PEs, the VRF for Customer A, and route target troubleshooting
Day 22021-03-202nd MPLS-VPLS Marathon5Layer 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:

  1. CCNA: the networking basics.
  2. OSPF: internal routing for large networks.
  3. BGP: routing between autonomous systems.
  4. 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:

PlaneIPMPLS
ControlRIB (routing information base)LIB (label information base)
ForwardingFIB, built by CEFLFIB (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.

Today, the IP lookup is also done in hardware at line rate. The big advantage of MPLS is not lookup speed, but what it lets you build.

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:

FieldBitsWhat it is for
Label20The label value. Values 0 to 15 are reserved.
EXP / TC3Born as the “experimental” field; RFC 5462 renamed it Traffic Class. Used for QoS.
S1Bottom of stack: set to 1 only in the last label of the stack.
TTL8Time 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.

The MPLS header in an L3VPN frame An L3VPN frame in the MPLS core carries, in order: the Ethernet header with EtherType 0x8847, the outer transport label created by LDP, the inner VPN label advertised by MP-BGP, and the customer IPv4 packet. Each label is a 32-bit label stack entry defined in RFC 3032: a 20-bit label value, a 3-bit EXP or traffic class field for QoS, a 1-bit bottom of stack flag set only in the last label, and an 8-bit TTL. Each label adds 4 bytes, so an L3VPN packet is 8 bytes bigger. MPLS L3VPN FRAME · TWO LABELS ETHERNET L2 header EtherType 0x8847 OUTER LABEL transport · LDP 4 bytes · S=0 INNER LABEL VPN · MP-BGP 4 bytes · S=1 IPv4 PACKET customer IP header + data untouched by the core LABEL STACK ENTRY · 32 BITS (RFC 3032) Label 20 bits label value · 0–15 reserved EXP / TC 3 bits QoS (traffic class) S 1 bit bottom of stack TTL 8 bits time to live Each label adds 4 bytes: an L3VPN packet crosses the core 8 bytes bigger than the original IP packet.

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.

  1. Impose (push): the ingress router adds one or more labels.
  2. 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.
  3. Dispose (pop): a router removes the label.
Impose, swap, PHP and dispose along the lab path A packet goes from CE-A1 to CE-A2 through PE-1, P1, P2 and PE-2. CE-A1 sends a plain IP packet. PE-1, the ingress PE, imposes two labels: the VPN label 405 and the transport label 203. P1 swaps the transport label from 203 to 302. P2, the penultimate hop, pops the transport label, so the packet reaches PE-2 with only the VPN label. PE-2, the egress PE, uses the VPN label to find the VRF, disposes it and delivers a plain IP packet to CE-A2. Label values are examples taken from each router's label range. MPLS CORE · OSPF + LDP CE-A1 CE no MPLS PE-1 PE · LER ingress P1 P · LSR P2 P · LSR penultimate hop PE-2 PE · LER egress CE-A2 CE no MPLS IP 203 405 IP 302 405 IP 405 IP IP IMPOSE push VPN + transport SWAP 203 → 302 POP (PHP) removes transport DISPOSE VPN label → VRF orange transport label (LDP) blue VPN label (MP-BGP) green IP packet Example values: each router allocates labels from its own range (P1 200–299, P2 300–399, PE-2 400–499).

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

RoleAlso calledWhat it doesProtocols it speaks
PLSR, label switch routerProvider core router. Swaps labels.IGP and LDP. No BGP.
PELER, label edge routerProvider edge. Imposes and disposes of labels, and holds the customer VRFs.IGP, LDP, iBGP with VPNv4, and the protocol toward the CE.
CECustomer edgeCustomer 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:

  1. Discover neighbors: it sends hellos on the interfaces where it is enabled.
  2. Form LDP adjacencies: it sets up a session with each discovered neighbor.
  3. 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

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.

Navigate