MPLS doesn’t actually route packets; it swaps labels on them.

Let’s watch an MPLS packet travel. Imagine a router, say R1, receives a packet destined for 192.168.1.5. Normally, R1 would look at the IP header, do a longest-match lookup in its IP routing table, and forward the packet out the correct interface. But if R1 is an MPLS Label Edge Router (LER), it might do something different.

First, R1 checks if it knows how to get to 192.168.1.5 via IP. It finds an entry, let’s say the next hop is R2 and the outgoing interface is GigabitEthernet0/1. Now, instead of just sending the IP packet to R2, R1 looks up the label associated with the route to 192.168.1.5 via GigabitEthernet0/1. Let’s say this label is 20. R1 then pushes this label onto the packet. The packet now has an MPLS header with label 20 between the IP header and the Layer 2 header.

The packet arrives at R2, which is an MPLS Label Switching Router (LSR). R2 doesn’t look at the IP header. It only looks at the topmost label in the MPLS header, which is 20. R2 consults its Label Information Base (LIB) for label 20. It finds that label 20 incoming on its GigabitEthernet0/0 interface is mapped to outgoing label 35 on its GigabitEthernet0/2 interface, destined for R3. R2 then swaps label 20 for label 35.

The packet, now with label 35, arrives at R3, another LSR. R3 looks at label 35. It consults its LIB and finds that label 35 incoming on GigabitEthernet0/1 is mapped to label expulsion (or popping) for outgoing interface GigabitEthernet0/3, which is the egress LER. R3 pops the label.

The packet, now stripped of its MPLS header, arrives at R4 (the egress LER). R4 looks at the IP header, performs a standard IP lookup for 192.168.1.5, and forwards it to the final destination.

This sequence of label pushes, swaps, and pops defines a Label-Switched Path (LSP). An LSP is a pre-determined, unidirectional path through an MPLS network that packets with a specific label will follow. It’s like a virtual circuit. The core idea is that the intermediate LSRs (like R2 and R3) only need to look at the label, not the entire IP header, making forwarding decisions much faster.

The system that establishes these LSPs is typically the Label Distribution Protocol (LDP), or sometimes Resource Reservation Protocol (RSVP) for more advanced features like traffic engineering. LDP allows routers to exchange label mappings for IP routes. When R1 decides to push label 20 for the route to 192.168.1.5 towards R2, it’s essentially telling R2 "if you receive a packet with label 20 from me, I want you to forward it towards R3 and expect label 35 back." R2 then advertises its label mapping for that route back to R1. This process builds the LSP hop-by-hop.

The surprising thing is how much of the traditional IP routing intelligence is bypassed in the core of an MPLS network. The LSRs are essentially just high-speed label-forwarding engines. They don’t participate in the full IP routing process for packets traversing their LSPs; they only care about the label. This separation of control plane (IP routing, LDP) and data plane (label switching) is key to MPLS performance.

The configuration on an LSR involves enabling MPLS on interfaces and ensuring LDP (or RSVP) is running and configured to negotiate labels. For example, on Cisco IOS:

interface GigabitEthernet0/1
 ip address 10.0.0.1 255.255.255.0
 mpls ip
!
interface GigabitEthernet0/2
 ip address 10.0.0.5 255.255.255.0
 mpls ip
!
router ldp
 log-neighbor-changes
!

This mpls ip command on an interface enables MPLS processing, and the router ldp section ensures LDP sessions are established with neighbors to exchange label mappings.

The next concept you’ll encounter is how these LSPs are used for more than just basic IP forwarding, particularly for traffic engineering and VPNs.

Want structured learning?

Take the full Computer Networking course →