How MPLS works

The ABCs of MPLS

How Tootsie Roll Pops can help us understand the intricacies of MPLS

MPLS – or Multiprotocol Label Switching – has been one of the big tech success stories of the past decade.

7 reasons MPLS has been wildly successful

And yet, it's become rather difficult to find an explanation written in layman's terms for how MPLS actually works. For instance, the Wikipedia entry on MPLS informs us that "when MPLS was conceived, Label Lookup and Label Switching were faster than a RIB lookup because they could take place directly within the switched fabric and not the CPU." This makes perfect sense if you have a background in computer science but it doesn't help the average Joe understand what MPLS is really about.

The following is a humble attempt to break MPLS down into its most basic elements that will hopefully help you gain a solid grasp of how the technology really operates. And to make things even sweeter (pun intended), we've decided to use a fun setting to act as a metaphor for an MPLS network: namely, a lollipop factory.

Packets and Tootsie Pops

At its core, MPLS is basically a more efficient way of forwarding and routing packets, which are the basic building blocks of data transmitted over the Internet. Packets are comprised of two main parts: a header that gives the network instructions for where and how to send the packet to its destination, and a payload that contains the data itself. In networks that don't have MPLS, must routers analyze packet headers to determine what routers the packets should be forwarded to prior to their final destination.

For our purposes, we'll think of packets as Tootsie Roll Pops, where the outer candy shell is the header and the Tootsie Roll in the center is the payload. Let's say that you have a Tootsie Pop factory that needs to sort out the various flavors of pops into different bins to be sent out to stores. The factory owner has designed a sorting machine that takes up every pop and forwards it to different bins based on its flavor. To determine the flavor of each pop, the machine must analyze several components of their outer shells, from the types of dyes used to color them to the types of chemicals used to give them their artificial flavors.

So imagine that three pops with flavors of orange, cherry and strawberry get sucked up into the sorting machine. At the first stop of the sorting machine, the color sorter uses color analysis to determine which pops are orange and then forwards them to the orange bin. The color sorter cannot tell the difference between the cherry and strawberry pops, however, and it must forward them to a second sorter that will more deeply analyze each pop's outer shell. This can be a somewhat inefficient way of sorting the pops, since each stop in the sorting machine must spend extra time analyzing the pops' shells.

MPLS and wrappers to the rescue

This is where MPLS comes in. Instead of having a system in which all pops are sorted by analyzing their shells' chemical components at each individual stop in the sorting machine, an MPLS machine fully analyzes each piece of candy at the very beginning of the process and puts a wrapper on it. The wrapper clearly labels each pop by its flavor and thus provides a clear path for the sorting machine to follow. Thus the machine doesn't have to waste time breaking down the chemical components of each pop – it can simply read the label and send it directly to its proper bin.

In the non-lollipop world, MPLS works much the same way. When a packet enters an MPLS network, it enters through a Label Edge Router and is affixed with a label stack that assigns it a forwarding equivalence class (FEC) that tells each router where to forward the packet without having to dissect its header. Each label has four main components: a 20-bit label value; a 3-bit traffic class field that designates quality of service, priority and Explicit Congestion Notification; and 8-bit time to live field indicating the maximum number of routers a packet should be sent through before it gets killed off; a 1-bit bottom of stack flag indicating that it is the last label of the stack.

Not only does this labeling technique simplify the process of forwarding packets, but it also gives networks the ability to simply handle traffic from many different kinds of networks. Because MPLS is protocol-agnostic, it can handle packets from ATM, Frame Relay, SONET or Ethernet networks. In other words, an MPLS network takes packets from several kinds of networks, slaps label stacks on them and forwards them to their destinations regardless of the type of network they came from.

To bring back the candy analogy, imagine that our Tootsie Pop company purchased Charms' Blow Pops and had to integrate them into its MPLS-style sorting machine. It wouldn't matter that some of the pops were Tootsie Pops and some were Blow Pops – our sorting machine based on the Label Edge Router would still place them in their proper wrappers and forward them to their final destinations all the same.

This story, "How MPLS works," was originally published at NetworkWorld.com. Follow the latest developments in MPLS at Network World.

Copyright © 2009 IDG Communications, Inc.

The 10 most powerful companies in enterprise networking 2022