Understanding how MPLS Works in Cisco IOS Router

Multi-Protocol Label Switching, or shortly called MPLS, is a packet forwarding technique that uses “label” to determine the path to reach its destination. MPLS is a standard and supported by most of the networking vendors including Cisco. If you are new to MPLS implementation in Cisco IOS router, first you have to be familiar with the MPLS terminology used by Cisco. Read on to find out more information that will help you Understanding How MPLS Works in Cisco IOS Router.

Understanding How MPLS Works in Cisco IOS Router

In IP routing, each router will perform lookup on its routing table and therefore each router needs to have the information about the destination prefix. In MPLS, only routers in the first and the last hop that needs to know the information about the destination prefix. This is made possible due to additional bit (which we refer them as “label”) being attached to the packet header as an identifier to find the way to the destination.

In Cisco IOS environment, the first and the last hop routers in an MPLS network are called Label Edge Router (LER) while all the routers in between them are called Label Switching Router (LSR). The MPLS path established between LERs is called Label Switching Path (LSP). See picture below for better understanding:

Understanding How MPLS Works in Cisco IOS Router - LER, LSR, LSP

Both LERs and LSRs are doing label assignment independently and exchange the label information by a protocol called LDP or Label Distribution Protocol. Once LDP established and each router has built their own MPLS forwarding table, LER/LSR will perform what is called “IP-to-label forwarding”, “label-to-label forwarding”, or “label-to-IP forwarding” to an incoming packet based on the information registered in the forwarding table. These are the basics of understanding how MPLS works in Cisco IOS router, and to examine each of these operations will be explained below.

IP-to-label forwarding

This terminology refers to label PUSH operation performed by first LER in a LSP to an incoming IP packet. As the name implies, an unlabeled incoming IP packet will be given a label tag which will be used by the next-hop router to forward the packet until it reaches the destination.

Understanding How MPLS Works in Cisco IOS Router - PUSH

On the above topology, for example, an unlabeled packet destined for 22.0.0.100/24 arrives in PE1 which is a LER, and in here MPLS process will give a label to this packet so the next router receiving this packet will know what to do with it. To see what label given to a unlabeled packet, we can use the command show mpls forwarding-table [destination address]. In the example output below we can see that for packet to 22.0.0.100 is given the label of 18 (see outgoing tag 18)

PE1#show mpls forwarding-table 22.0.0.100
Local  Outgoing     Prefix           Bytes tag  Outgoing   Next Hop
tag    tag or VC    or Tunnel Id     switched   interface
16     18           22.0.0.0/24      0          Fa0/0      10.1.1.1

From the output we can also see that the packet is forwarded via interface f0/0 which is connected to the next-hop router which is P1 (10.1.1.1).

Label-to-label forwarding

This terminology refers to label SWAP operation performed by all LSR in the middle of LSP to an incoming labelled packet. LSR will read the label on an incoming packet and forward it to the related next-hop and outgoing interface. Before LSR forward the packet, it will swap the label with its own assigned label.

Understanding How MPLS Works in Cisco IOS Router - SWAP

Continuing from the previous example, packet with label 18 from PE1 arrives on P1 which is an LSR. P1 will examine the label (incoming tag 18) and then swap it with its own label (outgoing tag 16), as shown in the forwarding table of P1 below:

P1#show mpls forwarding-table
Local  Outgoing    Prefix            Bytes tag  Outgoing   Next Hop
tag    tag or VC   or Tunnel Id      switched   interface
16     Pop tag     10.0.0.101/32     1162       Fa0/0      10.1.1.2
17     Pop tag     10.1.1.8/30       0          Fa0/0      10.1.1.2
18     16          10.0.0.102/32     712        Fa0/1      10.1.1.6
19     Pop tag     10.0.0.2/32       0          Fa0/1      10.1.1.6
20     Pop tag     10.1.1.12/30      0          Fa0/1      10.1.1.6

The packet, now with label 16, is then forwarded to the next-hop through interface f0/1 of P1, which is P2 (10.1.1.6).

Label-to-IP forwarding

This terminology refers to label POP operation performed by the last LSR in a LSP to an incoming labelled packet. This LSR will remove the label from the packet and the next-hop router will continue forwarding it with normal IP routing to the destination.

Understanding How MPLS Works in Cisco IOS Router - POP

Continuing again from the above example, packet with label 16 arrived from P1 on P2. In P2 forwarding table, the next action given for incoming packet with label 16 is “pop tag” as shown in the output below:

P2#show mpls forwarding-table
Local  Outgoing    Prefix            Bytes tag  Outgoing   Next Hop
tag    tag or VC   or Tunnel Id      switched   interface
16     Pop tag     10.0.0.102/32     1095       Fa0/1      10.1.1.14
17     16          10.0.0.101/32     1937       Fa0/0      10.1.1.5
18     Pop tag     10.0.0.1/32       0          Fa0/0      10.1.1.5
19     17          10.1.1.8/30       0          Fa0/0      10.1.1.5
20     Pop tag     10.1.1.0/30       0          Fa0/0      10.1.1.5

Pop tag means that label is now removed from the packet and then it will be forwarded to interface f0/0 to next-hop address of 10.1.1.14. The outgoing interface and next-hop address in MPLS forwarding table of P2 leads the packet to reach PE2, which is a LER, and this ends the journey of the packet through the LSP.

From PE2 the packet will continue to be forwarded as a regular IP packet. As can be seen on the routing table of PE2, packet destined for 22.0.0.100 will be forwarded to CE2 as the next-hop, which is also the final destination of the packet.

PE2#show ip route 22.0.0.100
Routing entry for 22.0.0.0/24
  Known via "connected", distance 0, metric 0 (connected, via interface)
  Advertised by bgp 65000
  Routing Descriptor Blocks:
  * directly connected, via FastEthernet1/0
      Route metric is 0, traffic share count is 1

With this example in mind, now it is going to be easier in understanding how MPLS works in Cisco IOS router.

Conclusions – How MPLS Works

From the above explanation we can see that normal IP routing occurs only between CE1 to PE1 and PE2 to CE2. The rest of the packet forwarding does not rely on routing table at all, but instead it does rely on MPLS forwarding table. The detail of how to configure MPLS on Cisco IOS Router can be found on our previous post.

Note that only PE1 and PE2 needs to know the routing entry for both CE routers (11.0.0.0/24 and 22.0.0.0/24), but P1 and P2 does not need to know this information. However, the MPLS forwarding table itself cannot be built without having all the MPLS routers establishing L3 routing between their interfaces first. So a routing between PE1-P1-P2-PE2 needs to be established before we can configure MPLS and let these routers built their MPLS forwarding table, in this case we already have OSPF and BGP as the L3 routing protocol.

This concept applies to most of networking vendors, including Cisco. And that’s why understanding how MPLS works in Cisco IOS router usually having not so much different with understanding how it works on other vendor.

The following two tabs change content below.
Arranda Saputra

Arranda Saputra

ITIL Certified, CCNA, CCDA, VCP6-DCV, MCSA Administering Windows Server 2012
I am IT practitioner in real life with specialization in network and server infrastructure. I have years of experience in design, analysis, operation, and optimization of infrastructure solutions for enterprise-scaled network. You can send me a message on LinkedIn or email to arranda.saputra@outlook.com for further inquiry regarding stuffs that I wrote or opportunity to collaborate in a project.
scroll to top