Computer Networking › Section F · The link layer and LANs › Topic F.5
Link virtualization: MPLS
To the network layer, a link is just a pipe between two routers, but the pipe can itself be a whole network. Multiprotocol Label Switching is the best-known example: a network of label-switching routers that presents itself to IP as a set of links.
A network that pretends to be a link
IP treats the link layer as a service that carries a datagram from one router to the next. Nothing says the link layer must be a single cable. Dial-up telephone connections once carried IP between routers, and operators have long run switched networks of their own, such as ATM, underneath IP. The routers above see only a point-to-point pipe, while below it a whole network may be doing the work. That is link virtualization: a network acting as a link layer. Multiprotocol Label Switching (MPLS) is the version that internet service providers and large enterprises use inside their backbones, mostly invisible to ordinary users.
Why switch on labels?
MPLS began in the late 1990s as a way to forward packets faster. A normal router looks up a destination address by longest prefix match, while an MPLS router looks at a short fixed-length label, borrowing the idea of virtual circuits. Hardware later made IP lookups fast too, so the lasting value of MPLS lies elsewhere. Operators can send traffic along paths that routing would not choose, divert it quickly when a link fails, and keep many customers' private networks apart on one shared backbone. The architecture is in RFC 3031.
The MPLS header
An MPLS packet carries a 32-bit header, called a shim, between the link-layer header and the IP header, which is why MPLS is sometimes described as layer 2.5. On Ethernet the frame's type field is 0x8847 to signal it. The 32 bits are a 20-bit label, a 3-bit traffic class, a 1-bit bottom-of-stack flag and an 8-bit time-to-live. Twenty bits allow 1,048,576 labels, of which 0 to 15 are reserved (RFC 3032). Labels can be stacked, one shim on top of another, and the bottom-of-stack bit marks the last. Only the top label is examined.
Label-switched paths
Routers at the edge of an MPLS network are label edge routers. The ingress router classifies a packet, for example by destination prefix, pushes a label and sends it on. Routers in the middle, label-switching routers, never read the IP header. Each looks up the incoming label in a small table, swaps it for an outgoing label and forwards it out of the listed interface. Labels have only local meaning on a link, like virtual-circuit numbers. The chain of hops is a label-switched path (LSP). The router before the last usually removes the label (penultimate hop popping), so the egress router does a plain IP lookup.
Worked example: following one packet
Routers A, B, C and D form an LSP to the prefix 198.51.100.0/24 behind D. 1. A, the ingress, finds that the prefix matches its entry, pushes label 17 and sends the packet to B. 2. B has the entry in-label 17, out-label 22, next hop C. It swaps the label and forwards without opening the IP header. 3. C has the entry in-label 22, pop, next hop D, because D asked for the label to be removed one hop early. C sends a plain IP packet. 4. D looks up the destination address by prefix and delivers it. 5. The only IP lookups happen at A and D, and B and C do an exact match on a small table.
How labels get set up
Labels are agreed before any data flows. The Label Distribution Protocol builds LSPs that follow the routes the interior routing protocol has already chosen, as in the topic Intra-AS routing: OSPF. For control over the route, operators use RSVP-TE, which sets up an explicit path and can reserve bandwidth along it. Newer designs such as segment routing carry the path as a list of labels in the packet itself. In all cases the routing and signalling decide the path first, and then labels make forwarding along it simple.
Worked example: traffic engineering
Every link in a network carries 10 Gbit/s. Two flows of 6 Gbit/s each travel from A to D. Route A-B-D has cost 2 and route A-E-F-D has cost 3. 1. Plain shortest-path routing puts both flows on A-B-D, because they share a destination. 2. The offered load on each link of that route is 12 Gbit/s, so utilisation is \(12/10 = 120\%\). 3. At most 10 Gbit/s fits, so about \(2/12 \approx 17\%\) of the traffic is queued or dropped, while A-E-F-D sits idle. 4. With MPLS traffic engineering, one LSP follows A-B-D and the other A-E-F-D. Each link then runs at \(6/10 = 60\%\), at the cost of one extra hop for the second flow.
Stacked labels and VPNs
A provider can run many customers' private networks over one backbone by stacking two labels. The outer label steers the packet across the backbone along an LSP, and the inner label tells the egress router which customer's network the packet belongs to, so customers can reuse the same private address ranges without clashing. Each label costs 4 bytes. With two labels the shim adds 8 bytes, so on a link whose payload limit is 1,500 bytes the largest IP packet falls to 1,492 bytes, unless the operator raises the link's limit.
Common mistakes to avoid
First, thinking MPLS replaces IP: the packets inside are still IP, and the labels only guide them across one provider's network. Second, treating labels as global; each is meaningful only on one link and is swapped hop by hop. Third, believing MPLS exists mainly to make forwarding faster, which is no longer the main reason. Fourth, forgetting the shim overhead when counting packet sizes. Fifth, assuming MPLS routes are chosen by the labels themselves, when routing and signalling protocols choose the path.
Key takeaways
Link virtualization lets a whole network serve as a link layer for IP. MPLS inserts a 32-bit shim between the link-layer and IP headers, holding a 20-bit label, traffic class, bottom-of-stack bit and TTL. Edge routers push and pop labels, core routers swap them using exact-match tables, and the route taken is a label-switched path. Operators use MPLS for traffic engineering, fast rerouting and VPNs, with stacked labels at 4 bytes each.
Flashcards
Flashcard
A whole network acting as a link layer for IP
Test your understanding
Question 1 of 5
A core label-switching router receives an MPLS packet. What does it do?
Question 2 of 5
A label in the MPLS shim is 20 bits long. How many distinct label values can it represent?
Question 3 of 5
A VPN packet carries two MPLS labels over an Ethernet link whose payload limit is 1,500 bytes. What is the largest IP packet that fits?
Question 4 of 5
Where does the MPLS header sit in a frame?
Question 5 of 5
Two flows of 6 Gbit/s go to one destination over 10 Gbit/s links, and routing puts both on one path. How does MPLS traffic engineering help?
