MPLS

MPLS Operation

How Forwarding Equivalence Classes (FECs), labels, and Label Switched Paths (LSPs) work.

Introduction to MPLS Operation

Multi-Protocol Label Switching (MPLS) forwards packets using labels associated with a Forwarding Equivalence Class rather than requiring every transit node to perform a complete IP destination lookup. A Label Edge Router (LER) classifies the packet and adds a label, while core Label Switching Routers (LSRs) use label forwarding entries. Separating classification from transit forwarding simplifies the decisions made in the core and supports dedicated MPLS forwarding hardware. The egress LER removes labels according to the FEC entry and forwards the packet to the destination network.

MPLS combines packet classification and label-stack processing with a control plane that distributes FEC-to-label bindings. A packet's path from the ingress router to the egress router depends on its Forwarding Equivalence Class (FEC). The Label Distribution Protocol (LDP) can distribute label bindings, while Push, Swap, and Pop modify the stack during forwarding. LER and LSR describe roles in the path rather than a separate packet format.

Forwarding Equivalence Class (FEC)

Before a label is applied, the network assigns a packet to a group with a common forwarding treatment. In MPLS, this group is called a Forwarding Equivalence Class (FEC). Packets in the same FEC can receive the same label at the domain ingress and follow the same FEC binding, while local labels may change at subsequent routers. The class can also describe the next hop, outgoing interface, and any required traffic treatment.

An ingress router can assign many packets to one FEC when they share forwarding criteria. The usual criterion is a destination prefix, although an implementation can also use a required traffic treatment or another forwarding property. Subsequent forwarding entries then refer to the class of packets rather than to each individual address.

How is a FEC Determined?

The criteria for grouping packets into a FEC are flexible, but the most common method uses the destination IP network prefix. The ingress router obtains this association from its routing table.

FEC Classification Example

An Ingress LER receives three packets:

  • Packet 1: Destination 198.51.100.50198.51.100.50
  • Packet 2: Destination 203.0.113.10203.0.113.10
  • Packet 3: Destination 198.51.100.99198.51.100.99

The router's routing table (learned via BGP or an IGP) indicates that the network 198.51.100.0/24198.51.100.0/24 is reachable via one path, and the network 203.0.113.0/24203.0.113.0/24 is reachable via another. The router will therefore classify them as follows:

  • Packets 1 and 3 are both destined for the 198.51.100.0/24198.51.100.0/24 network. They are grouped into FEC-A.
  • Packet 2 is destined for the 203.0.113.0/24203.0.113.0/24 network. It is grouped into FEC-B.

Along the rest of the LSP, core routers can use the label-to-FEC binding without repeating a full IP prefix lookup. The ingress router still makes the Layer 3 classification, and the egress router can perform the final IP lookup before delivering the packet to the destination network.

MPLS Label Stack Entry

Once a packet is classified into a FEC, the router can add an MPLS stack entry. One entry is 32 bits (4 bytes) and, when Ethernet encapsulation is used, it is placed between the Layer 2 header and the Layer 3 header. A stack can contain several entries when a transport label and a service label are needed together. The top entry is processed first, and the S bit identifies where the stack ends.

Fields in an MPLS Stack Entry

A 32-bit MPLS stack entry contains four fields:

FieldSize (bits)Description
Label Value20The identifier used to select a forwarding entry. The 20-bit field provides 2^20 values, with values reserved by the standard excluded from general assignment.
Traffic Class (TC, formerly EXP)3Carries a traffic-class marking used by mechanisms such as QoS.
Bottom of Stack (S)1Marks the end of the label stack. A value of 1 appears in the last stack entry, such as below a transport label in an MPLS VPN packet.
Time-To-Live (TTL)8A field used to limit packet lifetime. The way TTL is set and decremented depends on the TTL processing model; in the uniform model, its value is propagated between headers and reduced at successive nodes. A packet is discarded when the processed value reaches zero.

Local significance:A label value is interpreted within a router's local label space. Label 100 might mean "send to Router B" on the A-to-B segment, while the same value 100 on the B-to-C segment can have a different meaning or remain unused. Each LSR installs its own binding between an incoming and an outgoing label according to the information distributed for the FEC.

LDP Label Distribution and LSPs

Mappings between FECs and labels are distributed by the Label Distribution Protocol (LDP). MPLS routers exchange information about labels they can use for specific FECs. LDP discovers neighbors with Hello messages and maintains the router session over TCP. In the usual LDP case, the next hops come from the IGP, and these mappings form a Label Switched Path (LSP).

LDP distributes FEC-to-label mappings between neighboring LSRs. A router near the destination can advertise a label for an FEC, while an upstream router selects its own label and advertises a corresponding mapping toward the ingress. Each LSP segment therefore receives a local forwarding entry, and its operation can be Swap or Pop.

LDP Label Distribution Example

This example shows mappings distributed from the router serving the destination FEC toward the ingress router. The timing and distribution mode depend on the LDP configuration.

  1. Egress LER starts: The Egress LER, directly connected to the destination network for the FEC, recognizes it from its routing table. At the end of the LSP it can perform the IP lookup and deliver the packet. It advertises an implicit-null binding with label value 3 to its neighbor, P2, allowing the preceding hop to remove the label.
  2. P2 creates an entry: Router P2 receives the Egress LER advertisement and learns that the FEC is reachable. In this example it selects local label 300 for traffic arriving from P1. Its forwarding entry removes label 300 according to the implicit-null advertisement and forwards the packet to the Egress LER. It then advertises the mapping (FEC, label 300) to P1.
  3. P1 creates an entry: Router P1 receives the mapping from P2 and knows the next hop to the FEC. It selects its own local label, say Label 200. Its table states that an incoming label 200 is swapped for label 300 and forwarded to P2. P1 advertises its mapping (FEC, label 200) to its neighbor, the Ingress LER.
  4. Ingress LER is ready: The Ingress LER receives the mapping from P1. It now has a label for packets in this FEC and installs a rule to push label 200 onto such a packet before forwarding it to P1.

After these mappings are installed, the LSP has forwarding entries from the Ingress LER to the Egress LER. Each router on the path knows which operation to apply to a packet in the FEC, and the domain can forward it using labels.

Core MPLS Forwarding Operations

MPLS packet forwarding is based on three core operations:

PUSH

Adding a label or a label stack to a packet. This is usually performed by the Ingress LER.

SWAP

Replacing the label at the top of the stack with an outgoing label. This is often performed by core LSRs.

POP

Removing the label at the top of the stack. This can be performed by the Egress LER or by the preceding router as part of PHP.

Packet Traversal of the LSP

The following example shows the packet path from the earlier example through the established LSP:

  1. At the Ingress LER: An IP packet arrives destined for the FEC. The router performs an IP lookup, classifies it, and sees that it needs to use Label 200 and forward to P1. It performs a PUSH operation, adding the MPLS header with label 200.
  2. At Router P1: The packet arrives with label 200. P1 doesn't look at the IP header. It looks only at the label. Its forwarding table says: "Incoming label 200 means outgoing label 300, forward to P2." It performs a SWAP operation, replacing label 200 with 300.
  3. At Router P2: The packet arrives with label 300. P2 looks at its table: "Incoming label 300 means pop the label and forward to Egress LER." It performs a POP operation, removing the MPLS header entirely. (This is an optimization called Penultimate Hop Popping, where the final swap-and-pop is done one hop early).
  4. At the Egress LER: A plain IP packet arrives. The Egress LER performs a final IP lookup and delivers the packet to its ultimate destination network. The packet has successfully crossed the entire MPLS domain without any of the core routers ever looking at its IP header.

Related articles