Enhance your Career in Networking With IPinBits!!!​

MPLS: Label Switching, Push, Swap, Pop

To view on the previous MPLS articles click on the below link if you haven’t already check you can start from there and then read this one.

This article will give you insights on how MPLS operates just the fundamentals, what are the devices involved are called.

Before Diving into PUSH, POP, SWAP label switching, lets us look on how the devices are stacked up inside the ISP cloud and what are the terminology used for MPLS.

We will be using this common topology throughout the MPLS articles for reference and uniqueness

Main Terminology and their meanings in MPLS Domain.

  1. LSR/ EDGE LSR: This is the Edge router which connects the customer to the ISP domain inside MPLS, also know as Provider EDGE who has connected with MPLS domain, as well customer routers. PE is responsible for separating customer’s their routes, routing and also to send those routes to other sites via MP-BGP, we will discuss all this routing, MPBGP in separate articles. PE attaches , detaches the labels of packets entering/leaving MPLS Domain. R-1-PE1, R-5-PE2 are PE routers in this above topology.
  2. LSR/Provider routers: This routers are responsible swapping the MPLS label, referring the LFIB table, there is no BGP running inside the core, so this P/LSR routers are core free, so less overhead. R-2, R-3,R-4 are P/ LSR routers in the above topology.
  3. CE/Customer Edge devices: As the name indicates this are the customer routers connecting the Edge/PE Devices, where we say PE-CE protocols runs. PE-CE protocol can be static , IGP or even BGP

Lets move on the topology, to understand the MPLS operation, this is just a background article to get started with MPLS.

If you recollect the MPLS label article, where we discuss about the MPLS tables LFIB and FIB, LFIB table has the best labels like the FIB who has the best route in forwarding plane.

PUSH:

  • So, whenever a packet comes inside a MPLS domain, in this case whenever R-1 router who is part of MPLS domain, receives an IP packet from R3 or R1 who are two different customers, R-1 will attach an MPLS label i.e., it will push an MPLS label and refer the next hop from that LFIB table.
  • Let’s verify the same with our lab, we have enabled MPLS on R-1-PE1, R-2, R-3, R-4, R-5-PE2 which are inside ISP, configured basic OSPF as IGP all in area 0, and we are running LDP over the interfaces which are part of MPLS domain inside ISP, we will have Separate article on LDP inside MPLS with its all packet types neighborship and stuff.
  • For simplicity, we have manually defined label range for all the routers to have unique labels for all the routers.
  • Let’s check the LFIB table on R-1PE-1 for loopback of R-5-PE2 i.e., 5.5.5.5, as you can see below R-1-PE1 will push the label, the outgoing label for 5.5.5.5/32 is 203, so R-1-PE1 will PUSH label 203 and forward it to R-2. You can verify the labels using traceroute to see the various labels which are PUSH, SWAP and POP.
  • Just an FYI, for every destination in the FIB, router will create is local label, its depends on the path/ router i.e. its upstream or downstream device.
FIB Entry:

R-1-PE1#show ip cef 5.5.5.5
5.5.5.5/32
  nexthop 192.168.0.2 GigabitEthernet0/0 label 203()

MPLS LABEL TABLE:

R-1-PE1#R-1-PE1#show mpls  forwarding-table 
Local      Outgoing   Prefix           Bytes Label   Outgoing   Next Hop    
Label      Label      or Tunnel Id     Switched      interface              
100        No Label   2.2.2.2/32       0             Gi0/0      192.168.0.2 
101        201        3.3.3.3/32       0             Gi0/0      192.168.0.2 
102        202        4.4.4.4/32       0             Gi0/0      192.168.0.2 
103        203        5.5.5.5/32       0             Gi0/0      192.168.0.2 
104        Pop Label  192.168.1.0/24   0             Gi0/0      192.168.0.2 
105        204        192.168.2.0/24   0             Gi0/0      192.168.0.2 
106        205        192.168.3.0/24   0             Gi0/0      192.168.0.2 


Trace route will show all the label stack and you can verify if the correct labels are used or not. Very good to have while we are troubleshooting MPLS.

TRACEROUTE to verify the label stack from R-1-PE1 to R-5-PE2

