Network Kings


$999 $499 only For All Access Pass Today! USE PROMO CODE : LIMITED

d :
h :

What is MPLS & How does it work : Explained

The Concept of MPLS

Internet routing works on packet hopping from one router to another until it reaches the destination address. IP Packet contains no information about the route which it must follow to reach the destination. It just contains the destination IP Address.

In this process, each router that receives the packet has to make an independent forwarding decision for each packet, which it does using the routing table. This process is CPU intensive, seems slow, and decreases the performance of real-time applications like voice.

Also, traditionally to connect different sites of a particular company, we need to add a separate lease line in between the sites which is generally provided by an ISP.

separate lease line

We require another leased line if we further want to connect B and C.

What are the advantages of connecting sites using different lease lines?

Connecting sites using different lease lines has some advantages as follows:  

  1. Secure 
  2. High bandwidth and transmission speed 
  3. More reliable 

What are the disadvantages of connecting sites using different lease lines?

Connecting sites using different lease lines has some disadvantages as follows:

  1. Expensive 
  2. Permanent physical connection 
  3. Not scalable. As the size of a company site increases, more lease lines need to be added. 

What is MPLS?

Multiprotocol Label Switching, also known as MPLS, is a network technology that helps routers make forwarding decisions based on labels instead of IP Addresses. It is a versatile and efficient protocol used to route network traffic.

MPLS operates at Layer 2.5, bridging the gap between traditional Layer 2 (Data Link) and Layer 3 (Network) in the OSI model. This technology is popular and used by organization/ enterprise networks to connect their remote branches. MPLS packet is forwarded based on the MPLS label hence we are not required to open the packet to see the destination address.

This unique positioning enables MPLS to provide a flexible and scalable framework for building private networks over existing infrastructure, creating MPLS VPNs.

Routing using lables

With the help of MPLS VPN, connecting different sites becomes comparatively easier and inexpensive since we can use same the MPLS architecture to connect different sites.

MPLS architecture

What is an MPLS Header?

The MPLS header is of 4 bytes, i.e., 32 bits 

  • 20 bits: – Label information field is 20 bits. Labels 0 to 15 are reserved 
  • 3 bits: – Experimental bits are used for Quality of Service (QoS). 
  • 1 bit: – S bit or bottom of the stack. More than one MPLS header can be attached to an IP packet. 


  1. If s bit is 1 implements the header at this point is the last MPLS header 
  2. S bit is 0, MPLS header is not the last header 
  • 8 bits: – Time to live information is 8 bits. TTL value decreases by 1 with each hop. 
MPLS header

What terminologies get used in MPLS?

The terminologies used in MPLS are as follows-

  • P devices

The devices in the provider network that do not directly get connected to a customer site. These devices are in the core network of the service provider. 

  • PE

Provider Edge devices are the devices at the edge of the MPLS network that are directly connected to the customer 

  • CE

Customer Edge devices are the customer network devices that link to the service provider network. CE devices get directly connected to Provider Edge Devices. 

  • LSR

Label switch routers are MPLS-enabled routers that can understand labels. 

  • Ingress LSR

The Ingress label switch router is the router that receives the IP Packer from the Customer Edge router. Ingress LSR attaches the first label to the IP Packet. 

  • Intermediate LSR

These routers are used to swap labels inside the MPLS Network 

  • Egress LSR

These routers remove the label and forward the remaining packet to the Customer Edge router. 

  • Label switched path

LSP is the path that the packet takes in an MPLS network. The first Label Switch Router of the LSP is the ingress LSR, while the last LSR of the LSP is the egress LSR.

What protocol gets used in MPLS?

Since the label is attached to the packet dynamically, there must be some protocol that helps to perform this function. The protocol used in MPLS is as follows-

LDP (Label Distribution Protocol) and TDP (Tag Distribution Protocol) are two routing protocols used in Multiprotocol Label Switching (MPLS) networks to distribute labels and facilitate the establishment of Label Switched Paths (LSPs). 

This protocol automatically generates and exchanges labels between routers. Each router will locally generate labels for its prefixes and then advertise the label values to its neighbours. 

Both protocols function in the same manner, but TDP is Cisco proprietary, and LDP is an open standard protocol. 


How does MPLS work?

As we have discussed in the case of MPLS, the packet is forwarded with the help of labels instead of IP Addresses. 

Label Switched routers create a local label, and then it distributes this local label to each LDP neighbour. Received labels are called remote labels. LSR stores this local and remote label in a table, known as a label information base (LIB). Out of all the received remote labels, LSR chooses the best path and a remote label associated with it and stores it in a label forwarding information base table (LFIB). 

Instead of performing complex IP header lookups and route calculations for each packet, MPLS routers simply switch packets based on the MPLS labels. This results in faster and more deterministic packet forwarding. 

What is the function of the router enabled with MPLS?

Routers enabled with MPLS perform three functions: – 

  • Push

Add a label to the IP Packet. When a packet enters the MPLS network at the ingress router (the router where it enters the MPLS domain), the router assigns a unique MPLS label to the packet. This label is a short identifier (usually 20 bits) that represents a specific path or route through the network. The assigned label is added to the packet’s header.  

  • Swap

Replace the top label with a different label. As the labelled packet travels through the MPLS network, each router examines the MPLS label in the packet’s header and makes a forwarding decision based on that label. When a labelled packet arrives at an LSR, that LSR looks up its label table and replaces the incoming label with a new label corresponding to the next hop in the Label Switched Path (LSP). All the intermediate LSRs perform Swap.

  • Pop

Removes the label. When this packet reaches a router that is directly connected to the egress LSR, it pops the label and the egress LSR receives an IP packet. 

The egress router then looks up the RIB table and forwards the packet with the help of an IP Address. 

RIB table

What is PHP?

PHP stands for Penultimate Hop Popping, and It refers to the process using which the router just before the final hop (the egress router) in the Label Switched Path, the penultimate hop router has the option to “pop” or remove the MPLS label from the packet and forward it to its destination using regular IP routing.

How does PHP work?

Here’s how PHP works:

When a labelled packet reaches the penultimate hop router (the router just before the egress router), it has already traversed most of the MPLS network with the label intact.

The penultimate hop router knows the egress router and knows that the packet is about to exit the MPLS domain. Instead of forwarding the packet with the MPLS label to the egress router, it performs PHP.

PHP involves removing the MPLS label from the packet and forwarding it based on its original IP header. In other words, the penultimate hop router “pops” the label.

The packet continues its journey to the egress router, which receives it as a regular IP packet, not an MPLS-labeled packet.

What is the purpose of PHP?

The primary purpose of PHP is to reduce the processing load on the egress router. Without PHP, the egress router would need to perform label swapping and forwarding. Since it is the last router of the MPLS network, the packet that It forwards should be an IP Packet, and if PHP is not performed, the egress router has to perform popping of the label as well as an IP lookup to find the destination address of the packet.

This process would be resource-intensive, especially in networks with high traffic loads. By popping the label at the penultimate hop router, the egress router can focus on handling IP packets rather than MPLS-labeled packets.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.