Multi-Protocol Label Switching (MPLS) is an advanced packet-forwarding technique used in modern networks. Instead of making routers look into complex Layer 3 routing tables for every IP packet, MPLS uses labels for forwarding decisions. These labels create pre-defined, efficient paths across the network, which enhances speed, scalability and traffic management.
Note: MPLS lies between Layer 2 (Data Link) and Layer 3 (Network Layer) of the OSI model, which is why it is often referred to as a Layer 2.5 protocol.
Why MPLS
Traditional IP routing involves a long lookup process in routing tables.
MPLS simplifies forwarding by assigning a short fixed-length label to each packet.
This ensures: Faster packet delivery, better support for Quality of Service (QoS) & easier traffic engineering and Virtual Private Networks (VPNs).
MPLS Header
The MPLS header is 32 bits long and is inserted between the Layer 2 and Layer 3 headers. It contains the following fields:
Identifier used to make forwarding decisions (range: 0 to 2²⁰ – 1).
Experimental (Exp)
3 bits
Used for Quality of Service (QoS) and traffic prioritization.
Bottom of Stack (S)
1 bit
Indicates whether this label is the last in the stack (1 = last label).
Time to Live (TTL)
8 bits
Prevents loops; decrements by 1 at every hop.
Note: Multiple labels can be stacked to form a label stack, enabling hierarchical routing.
Key Terminologies in MPLS
Provider Edge (PE) Router: Router at the edge of the MPLS provider’s network; adds/removes labels from packets.
Customer Edge (CE) Router: Router at the customer’s network edge that communicates with PE routers.
Label Switch Router (LSR): Router inside the MPLS core that understands and processes labels.
Ingress LSR: First router that receives the packet from CE and pushes (adds) the MPLS header.
Intermediate LSR: Routers that swap labels as packets move across the MPLS path.
Egress LSR: The last router in the MPLS domain that pops (removes) the MPLS header before sending the packet to the CE.
Push, Pop, Swap: Push -> Add a label, Pop -> Remove a label. & Swap -> Replace an existing label with a new one.
Working of MPLS (Forwarding Process)
Ingress Stage (Push): CE sends an IP packet to the PE (Ingress LSR). Ingress PE assigns a label based on the destination and attaches an MPLS header.
Core Stage (Swap): Intermediate LSRs forward the packet based only on the label. They swap the label with a new one as defined in their Label Forwarding Information Base (LFIB).
Egress Stage (Pop): The Egress PE removes the MPLS header and forwards the original IP packet to the CE router.
Note: Labels are distributed using the Label Distribution Protocol (LDP).
MPLS and VPN
MPLS can separate traffic of different customers similar to VPNs.
Unlike regular VPNs, MPLS does not encrypt data.
Instead, it ensures traffic isolation by keeping each customer’s traffic within its label-switched path (LSP).