§6.5Link Virtualization · Multiprotocol Label Switching

Link layer Kurose & Ross pp. 501–505 · ~13 min read

  • multiprotocol label switching
  • label-switched router
  • traffic engineering
  • virtual circuit

Where you are

  • Application layer
  • Transport layer
  • Network layer
  • Link layer you are here
  • Physical layer

MPLS puts a short fixed-length label in front of the IP (Internet Protocol) header, so that routers can forward on the label instead of the address. More usefully, it lets an operator send traffic down a path IP routing would never choose.

Words you will meet

  • MPLS (Multiprotocol Label Switching) — a small header between the link-layer and IP headers, carrying a label.

  • Label-switched router — a router that forwards on that label.

  • Virtual circuit — the older idea MPLS borrows the fixed-length label from.

  • Traffic engineering — overriding normal IP routing on purpose.

  • Virtual private network — joining a customer’s sites across a provider, kept apart from everyone else’s.

Why this matters

Chapter 5 built routing protocols that compute one least-cost path to each destination. That is usually what you want, and sometimes it is exactly what you do not.

An operator may need some traffic for a destination to take one route and the rest to take another. It might be for policy, for performance, or to keep a customer’s traffic separate. IP routing offers no way to say that.

MPLS does. It is also the chapter’s third example of the same trick, after switched Ethernet and cable: a whole network, standing in as one link.

A label in front of the IP header

MPLS came out of industry work in the mid-to-late 1990s to speed up IP forwarding, by borrowing one idea from virtual-circuit networks: a fixed-length label.

The goal was never to replace destination-based IP forwarding. It was to augment it — label some datagrams selectively, and let routers forward on the label when they can. It works hand in hand with IP, using IP addressing and IP routing underneath.

Figure 6.28 — where the MPLS header sits

Click any box to read what that part of the message is for.

