SHARE

mpls beginner's guide

MPLS, which stands for Multiprotocol Label Switching, is a data transport method for various protocols on a Packet Switched Network (PSN).

If we refer to the OSI model, there are different protocols defined at different layers. For example, SDH/SONET, Ethernet, etc., are defined at layer two, i.e., data link layer. Protocols such as TCP and IP are defined at layer three, which is network layer. Individual protocols have their encapsulation method. When the encapsulated packet arrives at the network layer for to be routed, the router has to do a lot of work before it decides on which router port to forward to.

This whole decision-making process involves reading the packet header (source and destination IP address), encapsulating the packet, forwarding the packet to the most appropriate port, IP lookup, etc. To avoid all these extra overhead and to the rescue, MPLS was designed.

As self-evident from its name, MPLS supports multiple protocols, or in another word, MPLS can work independently of the protocols. Before we talk about label switching in MPLS, let us have a look at the routing and switching just to get an idea how did MPLS come into the picture.

Switching and Routing

As we already know, switching and routing take place at layer 2 and layer 3 respectively. MPLS, on the other hand, is an odd mix of switching and routing. That’s why it is said that MPLS works on 2.5 layers, sandwiched between data link layer and network layer.

What does happen when a router receives packet?

When a router receives a packet, it must find out which network the packet should be forwarded to. Each router will have its routing table. The router receiving the packet will scan its routing table and look for the longest match to the IP address of the packet. The concept of matching the IP address is often called LPM (Longest Prefix Matching). If you are interested in knowing more about it, you can read that here.

As finding the best appropriate forwarding address could be a time-consuming task for the router, it also leads to congestion sometimes. Now, let us have a look at the concept of switching.

How Switching works?

Switching makes use of the Hardware address or MAC address of the host to send the data. Using the ARP protocol, a sender finds out the host’s MAC address. Each Mac Address is assigned a port. Because there is no matching at the ethernet level switching unlike routing, switching is very fast compared to routing.

The working of MPLS

MPLS uses the best of routing and switching technology for a better throughput using a special device which is called LSR (Label Switch Router) taking its name from switch and router.

There are two kinds of routers that are used in the MPLS domain:

  • LSR (Label Switch Router) and,
  • LER (Label Edge Router)

LSRs work at the core level in the MPLS domain while LERs work at the edge of the network where IP networks and MPLS network meet together.

How does Label Edge Router work in MPLS?

LER sits in between the IP network domain and MPLS domain. It can either work as an ingress router or as an egress router. As an ingress router, when an LER receives a packet from the IP domain, it checks the layer three information. Based on the IP address of the packet, it assigns a label to the packet before forwarding the packet into the MPLS domain.

This process of assigning a label to a packet is called “Pushing.”

During Pushing, a special header called “Shim” header is inserted in between layer 2 and layer three, which carries the label information of the packet.

From Ingress LER, which sits at the edge of the network, when the arrives at the LSR, the LSR checks into LIB (Label Info Base) and swaps the label with another label just so that the packet can continue on the right path until it reaches the Egress LER (Outward LER).

The process of replacing the label of a packet with the new label is called swapping.

Egress LER is responsible for forwarding the packet from MPLS domain back to IP domain. But before forwarding the packet back into the IP network, Egress LER takes out the label (Shim Header) and hands the packet back to the IP network. This process of taking out the label is called popping.

The path that a particular labeled packet follows in the MPLS domain is called LSP (Label Switched Path). 

Now you must have realized how MPLS is protocol-independent. MPLS is a data transport mechanism. It can receive data frames from layer using any protocol such as ATM or Ethernet. But that does not affect the working of the MPLS; it simply does its work before it hands over the packet to the network layer.

Future of MPLS

Futuristically, MPLS is scalable to IPv6 as well. However, the main motive behind MPLS was to increase the routing speed which is no more a constraint due to ASICs and CAM-table based switching. Because of it, MPLS is limited to fixed usage now. There have been some improvements in it over the years such as MPLS-TP, another variant of MPLS, but the usage still remains the same.

If you are interested in networking and related topics, find our complete coverage on computer networks.