Multiprotocol Label Switching (MPLS)
ccnp-routing
Introduces MPLS label switching, LSR roles, LDP label distribution, the FIB, LIB, and LFIB tables, and penultimate hop popping.
- Routers usually make decisions based on destination IP addresses with exception of PBR.
- MPLS is a new paradigm in the way routers make forwarding decisions.
- With MPLS the routers no longer look at the destination IP address to make decisions. They are looking at MPLS label to determine what to do.
- Multiprotocol Label Switching
- Multiprotocol: MPLS is capable of transporting many L2 and L3 protocols. It sits between layer 2 and layer 3 header.
- MPLS header is 32 bits: (20-bit label value, 3-bit traffic class field, 1-bit bottom of stack flag, 8-bit TTL field)
- Labels (20 bits): Ultimately determine the destiny of a packet through an MPLS network.
- Label switching: packets are switched based on labels not IP addresses.
- Multiprotocol: MPLS is capable of transporting many L2 and L3 protocols. It sits between layer 2 and layer 3 header.
- Why MPLS?
- Unified network infrastructure
- Scalable and secure L3VPNs using a peer-to-peer model. Secure because all the customer routing information is completely separated from other customers because it is peer-to-peer model.
- BGP-free core: Only Provider Edge routers need to know about the customer’s IP, all other core routers make decisions based on labels.
- Traffic engineering capabilities (MPLS TE): MPLS fast reroute, bandwidth management, …
- WAN QoS requirements.
- MPLS VPN Applications:
- Setup point-to-point E1 leased line over MPLS VPN
- Private LAN Service
MPLS Terminology
- Label Switched Routers (LSR): A router that is running MPLS
- LSR can be an:
- ingress edge LSR: receives the regular IP packet then it pushes one or more labels onto the MPLS stack and forward the packet into the MPLS network
- intermediate LSR: purely label switching. receives the labeled packet and performs some operations (push, pop, or swap)
- egress edge LSR: the exiting end of the MPLS network. The opposite of ingress edge LSR
- Operations:
- push operation: adding a label or a stack of labels
- pop operation: removing a label
- swap operation: swapping a label value to another label
- LSR can be an:
- Label Switched Path: end to end path (tunnels)
- Forwarding Equivalency Class (FEC): group of packets that are forwarded the same way through the MPLS network.
- Same labels
- Same treatment
- FEC can theoretically be based on many different things: L3 destination prefix, QoS, L2 PVC, BGP next-hop, TE tunnel, link color, etc…
- Label Distribution Protocol (LDP): enables LSRs to exchange label binding information for supporting hop-by-hop forwarding. Before LDP became popular you might hear about TDP which was a Cisco proprietary protocol for exchanging labels.

MPLS Data Plane
- LSR uses the FIB to forward unlabeled IP packets
- LSR uses LFIB to forward labeled packets
- The FIB and LFIB databases are built by various control plane protocols
| IP Forwarding | MPLS Forwarding | |
|---|---|---|
| Control Plane Databases | RIB show ip route |
LIB show mpls ldp bindings |
| Data Plane Forwarding | FIB show ip cef |
LFIB show mpls forwarding-table |
MPLS Control Plane
- Step 1: Every LSR generates a unique local label for every connected, static, and IGP prefix.
- Step 2: Exchange prefix/label bindings with all LDP neighbors.
- Each LSR labels the packet it received then it tells the sender LSR about the label which it put on the packet.
- Once labels are exchanged, the MPLS data plane (LFIB) can be constructed.
- Only the best prefix/label binding from the LIB gets put into the LFIB.
- The best path is still chosen by the IGP.
- LDP hello messages list LDP RID (unlike OSPF it must be a valid IP address) and are multicast to 224.0.0.2 UDP 646 (The All Routers multicast group addresses all routers on the same network segment) to discover LDP neighbors.
- Once the neighbors are discovered, a TCP 646 session is opened between LDP routers to do label exchange. TCP session is between LDP RIDs. This is why they must be routable.
- Highest LDP RID initiates TCP session.
- Penultimate Hop Popping (PHP):
- LSR advertises a special label called implicit null (label value 3) for any prefixes that it needs to forward packets for using IP only (outside MPLS).
- The implicit null label tells the upstream neighbor to pop the outer most label before sending the packet as an efficiency mechanism.

ldp
| Ingress | Intermediate | Egress | |||
|---|---|---|---|---|---|
| Prefix | Next hop | Prefix | Next hop | Prefix | Next hop |
| Net X | Intermediate | Net X | Egress | Net X | Connected |
| Ingress RID 1.1.1.1 | Intermediate RID 2.2.2.2 | Egress RID 3.3.3.3 | ||||||
|---|---|---|---|---|---|---|---|---|
| Prefix | Label | Made by | Prefix | Label | Made by | Prefix | Label | Made by |
| Net X | 102 | Local | Net x | 203 | Local | Net x | 3 | Local |
| Net X | 203 | Intermediate | Net x | 102 | Ingress | Net x | 203 | Intermediate |
| Net x | 3 | Egress | ||||||
| Ingress RID 1.1.1.1 | Intermediate RID 2.2.2.2 | Egress RID 3.3.3.3 | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Prefix | Label | Swap with | Next Hop | Prefix | Label | Swap with | Next Hop | Prefix | Label | Swap with | Next Hop |
| Net x | 102 | 203 | Intermediate | Net x | 203 | 3 | Egress | Net x | 3 | Null | Connected |
MPLS ping and traceroute
ping
- Classic ping works fine in MPLS environment but has some challenges.
- Only verifies that the IP forwarding is working, but does not verify the LSP.
- If an end to end ping fails, it can be unclear where the exact problem is. (MPLS network?, IGP? Customer infrastructure?, firewall?)
- To solve these challenges, a special MPLS ping utility was developed.
- Can only be run on LSRs
- IP packet that is carried across the LSP is constructed so it can NOT be routed.
- If the LSP is broken, an error message is returned to the source router.
traceroute
- Traditional traceroute in an MPLS environment works differently than you might imagine.
- It suffers from the same problems as ping and is not efficient.