Every field, as text

    Between the link-layer header and the IP header — which is exactly why both ends of the link have to understand it. Click any field.

    In plain words

    Look at where the header sits: between the Ethernet header and the IP header.

    That position has a consequence the book states immediately. A router that does not speak MPLS would find an MPLS header exactly where it expected the IP header, and be, in the book’s word, “quite confused”. So an MPLS frame can only travel between two routers that both understand it.

    A label-switched router forwards by looking the label up and passing the datagram straight to an output interface. It never extracts the destination IP address, and never performs a longest-prefix match.

    An island of MPLS routers

    Figure 6.29 — an MPLS island between ordinary IP routers
    3 hops: R4 · MPLS → R3 · MPLS → R1 · MPLS → A
    R4 if 0R4 if 1R3 if 0R3 if 1R2 if 0R1 if 0R6 · plain IPR5 · plain IPR4 · MPLSR3 · MPLSR2 · MPLSR1 · MPLSDA

    Drag any device to rearrange the picture. Hover a link to see its rate, delay and length.

    R1 to R4 are MPLS capable; R5 and R6 are ordinary IP routers. Switch between the two journeys: R4 has two labelled paths to the same destination A, which is the whole point of the section.

    Read this diagram as text
    • R6 · plain IP wired link R4 · MPLS
    • R5 · plain IP wired link R4 · MPLS
    • R4 · MPLS wired link R3 · MPLS
    • R4 · MPLS wired link R2 · MPLS
    • R3 · MPLS wired link D
    • R3 · MPLS wired link R1 · MPLS
    • R2 · MPLS wired link R1 · MPLS
    • R1 · MPLS wired link A

    R1 through R4 speak MPLS. R5 and R6 are ordinary IP routers. The labels were handed out backwards, each router telling its upstream neighbour what to send:

    • R1 told R2 and R3 that a frame with label 6 will be forwarded to A.
    • R3 told R4 that labels 10 and 12 reach A and D.
    • R2 told R4 that label 8 reaches A.
    The four forwarding tables of Figure 6.29
    Routerin labelout labeldestout interface
    R2 told R4 that label 8 reaches A. It swaps 8 for the 6 that R1 asked for.
    R3 told R4 that label 10 reaches A. It swaps 10 for 6 as well — R1 asked both its neighbours for the same label.
    And here is the second route to A — same destination, different interface, different label. IP routing would have given only one.

    Cells marked ⓘ have an explanation — click to read it.

    Read them right to left, the way they were built. R1 advertised first, and each router upstream learned a label from its neighbour. Click a row.

    Two rows repay attention.

    R1’s out label is a dash. The label is removed before delivery, because A is an ordinary IP device. And R4’s in-label column is blank, because datagrams from R5 and R6 arrive with no label at all. R4 is the edge: it pushes the first label, and R1 pops the last one.

    One datagram from R5 to A
    It arrives at R4 with no labelstep 1 of 4
    EthernetIP headerno MPLS header — R5 does not speak MPLS

    R5 is an ordinary IP router, so what reaches R4 is an ordinary IP datagram. This is the edge of the MPLS island, and R4 is where a label first goes on.

    Push at the edge, swap in the middle, pop at the far edge. The IP header goes in one end and comes out the other having been read by nobody in between.

    Read all steps as text
    1. It arrives at R4 with no labelR5 is an ordinary IP router, so what reaches R4 is an ordinary IP datagram. This is the edge of the MPLS island, and R4 is where a label first goes on.
    2. R4 pushes a label and picks a pathR4 chooses. Interface 0 with label 10 goes the upper way through R3; interface 1 with label 8 goes the lower way through R2. Both reach A. An IP router would have had only one least-cost choice.
    3. R3 swaps 10 for 6R3 looks up 10, finds the row for A, writes 6 in its place and sends it out of interface 1. One table lookup on a short fixed-length label — no longest-prefix match, no IP address extracted.
    4. R1 pops the label and deliversR1’s row for A has a dash in the out-label column. The MPLS header is removed and an ordinary IP datagram is delivered — because A would be quite confused to find an MPLS header where it expected an IP one.

    Two paths to the same place

    Look again at R4’s table. It has two rows for destination A — interface 0 with label 10, and interface 1 with label 8.

    That is the section’s real point, and the book is explicit that switching speed is not it:

    The true advantages of MPLS and the reason for current interest in MPLS, however, lie not in the potential increases in switching speeds, but rather in the new traffic management capabilities that MPLS enables.

    In plain words

    If R4 were forwarding on IP addresses, the routing protocols of chapter 5 would give it exactly one path to A: the least-cost one. There is no way to express “send half of it the other way”.

    With labels there is. An operator can force some traffic for a destination along one path and the rest along another, for any reason at all. That is traffic engineering.

    MPLS is also used to restore paths quickly, rerouting onto a precomputed failover path when a link fails. And it is used to build VPN (Virtual Private Network) s: an ISP (Internet Service Provider) connects a customer’s separate networks across its own MPLS network, isolating that customer’s addressing and resources from everybody else crossing it.

    One row of Figure 6.29 does not match the others

    R1 delivers to A with an out label of : the label is popped, because A is an ordinary IP device.

    R3 delivers to D with an out label of 9. But D is drawn exactly as A is — a device at the edge, on the far side of the last MPLS router. The text says as much: “IP devices R5, R6, A, and D are connected together via an MPLS infrastructure (MPLS-capable routers R1, R2, R3, and R4)”.

    If D is an IP device on the edge, then by the figure’s own logic that entry should read too, exactly as R1’s does. And label 9 is explained nowhere — the text accounts for 6, 8, 10 and 12, and never mentions 9.

    The site reproduces the figure as printed. Treat the R1 row as the one that shows you what happens at the edge.

    Everyday picture

    An internal courier system in a large building. Post arrives with a full street address, and at the door it is put into a coloured folder. Inside, nobody reads the address again — they read the folder colour, and the rules say which room a colour goes to next. At the last room the folder comes off and the letter is delivered.

    The point is not that reading a colour is faster than reading an address. It is that management can send some post for the fourth floor by the east stairs and some by the west, simply by using two colours.

    Where the picture stops. A folder colour is chosen once and kept. An MPLS label is swapped at every hop — 10 becomes 6 on the way through R3 — so the label means “the next step”, not “the destination”.

    Check yourself

    Check yourself

    0 of 7 answered
    1. 1.Why can an MPLS frame only travel between two routers that both speak MPLS?

    2. 2.What does a label-switched router NOT do that an ordinary IP router must?

    3. 3.predictIn Figure 6.29, R4's in-label column is blank on every row. Why?

    4. 4.R1's row for destination A has a dash in the out-label column. What does that mean?

    5. 5.predictR4 has two rows for destination A: interface 0 with label 10, and interface 1 with label 8. What would IP routing have given it?

    6. 6.predictA datagram enters at R4 with label 10 and leaves R3 towards R1. What label does it carry then?

    7. 7.Besides traffic engineering, what else is MPLS used for?

    What to remember

    • The MPLS header sits between the link-layer header and the IP header, so both ends of a link must understand it.
    • A label-switched router forwards on the label alone — no IP address extracted, no longest-prefix match. Labels are pushed at the edge, swapped at each hop, popped at the far edge, because a label names the next step, not the destination.
    • The real payoff is traffic engineering: two paths to one destination, which chapter 5’s least-cost routing cannot express. MPLS is also used for fast failover and for building VPNs.