A traditional IP core makes every router repeat the same work: parse the destination address, run a longest-prefix match, forward — and to do it, every core router must carry every route, including the full Internet table if that traffic transits the core. MPLS restructures the whole pipeline: classify the packet once, at the edge, into a forwarding equivalence class (FEC) — 'everything that will be forwarded the same way' — and attach a label. From there, the core routers never look at the IP header again; they look up the label in a small table, swap it for the next hop's label, and send the packet on. The path the labels trace is a label-switched path (LSP), and it is established by the control plane before any packet flies.
The honest history: MPLS was invented in the late 1990s to make forwarding faster, and hardware promptly made longest-match free, erasing that motive. MPLS thrived anyway, because the label is an indirection layer — and the things you can hide behind an indirection turned out to be the products carriers sell: VPNs whose customer routes the core never sees, traffic-engineered paths that ignore the IGP's opinion, and 50-millisecond reroute. BGP-free cores alone justify it: with labels switching transit traffic edge-to-edge, core routers carry the IGP and label tables — a few thousand entries — instead of a million BGP routes.
The label and the roles
A label is a 4-byte shim header between layer 2 and layer 3 (EtherType 0x8847): 20 bits of label value, 3 bits of traffic class for QoS, a bottom-of-stack bit, and an 8-bit TTL. Labels can stack — the outer label carries the packet across the core while inner labels mean things like 'this VPN' or 'this pseudowire'; the stack is the mechanism every MPLS service is built from.
- Ingress LER / PE — the edge router that classifies the packet into a FEC and pushes the first label.
- LSR / P — a core router that swaps labels; it needs no knowledge of what is inside.
- Egress LER — pops the remaining label and forwards natively; usually the penultimate router has already popped the outer label (PHP, covered in chapter three).
One packet, hop by hop
PE1 : IP 172.16.5.9 arrives → FEC = 172.16.0.0/16 via PE2 → push label 24007P1 : label 24007 in → swap to 24012 → out toward P2P2 : label 24012 in → pop (implicit-null from PE2) → plain IP to PE2PE2 : routes 172.16.5.9 natively to the customer
Notice what P1 and P2 never did: consult a routing table for 172.16.0.0/16. Whether that FEC is an Internet route, a VPN route or a TE tunnel is invisible — and irrelevant — to them.
Control plane vs data plane
Everything above describes the data plane. The control plane's job is agreeing on the labels: each router allocates a local label for each FEC and advertises 'send me label X for prefix Y' to its neighbours. Three protocols do this at different jobs — LDP follows the IGP for plain transport (next chapter), RSVP-TE signals engineered paths, and BGP itself carries service labels for VPNs. Segment routing, the modern simplification, dispenses with the distribution protocols and encodes labels in the IGP — but the data plane it drives is exactly the push-swap-pop machine of this chapter, which is why these fundamentals outlive any one control protocol.