MPLS - Multiprotocol Label Switching
The only purpose of this post is to demystify MPLS and hopefully give you a solid ground on which to build more knowledge on MPLS.
So what is MPLS?
Simply said, MPLS is just a forwarding/routing mechanism as opposed to traditional IP routing (static route/BGP/OSPF/RIP etc…) which enables faster IP processing/forwarding by integrating layer 2 information with layer 3 routing…
Having said that, we ought to remember than in traditional IP routing, whenever a router receives a packet, the packet is analyzed (DST field) against its forwarding table to determine the next hop. With MPLS, the packets no longer needs to be examined by the router as they are simply routed by looking at the packet tag and forwarded on a pre-configured Label Switch Path (LPS)
Before we go on, let’s define some terminology
An MPLS Domain is defined by a cloud of MPLS routers (LSR), delimited by an Ingress and Egress router.
An LSR is a Label Switch Router; it is a router that runs MPLS and which belongs to the MPLS cloud
An Ingress Router is an LSR and is the first router of the MPLS domain. That is to say, the LSR router looks at the IP packet as opposed to the other LSR routers of the MPLS domain and tags the packet
An Egess Router is also an LSR, but the last LSR router of the MPLS domain. When receiving the tagged packet, it strips the tag off from the packet and forwards it.
The LSP is the path the tagged packet will take within the MPLS domain. LSP stands for Label Switched Path
Things to keep in mind
Remember that many LSP exists within an MPLS domain and that a label (tag) is only valid for the next hop router. That is to say, each LSP beside the Egress LSP will be labelling (tagging) the packet for the next hop to use to determine the LSP.
Not so clear!? here is a small illustration
When a packet enters our Ingress routerA, it does not yet have a label. routerA will then look at the DST IP to determine the next LSR router to send it to, we assume this next LSR hop is routerB. Before sending the packet to routerB, routerA will then create a label, let’s assume the value to be 10 and mark it on the packet. The packet leaves routerA, and arrives at routerB. routerB will now look at the packet label and based on the value will look at its forwarding table to determine the LSP (the next hop LSR router). Once it determined it, it changes the value of the label based on it LBI ‘Label Base Information’ for this next hop LSR router to use, which in his turn will use to determine the next LSP.
Where is this label placed?
Remember we said earlier that with MPLS, routers didn’t need to look at the IP packet? well that is because MPLS is mostly a layer 2 technology that is integreated with layer 3 routing.
Having said that, the MPLS label is placed right after the frame header of the packet for Ethernet, PPP, HDLC networks (for ATM and Frame Relay, the corresponding layer 2 cell is used)
Ethernet: the MPLS label is refered as the SHIM field and the packet would look as follow
The MPLS label itself is composed of a 20 bit Label value (remember the integer value initialized by the LSR routers), but also of a 3 bit experimental field, 1 bit bottom-of-stack-indicator (we will get back to it when we address Label Stacking) and of the 8 bit TTL.
Extra: A packet can have multiple MPLS label, adding size to the MTU. Remember we are talking 4 extra bytes to the MTU for each MPLS label. We will tacked the MPLS Label stack later in the next part of this post.
They are also reserved MPLS label value to consider and know about, but this is for part 2
How do the LSR get their LBI updated?
Remember earlier, we said that an LSR in the MPLS cloud would update MPLS label value with the one in its LBI table and based on the MPLS value, the LSP “path” would be chosen. This LBI table is simply distributed to the LSR routers using 2 signalization methods, the LDP protocol and the Constrain Routing LDP (which we will tackle in part 2).
Focusing now on LDP; it defines a suite of procedures that enables the LSR routers to inform each other of the mapping by exchanging labels which are defined based on the current in used IGP. They are therefore 2 methods of distribution within LDP, the “downstream on demand” and the “unsolicited downstream”.
With “downstream on demand”, the upstream LSR router explicitly request the label updates from the downstream LSR routers for a specific subnet. While with “unsolicited downstream”, the downstream LSR router distributes its labels to all its neighbors.
The process would basically look as follow
routerA is adjacent to routerB
routerA starts sending a UDP Hello packet to routerB, and routerB does the same. Now keep in mind, those Hello packet like with OSPF allows the endpoint router to know, its neighbor is there.
Once that is through, both routers establish a TCP session, sends Label Requests and receives Label Updates.
Now LDP supports 2 type of retention mode “conservative” and “liberal”. The main difference is that, with “conservative”, the LSR conserves the current labels only for the next hop. If the next hop was to change, it will initiate a label update. In “liberal” mode, the LSR keeps all the labels, thus requires more memory.
“liberal” retention enables the use of “Fast reroute”, which we will address in the up coming parts.
Finally, but not last, LDP supports 3 major specifications
- Labels are defined based on information the routing table
- 3 FEC (Forwarding Equivalent Classes) can be defined, that is to say, it is possible to map a label to a traffic (QOS), a router ID or even an IP prefix
- You can establish LDP connection with a multi-hop LSR router; meaning that the router does not need to directly peer with its LDP endpoint
Conclusion Part 1
We briefly tackled what MPLS is and what it does. As we already discussed MPLS adds faster IP processing/routing compared to traditional IP routing; however as you would discover, with today’s fast CPU routers, this barely makes any difference and you will not notice the processing differences on the routers between traditional IP routing and MPLS. As we will discover in the next parts, MPLS introduces some interesting QOS features, and allows to isolate VPN traffic without much overhead.
the downstream LSR router distributes its labels to all its neightbors