A very brief introduction to MPLS, and the benefits it provides to customers
MPLS is the realization from its predecessors ATM and Frame-Relay that a more efficient, lower cost, and higher speed WAN packet switching solution was needed in the late 90’s which gave way to the IETF coming up with MPLS.
For all intensive purposes, MPLS is at its core a traffic forwarding protocol.
For its time it was incredibly high-speed compared to ATM or Frame-Relay, in todays networks its speed is not mind blowing, however its flexibility to provide QoS / CoS over customers WAN connecting sites is to date extremely valuable along with its flexibility to transport basically any type of traffic.
Though MPLS is configured on top of Layer 3 IP Networks, once running it does not look at Layer 3 IP information at all when making traffic forwarding decisions, thus why it is considered to run at Layer 2.5 because the MPLS Label literally sits between Layer 2 and Layer 3 headers in IP Packets.
Why does not looking at Layer 3 IP information matter? What makes it so great?
What makes it so great is the flexibility to send basically any type of traffic over an MPLS network, for example the MPLS Networks Layer 3 IP component could be IPv4, however customers could run IPv6 at all their locations and neither the Customer or Service Provider would need to perform any extra tasks because once that traffic hits the Provider Edge Router it does not look Layer 3 info to forward traffic.
If you are in the midst of or have completed a Cisco R/S certification, you have probably burned IPv4 to IPv6 Migration methods into your brain, so the fact that MPLS operates at this pseudo-layer “2.5” and could care less if your traffic is IPv8 or IPv10 is amazing!
That is kind of mind blowing to come out of this “silo” of R/S, where you go from considering how to configure GRE tunnels to encapsulate IPv6 traffic to traverse IPv4 networks, to an MPLS network that forwards any kind of traffic!
MPLS explained through its Terminology with visual examples to demonstrate!
To keep this as not boring as possible I have tried to create or find some images to visually explain the terminology or concept, however some of the Terminology is just kind of a quick explanation as there is really no complex understanding needed.
CE (Customer Edge) / PE (Provider Edge) / P (Provider) Routers
These different router types simply refer to where they are / who they talk to in the MPLS Network, as shown here:
CE Routers ONLY talk to the PE Routers, they do not talk to the remote sites CE router, their communication stops at the Provider Edge.
PE Routers talk both directly to different customers CE Routers, as well as P or Provider Network (Core) routers in the MPLS network, which PE routers also speak to each other across the Provider network via mBGP but that is a discussion for another day.
P Routers talk to all routers in the Provider network (P and PE Routers), these are considered Transit Routers for customer traffic, however they never talk to CE Routers.
MPLS Labels in the IP Header and what all MPLS Label fields represent
MPLS Labels in an IP Packet are used to make forwarding decisions, but also to perform QoS, and TTL (Time To Live) values as well as demonstrated in this illustration:
(Citation for this image [great MPLS post on CLN] is David P on CLN found here)
As seen in the break down, an MPLS label is 32 bits in total size, comprised of:
- 20 Label bits – The MPLS Label value from a range of 0-1048575
- 3 Traffic Class / EXP bits – Used to perform QoS / CoS within the MPLS Network
- 1 Bottom of Stack bit – Multiple labels can be “stacked” on an IP Packet, this label indicates which is on the bottom (more on that in a moment)
- 8 TTL Bits – This gives the same 254 TTL value as an IP Packet so MPLS packets are not bouncing around the network endlessly, so nothing real tricky here
- (Label Bits) The range of label values is a bit misleading as labels 0-15 are a reserved range of label values for built in features for MPLS, which all of them can be reviewed in depth on the IANA’s official website here.
- (TC / EXP Bits) These are called “EXP” or “Experimental” bits in the CBT Nuggets Fundamentals series I am watching, however I have also seen these described as “TC” bits for Traffic Class which is built in QoS / CoS into the MPLS network which may be the updated use for them, so I decided to include both here in case you see it described as one or the other to avoid confusion on these bits in the label
- (BoS bit) The “Bottom of Stack” bit is interesting in how it explains how MPLS works, as multiple MPLS Labels can be “stacked” onto an IP Packet, the Bottom of Stack label bit being on (1) indicates it is the closest label to the Layer 3 IP Header of the packet while all other labels not on the Bottom of Stack will have BoS bits set to off (0) and the Top most label (closest to Layer 2 header) is the Label preferred / used to forward the IP Packet.
- (TTL Bits) The TTL 8-bits is pretty self explanatory, each hop the TTL value is decremented by one starting from 254 in the MPLS label, and once the value is zero the packet is discarded.
Label Based Forwarding
Refers specifically to MPLS and the forwarding of traffic based on Label Switching rather than Layer 3 or Layer 2 information, such as IP routing or VPLS (Layer 2) forwarding.
LSR (Label Switched Router)
Label Switched Routers are routers enabled for MPLS, that have formed neighborships with adjacent LSR routers, so the two neighbors can perform Label Based Forwarding or Label Switching of IP Packets by exchanging Label information via LDP.
Imposing Label / Label Push
When an IP packet arrives at an LSR with no MPLS Label, the LSR does a “Label Push” which essentially just means it slaps an MPLS Label on the IP Packet before forwarding it to the Next-Hop LSR, and the packet is Label Switched through the MPLS network.
This is also called “Imposing” a Label on an incoming IP Packet, all the same thing, but as with Cisco there are 15 names for the exact same thing 🙂
LDP (Label Distribution Protocol)
Label Distribution Protocol can get into a fairly deep discussion of how it works, as it is the Control Plane equivalent of a Dyanmic Routing Protocol for MPLS (think “router ospf 1” or “router eigrp 1”), this forms neighbor relationships / sessions with Adjacent LSR routers which indicates they tell each other what labels they use for routes.
I won’t go too much further into LDP here as there are quite a few details, but shown in this graphic is a simplified version of how LDP forms LSR Neighbor relationships:
The CE Routers do not run MPLS so they do not create LDP advertisements, and within the MPLS path shown here, only directly connected neighbors know of the other neighbors “label bindings” to destination networks, an LSR is only aware of the its directly connected neighbors MPLS Labels on MPLS enabled interfaces.
Local Label Bindings, Remote Label Bindings, and LIB (Label Information Base)
First to be absolutely clear, there must be two LSR’s (MPLS Enabled routers exchanging label info via LDP) for LSR’s to create Labels at all, wanted to make that point clear before discussing label bindings that one single MPLS router will NOT generate local Label Bindings for destination IP networks – It MUST have a second LSR to create them!
What did that short rant about LSRs and Local Bindings mean?
When two LSR’s form a neighbor relationship, they both dynamically create mappings of MPLS Labels to every IP Destination they have stored in their FIB table, and then the neighbors exchange these mappings to store in what is called their LIB (Label Information Base) or the LFIB (Label Forwarding Info Base).
At a high level view this is what gives MPLS its speed and simplicity, as directly connected neighbors know only about their directly connected neighbors LIB mappings, so when a packet arrives it can rapidly perform a label swap so the next router receives its own locally bound label # for the destination and this continues until the traffic reaches the destination.
MPLS Label Swapping explained and illustrated
This is the Label Range I will be using when labbing, so consider these ranges in use:
Assume all routers are LSR’s and have exchanged information via LDP with eachother, and between each router the dynamically assigned “local binding” for destination R5-PE’s loopback of 184.108.40.206 ends in “x01” as its label.
Starting from R1-PE to R5-PE this is how the labels will appear along the path:
- R1-PE send the packet using R2-P’s Label for 220.127.116.11 instead of its own, LSR’s only use their “Local Binding” to forward packets, LDP is the mechanism that tells an LSR’s neighbors “This is the Label I use to forward traffic to x.x.x.x network”
- R2-P receives the packet with MPLS Label 201, looks up where to forward the packet, and perform a “Label Swap” removing the existing “Top” label and replacing it with the Next-Hop LSR’s label for that IP destination network
- R3-P repeats this process, receives the packet with its own “Local Binding” label, then swaps that label with the Next-Hop routers Label and forwards
- R4-P receives the packet with Label 401, looks at its LIB, and finds that the Next-Hop is directly connect to the IP Destination for the traffic and “POP”s the MPLS Label off the IP Packet before forwarding to R5
What on Earth is MPLS Label “POP”ing operation?
It refers to removing or “POP”ing off the MPLS Label from an IP Packet, this is done when an LSR goes to perform a Label Swap, and find that the Next-Hop label literally shows as “POP” in the LIB Table indicating to remove the MPLS label entirely before forwarding.
How does R4 know R5 is that last hop if MPLS doesn’t look at IP info?
Equally good question!
Within the Label Bindings exchanged via LDP, if a Router knows it is the last MPLS hop to a destination network, it will send one of those exotic “Reserved Label” numbers (Label #3 specifically) to its neighbor which is called the “imp-null” or “Implicit Null” label # which indicates that there is no MPLS Next-Hop from itself to the destination network.
To review this scenario again before introducing some more acronyms and terminology:
R4 is considered the “Ultimate” LSR in the scenario because it is performing what is called “Penultimate Hop Popping” (PHP) of the MPLS Label, meaning it recognizes it is the final MPLS Hop to the destination, this mechanism avoids R5 needing to redundantly look at the MPLS Label only to find it is the IP Destination then have to look up the IP Routing information to delivery the packet to its final destination.
So to review that process quick once more in a bit more condensed explanation:
- When R4 and R5 share LIB information via LDP, R5 sends its Loopback IP Network with Label #3 from the Reserved Label Range, aka imp-null or Implicit Null as R5’s way of indicating it is directly connected to the IP network destination
- R4 performs PHP as the “Ultimate” router (last MPLS Hop before the packet reaches its IP Destination), POPs off the MPLS label, and forwards the packet to R5-PE
- R5 receives the packet with no MPLS label attached, and refers directly to the IP Routing table for information on how to deliver the packet to its destination
LSP (Label Switched Path) – The “Tunnel” created by these MPLS mechanisms
In conclusion of reviewing all of these mechanisms, they ultimately lead to the creation of Tunneling through the MPLS network to different destinations, which is called the Label Switched Path or LSP.
Given our R1 to R5 Label Based Forwarding example, the LSP would appear as this:
Label Switched Path simply refers to the Path through the MPLS network that LSR’s will use to forward the traffic to its destination, and given my MPLS network is linear in this Topology, all traffic will have the same LSP but of course in an actual Service Providers network with hundreds or thousands of Core Routers this all becomes a lot less easy.
And that is a good first look at MPLS, will have an MPLS lab coming up soon
Given some recent life events I am not able to get in front of my laptop to lab for long amounts of time (even this article took quite a few sit downs to write), however I will continue to work towards getting some labs up using EVE-NG to continue the MPLS warpath as I believe it has incredible value to a Network Engineer to know.
Hope to be back at full capacity very soon, until next time, stay frosty fellow geeks! 🙂