R-1-PE1#traceroute 5.5.5.5 source lo0
Type escape sequence to abort.
Tracing the route to 5.5.5.5
VRF info: (vrf in name/id, vrf out name/id)
  1 192.168.0.2 [MPLS: Label 203 Exp 0] 13 msec 12 msec 8 msec
  2 192.168.1.2 [MPLS: Label 303 Exp 0] 10 msec 19 msec 13 msec
  3 192.168.2.2 [MPLS: Label 404 Exp 0] 11 msec 11 msec 12 msec
  4 192.168.3.2 13 msec 11 msec 12 msec
R-1-PE1#show mp
R-1-PE1#show mpls for
R-1-PE1#show mpls forwarding-table 5.5.5.5
Local      Outgoing   Prefix           Bytes Label   Outgoing   Next Hop    
Label      Label      or Tunnel Id     Switched      interface              
103        203        5.5.5.5/32       0             Gi0/0      192.168.0.2 

R-1-PE1#show mpls forwarding-table 5.5.5.5 detail 
Local      Outgoing   Prefix           Bytes Label   Outgoing   Next Hop    
Label      Label      or Tunnel Id     Switched      interface              
103        203        5.5.5.5/32       0             Gi0/0      192.168.0.2 
        MAC/Encaps=14/18, MRU=1500, Label Stack{203}
        0C708ED850000C708EE85F008847 000CB000
        No output feature configured

SWAP, POP:

  • Let’s Check the R-2, R-3, R-4 tables, since this are only LSR/P routers, they will just swap label packet using LFIB table. Check the below output.
  • As you can see R-2 , R-3 , R-4 which are LSR routers will just swap the label that it has received to reach 5.5.5.5 prefix by referring the label table/ LFIB, if you notice on R-4 it has received no label from R-5 i.e. R-5 has send POP label, that to reach me you need to POP the mpls label and forward me pure IP packet.
  • R-5 does because its saved one extra lookup for FIB and LFIB, its also known as Penultimate Hop popping using IMPLICIT NULL (3 label), we will have separate article on it.
  • In short R-4 has Popped the MPLS and just forwarded pure IP packet without any labels, to R-5, R-5 will check the routing/forwarding table for 5.5.5.5 and will know yes, it’s me and the packet has come to be, it will accept and create response for it.

So, in short,
• R-1 ——-> PUSH the label, referring LFIB table.
• R-2, R-3 ——-> Will swap the Label using LFIB table
• R-4 —–> Will Pop the label since we have PHP as default behavior on the router, R-5 receives only IP packet without any labels

R-2-P#show mpls forwarding-table 5.5.5.5 
Local      Outgoing   Prefix           Bytes Label   Outgoing   Next Hop    
Label      Label      or Tunnel Id     Switched      interface              
203        303        5.5.5.5/32       540           Gi0/2      192.168.1.2 
R-2-P#

R-3-P#show mpls forwarding-table 5.5.5.5
Local      Outgoing   Prefix           Bytes Label   Outgoing   Next Hop    
Label      Label      or Tunnel Id     Switched      interface              
303        404        5.5.5.5/32       918           Gi0/1      192.168.2.2 
R-3-P#

R-4-P#show mpls forwarding-table 5.5.5.5
Local      Outgoing   Prefix           Bytes Label   Outgoing   Next Hop    
Label      Label      or Tunnel Id     Switched      interface              
404        No Label   5.5.5.5/32       1218          Gi0/0      192.168.3.2 
R-4-P#


This is how label switching works inside MPLS, we its just as simple as that, its all about labels and label table, so MPLS is just playing with labels inside ISP it works on layer 2.5, which is built in forwarding plane, so its doesn’t need to do IP lookup in the control plane

INGRESS ROUTER/ PE /EDGE /LSR ————–PUSH

LSR/P Routers —————–SWAP

PHP ROUTER ( last before EGRESS) ———-POP

That’s it with respect to MPLS push, pop and swap functions, we will have more articles on the actual working in Depth, how the ISP uses MPLS to achieve L3 VPN and stuff.

Next article is MPLS LDP protocol, label range, and how LDP distributes labels, what are the packet types. Stay Tuned !!!!!

Related blog posts