Routing, chapter 18 of 36
MPLS and Segment Routing
On the backup path, two routers of AS64510 would forward our SYN without reading its destination address.
Suppose the exchange port of border1 goes dark at the moment the laptop sends its SYN. AS64500 falls back to the route it learned from its transit provider, and the SYN leaves border2 with TTL 60 for 203.0.113.129, a router of AS64510. That router looks up 192.0.2.80 once and writes four bytes in front of the IPv4 header.
03 F0 41 3B- the four bytes pe1 writes in front of the SYN's IPv4 header: label 16132, TTL 59
- 19.1%
- of 427,121 MPLS tunnels seen from CAIDA's Ark in 2025 hid their routers from traceroute
- 80 bytes
- what SRv6 with two SIDs adds to our 60-byte SYN, against 4 for one label
Push, swap, pop across AS64510
Our SYN's label stack on each link of the backup path from border2 to AS64505. Step from router to router, then switch between LDP and segment routing, penultimate hop popping on or off, and the uniform and short pipe TTL models.
Why forward on a label instead of an address?
RFC 3031, Section 2.1 splits a forwarding decision in two: sort packets into Forwarding Equivalence Classes, then map each class to a next hop. IP repeats the sorting at every router with a longest match. MPLS sorts once, at the ingress, and encodes the class as a short fixed-length label.
The idea arrived from several vendors in 1996 and 1997, with ATM underneath most of it. Providers paid for ATM in cells: a 44.736 Mbit/s DS3 carried 30.96 Mbit/s of IP (RFC 3439, Section 3.4). In AS64510 the interior routers carry only the IGP's routes, and pe2 looks up 192.0.2.80 itself.
What do the four extra bytes say?
Our four bytes 03 F0 41 3B split 20, 3, 1, and 8 bits in the layout of RFC 3032, Section 2.1: label 16132, Traffic Class 0, bottom-of-stack bit 1, TTL 59. Twenty bits give 1,048,576 values, and the first sixteen are reserved. Implicit NULL, value 3, may be distributed but never appears in the encapsulation.
The three bits after the label were Experimental Use in 2001, and RFC 5462 renamed them Traffic Class in 2009. The entry has no protocol field: the router that pops the last label must infer what lies underneath (RFC 3032, Section 2.2).
How do two routers agree on what a label means?
The receiver decides. The router downstream of a link binds a label to a FEC and tells its upstream neighbor, so a label means something only to the router that will receive it (RFC 3031, Section 3.4). For the FECs the IGP already knows, LDP carries those bindings over TCP port 646 (RFC 5036, Section 3.10.1).
LDP lags behind the IGP. When a link comes up, IS-IS may route across it before LDP has exchanged labels, and labeled traffic falls into a black hole. The fix changes no protocol: the IGP advertises the link with the maximum metric, 0xFFFFFE in IS-IS, until LDP is fully operational (RFC 5443, Section 2).
What happens to the TTL inside the tunnel?
RFC 3032, Section 2.4.3 copies the IP TTL into the label at the push and back at the last pop. In this uniform model the SYN leaves pe2 with TTL 56, as if AS64510 had routed it hop by hop (RFC 3443, Section 3.1). In the short pipe model it leaves with 58.
Only the uniform model lets traceroute see inside. p1 carries no BGP routes and has no route back to 198.51.100.77. It can copy the label stack onto its Time Exceeded, which travels to the end of the tunnel before it turns around (RFC 3032, Section 2.3.2). Linux drops the expired packet and sends nothing back [Linux2026].
What if the packet carried its own route?
RFC 3031 let a label stand for a route that signaling had installed in every router along it. Segment routing puts the route back into the packet and keeps per-flow state only at the ingress (RFC 8402, Section 1). Over MPLS a SID is a label, and a segment list is a label stack.
Each router sets aside a Segment Routing Global Block, and a global SID travels as an index into it (RFC 8660, Section 2.4). AS64510 uses 16000 to 23999 everywhere, and pe2's loopback carries index 132. That is the 16132 of our dump, the same on every router.
Can p1 repair a broken link before anyone else knows?
Break the link between p1 and p2 while our SYN carries 16132. p1 notices first, and on AS64510's ring it finds no loop-free alternate and no remote LFA: pe1 would hand the SYN straight back, and no PQ node exists.
TI-LFA encodes the post-convergence path as segments: the Node-SID of p4, then the Adjacency-SID from p4 over the thin link to p3 (RFC 9855, Section 5.3). p1 sends 16134 15133 16132, and nothing was signaled. For link protection on nine real topologies, a repair of at most one SID covered more than 99 percent of prefixes in eight networks (RFC 9855, Appendix B).
The book keeps asking
This chapter has 5,508 words and 10 questions. These 4 are answered only in the book and the audiobook.
- How did labels learn to take paths the IGP would not choose?
- How does one backbone carry many private networks?
- Why hash on a label that means nothing?
- What changes when the segments are IPv6 addresses?
Open the sources
- RFC 3031 Multiprotocol Label Switching Architecture
- RFC 3032 MPLS Label Stack Encoding
- RFC 5036 LDP Specification
- RFC 4364 BGP/MPLS IP Virtual Private Networks (VPNs)
- RFC 8402 Segment Routing Architecture
- RFC 8660 Segment Routing with the MPLS Data Plane
- RFC 8986 Segment Routing over IPv6 (SRv6) Network Programming
- RFC 9855 Topology Independent Fast Reroute Using Segment Routing
All 56 documents this chapter cites, each with a link to its publisher and a copy kept here.
