This post is to learn the basics of MPLS as simple as possible for a Network Engineer to 
  understand how this Layer 2.5 technology works.

On this LAB, I will be going through some details on the following:

1.  Basics definitions of MPLS
2.  How MPLS works ?
3.  Devices comprising a MPLS network
4.  The various ways on how to enable MPLS.

So I have built the router configurations based on the topology above:

R1#show ip int brief 
Interface                  IP-Address      OK? Method Status                Protocol
Ethernet0/0                unassigned      YES NVRAM  administratively down down    
GigabitEthernet0/0         192.168.12.1    YES NVRAM  up                    up      
Loopback1                  10.10.10.10     YES NVRAM  up                    up      

p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000; background-color: #ffffff} span.s1 {font-variant-ligatures: no-common-ligatures}

R1#

R2#show ip interface brief 
Interface                  IP-Address      OK? Method Status                Protocol
Ethernet0/0                unassigned      YES NVRAM  administratively down down    
GigabitEthernet0/0         192.168.12.2    YES NVRAM  up                    up      
GigabitEthernet1/0         192.168.23.2    YES NVRAM  up                    up      
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000; background-color: #ffffff} span.s1 {font-variant-ligatures: no-common-ligatures}
R2#


R3#show ip int brief 
Interface                  IP-Address      OK? Method Status                Protocol
Ethernet0/0                unassigned      YES NVRAM  administratively down down    
GigabitEthernet0/0         192.168.23.3    YES NVRAM  up                    up      
Loopback3                  30.30.30.30     YES NVRAM  up                    up      
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000; background-color: #ffffff} span.s1 {font-variant-ligatures: no-common-ligatures}
R3#

So I have enabled MPLS by configuring “MPLS IP” on the interface connecting all the participating routers.


R1#show run int gi0/0
Building configuration…
Current configuration : 147 bytes
!
interface GigabitEthernet0/0
 ip address 192.168.12.1 255.255.255.0
 duplex full
 speed 1000
 media-type gbic
 negotiation auto
 mpls ip
 !
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000; background-color: #ffffff} p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000; background-color: #ffffff; min-height: 13.0px} span.s1 {font-variant-ligatures: no-common-ligatures}
end

R2#show run int gi0/0
Building configuration…
Current configuration : 147 bytes
!
interface GigabitEthernet0/0
 ip address 192.168.12.2 255.255.255.0
 duplex full
 speed 1000
 media-type gbic
 negotiation auto
 mpls ip
 !
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000; background-color: #ffffff} p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000; background-color: #ffffff; min-height: 13.0px} span.s1 {font-variant-ligatures: no-common-ligatures}
end


R2#show run int gi1/0 Building configuration…
Current configuration : 105 bytes
!
interface GigabitEthernet1/0
 ip address 192.168.23.2 255.255.255.0
 negotiation auto
 mpls ip
 !

p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000; background-color: #ffffff} p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000; background-color: #ffffff; min-height: 13.0px} span.s1 {font-variant-ligatures: no-common-ligatures}

end

We can check whether LDP is enabled on the interface using “show mpls interface” command:

R1#show mpls interfaces 
Interface              IP            Tunnel   BGP Static Operational
GigabitEthernet0/0     Yes (ldp)     No       No  No     Yes        
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000; background-color: #ffffff} span.s1 {font-variant-ligatures: no-common-ligatures}
R1#


R2#show mpls interfaces 
Interface              IP            Tunnel   BGP Static Operational
GigabitEthernet0/0     Yes (ldp)     No       No  No     Yes        
GigabitEthernet1/0     Yes (ldp)     No       No  No     Yes        
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000; background-color: #ffffff} span.s1 {font-variant-ligatures: no-common-ligatures}
R2#


R3#show mpls interfaces 
Interface              IP            Tunnel   BGP Static Operational
GigabitEthernet0/0     Yes (ldp)     No       No  No     Yes        
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000; background-color: #ffffff} span.s1 {font-variant-ligatures: no-common-ligatures}
R3#
That’s as simple on how to enable MPLS on a router. An other way to do this is using the command
mpls ldp autoconfig” under the OSPF process.

We can also quickly check the LDP neighbour using the command “show mpls ldp neighbor”

R1#show mpl ldp  neighbor 
    Peer LDP Ident: 192.168.23.2:0; Local LDP Ident 10.10.10.10:0
TCP connection: 192.168.23.2.27690 – 10.10.10.10.646
State: Oper; Msgs sent/rcvd: 6/7; Downstream
Up time: 00:00:07
LDP discovery sources:
  GigabitEthernet0/0, Src IP addr: 192.168.12.2
        Addresses bound to peer LDP Ident:

p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000; background-color: #ffffff} span.s1 {font-variant-ligatures: no-common-ligatures} span.Apple-tab-span {white-space:pre}

          192.168.12.2    192.168.23.2    


p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000; background-color: #ffffff} span.s1 {font-variant-ligatures: no-common-ligatures} span.Apple-tab-span {white-space:pre}

R2#show mpls ldp neighbor 
    Peer LDP Ident: 10.10.10.10:0; Local LDP Ident 20.20.20.20:0
TCP connection: 10.10.10.10.646 – 20.20.20.20.16743
State: Oper; Msgs sent/rcvd: 8/8; Downstream
Up time: 00:00:09
LDP discovery sources:
  GigabitEthernet0/0, Src IP addr: 192.168.12.1
        Addresses bound to peer LDP Ident:
          192.168.12.1    10.10.10.10     
    Peer LDP Ident: 30.30.30.30:0; Local LDP Ident 20.20.20.20:0
TCP connection: 30.30.30.30.18855 – 20.20.20.20.646
State: Oper; Msgs sent/rcvd: 8/8; Downstream
Up time: 00:00:09
LDP discovery sources:
  GigabitEthernet1/0, Src IP addr: 192.168.23.3
        Addresses bound to peer LDP Ident:
          192.168.23.3    30.30.30.30     
R2# 
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000; background-color: #ffffff} span.s1 {font-variant-ligatures: no-common-ligatures} span.Apple-tab-span {white-space:pre}
R3#show mpls ldp neighbor 
    Peer LDP Ident: 192.168.23.2:0; Local LDP Ident 30.30.30.30:0
TCP connection: 192.168.23.2.54383 – 30.30.30.30.646
State: Oper; Msgs sent/rcvd: 9/9; Downstream
Up time: 00:02:05
LDP discovery sources:
  GigabitEthernet0/0, Src IP addr: 192.168.23.2
        Addresses bound to peer LDP Ident:
          192.168.12.2    192.168.23.2    

p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000; background-color: #ffffff} span.s1 {font-variant-ligatures: no-common-ligatures} span.Apple-tab-span {white-space:pre}

Quick notes:

Few things to take note on the output above. I will focus on R2 as it has both R1 & R3 as LDP neighbours.

  • Peer LDP identifier  is the loopback of both R1 and R3 while the Local LDP identifier is Loopback of R2
  • MPLS works differently as other routing protocols such as OSPF. What i mean here is that MPLS needs to discover it neighbour using UDP Multicast Hello Packet (Multicast IP is 224.0.0.2) before becoming an LDP neighbours.
  • Once the neighbour is established, the LDP routers will be using a TCP connection using the Transport IP address which is usually the highest loopback address

MPLS is using a label for every prefix learned by a MPLS routers. Unlike other routing protocol such as BGP or OSPF, MPLS is using a MPLS label to switch packet across the MPLS networks. So what are the components of a MPLS header. MPLS headers consist of 4 fields including Label Value ( 20 bits ), EXP Bits ( 3 bits) , S field ( 1 bit) and TTL field ( 8 bits). The Label value is local to the router generating the labels which has both the “Local” and “Outgoing” label values. The experimental bits are use for setting the QoS value or the IP precedence value of a packet. The S field will indicate whether there are more MPLS headers to arrived on the router ( 0 = means more MPLS headers are coming, whilst 1 = that is the last MPLS headers). The TTL field is similar to the IP packet in which every hop it is being decremented by 1.

MPLS network consist of the following routers:

  •  Provider Edge Routers ( PE) – the router that connects to the customer edge routers.
  • P or Transit Routers – This is also called the Label Switch routers
  • Customer Edge routers

So how does the label works in the MPLS network?

Key thing to understand is the 3 operational process on how a MPLS label is switch.

  • Push – This simply means “adding” a MPLS label to the IP packet
  • Swap – This means MPLS labels will need to be “swap” with another MPLS value. This is due to the fact that labels are only local to the router.
  • Pop – MPLS labels are being “removed” or “pop”. This is usually a function that is being done by the Transit router or LSR before the IP packet is handover to the PE router.

Its better to explained this MPLS label operations with my topology above. First, I need to show the local MPLS bindings on each router and explained a bit of the information provided. So what does the “show mpls ldp bindings” will provide to us?  This is equivalent to the Forwarding Information Base (FIB table) for a routing protocol and in MPLS it is called ” Label Information Based (LIB). For any dynamic or stating routing protocols,  The FIB table shows the Prefix learned,  the next hop IP address and the interface to reach the prefix and is programmed in Data Plane. Basically the FIB table is derived from the Routing Table from the Control Plane and its been programmed into the ASIC(Hardware) for faster processing.

To check the FIB table, we can run the command “show ip cef”.

R2#show ip cef
Prefix               Next Hop             Interface
0.0.0.0/0            no route
0.0.0.0/8            drop
0.0.0.0/32           receive              
10.10.10.10/32       192.168.12.1         GigabitEthernet0/0
20.20.20.20/32       receive              Loopback2
30.30.30.30/32       192.168.23.3         GigabitEthernet1/0
127.0.0.0/8          drop
192.168.12.0/24      attached             GigabitEthernet0/0
192.168.12.0/32      receive              GigabitEthernet0/0
192.168.12.1/32      attached             GigabitEthernet0/0
192.168.12.2/32      receive              GigabitEthernet0/0
192.168.12.255/32    receive              GigabitEthernet0/0
192.168.23.0/24      attached             GigabitEthernet1/0
192.168.23.0/32      receive              GigabitEthernet1/0
192.168.23.2/32      receive              GigabitEthernet1/0
192.168.23.3/32      attached             GigabitEthernet1/0
192.168.23.255/32    receive              GigabitEthernet1/0
224.0.0.0/4          drop
224.0.0.0/24         receive              
240.0.0.0/4          drop
255.255.255.255/32   receive              

p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000; background-color: #ffffff} span.s1 {font-variant-ligatures: no-common-ligatures}

R2# 
Before moving forward,Take note that  I have assigned the following labels on each router for easy tracking:

R1#show run | sec mpls 
mpls label range 100 199
 mpls ip
R1#
R2#show run | sec mpls
mpls label range 200 299
 mpls ip
 mpls ip
R2#
R3#show run | sec mpls
mpls label range 300 399
 mpls ip
R3#

Going back to MPLS, to check the Label Information Base (LIB), we can run the command
“show mpls ldp bindings”.

R1#show mpls ldp bindings 
  lib entry: 10.10.10.10/32, rev 3
local binding:  label: imp-null
remote binding: lsr: 20.20.20.20:0, label: 203
  lib entry: 20.20.20.20/32, rev 11
local binding:  label: 100
remote binding: lsr: 20.20.20.20:0, label: imp-null
  lib entry: 30.30.30.30/32, rev 9
local binding:  label: 102
remote binding: lsr: 20.20.20.20:0, label: 202
  lib entry: 192.168.12.0/24, rev 5
local binding:  label: imp-null
remote binding: lsr: 20.20.20.20:0, label: imp-null
  lib entry: 192.168.23.0/24, rev 7
local binding:  label: 101
remote binding: lsr: 20.20.20.20:0, label: imp-null

p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000; background-color: #ffffff} span.s1 {font-variant-ligatures: no-common-ligatures} span.Apple-tab-span {white-space:pre}

R1#

R2#show mpls ldp bindings 
  lib entry: 10.10.10.10/32, rev 10
local binding:  label: 203
remote binding: lsr: 10.10.10.10:0, label: imp-null
remote binding: lsr: 30.30.30.30:0, label: 302
  lib entry: 20.20.20.20/32, rev 12
local binding:  label: imp-null
remote binding: lsr: 10.10.10.10:0, label: 100
remote binding: lsr: 30.30.30.30:0, label: 300
  lib entry: 30.30.30.30/32, rev 8
local binding:  label: 202
remote binding: lsr: 10.10.10.10:0, label: 102
remote binding: lsr: 30.30.30.30:0, label: imp-null
  lib entry: 192.168.12.0/24, rev 5
local binding:  label: imp-null
remote binding: lsr: 10.10.10.10:0, label: imp-null
remote binding: lsr: 30.30.30.30:0, label: 301
  lib entry: 192.168.23.0/24, rev 6
local binding:  label: imp-null
remote binding: lsr: 10.10.10.10:0, label: 101
remote binding: lsr: 30.30.30.30:0, label: imp-null
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000; background-color: #ffffff} span.s1 {font-variant-ligatures: no-common-ligatures} span.Apple-tab-span {white-space:pre}
R2#


R3#show mpls ldp bindings 
  lib entry: 10.10.10.10/32, rev 9
local binding:  label: 302
remote binding: lsr: 20.20.20.20:0, label: 203
  lib entry: 20.20.20.20/32, rev 11
local binding:  label: 300
remote binding: lsr: 20.20.20.20:0, label: imp-null
  lib entry: 30.30.30.30/32, rev 3
local binding:  label: imp-null
remote binding: lsr: 20.20.20.20:0, label: 202
  lib entry: 192.168.12.0/24, rev 7
local binding:  label: 301
remote binding: lsr: 20.20.20.20:0, label: imp-null
  lib entry: 192.168.23.0/24, rev 5
local binding:  label: imp-null
remote binding: lsr: 20.20.20.20:0, label: imp-null
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000; background-color: #ffffff} span.s1 {font-variant-ligatures: no-common-ligatures} span.Apple-tab-span {white-space:pre}
R3#

I’m more interested to check the Label Forwarding Information Based as this shows the actual label that is Push, Swap, Pop. Let’s check them now on the three routers.

R1#show mpls forwarding-table 
Local      Outgoing   Prefix           Bytes Label   Outgoing   Next Hop    
Label      Label      or Tunnel Id     Switched      interface              
100        Pop Label  20.20.20.20/32   0             Gi0/0      192.168.12.2
101        Pop Label  192.168.23.0/24  0             Gi0/0      192.168.12.2
102        202        30.30.30.30/32   0             Gi0/0      192.168.12.2

p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000; background-color: #ffffff} span.s1 {font-variant-ligatures: no-common-ligatures}

R1#

R2#show mpls forwarding-table 
Local      Outgoing   Prefix           Bytes Label   Outgoing   Next Hop    
Label      Label      or Tunnel Id     Switched      interface              
202        Pop Label  30.30.30.30/32   0             Gi1/0      192.168.23.3
203        Pop Label  10.10.10.10/32   0             Gi0/0      192.168.12.1
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000; background-color: #ffffff} span.s1 {font-variant-ligatures: no-common-ligatures}
R2#

R3#show mpls forwarding-table 
Local      Outgoing   Prefix           Bytes Label   Outgoing   Next Hop    
Label      Label      or Tunnel Id     Switched      interface              
300        Pop Label  20.20.20.20/32   0             Gi0/0      192.168.23.2
301        Pop Label  192.168.12.0/24  0             Gi0/0      192.168.23.2
302        203        10.10.10.10/32   0             Gi0/0      192.168.23.2
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000; background-color: #ffffff} span.s1 {font-variant-ligatures: no-common-ligatures}
R3#


Lets check the Prefix 30.30.30.30/32 on R1.
R1#show ip  cef
Prefix               Next Hop             Interface
0.0.0.0/0            no route
0.0.0.0/8            drop
0.0.0.0/32           receive              
10.10.10.10/32       receive              Loopback1
20.20.20.20/32       192.168.12.2         GigabitEthernet0/0
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000; background-color: #ffffff} span.s1 {font-variant-ligatures: no-common-ligatures}
30.30.30.30/32       192.168.12.2         GigabitEthernet0/0
R1#show mpls ldp bindings 
  lib entry: 10.10.10.10/32, rev 3
local binding:  label: imp-null
remote binding: lsr: 20.20.20.20:0, label: 203
  lib entry: 20.20.20.20/32, rev 11
local binding:  label: 100
remote binding: lsr: 20.20.20.20:0, label: imp-null
  lib entry: 30.30.30.30/32, rev 9
local binding:  label: 102

p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000; background-color: #ffffff} span.s1 {font-variant-ligatures: no-common-ligatures} span.Apple-tab-span {white-space:pre}

remote binding: lsr: 20.20.20.20:0, label: 202

Let me share how the push, swap and pop labels are happening. R1 is advertising the prefix 10.10.10.10/32. So locally R1 has created an IP packet containing this Prefix and is adding a label on it. As check on the MPLS forwarding table of R1, the local label that is being added is “Implicit-Null”.  Meaning when R2 sees that the label is Implicit-Null, it will pop (removed) the label.

R1#show mpls ldp bindings 
  lib entry: 10.10.10.10/32, rev 3
local binding:  label: imp-null
remote binding: lsr: 20.20.20.20:0, label: 203
Now looking at R2, it created a local label of 203 as seen from the “show mpls ldp bindings” command below,
R2#show mpls ldp bindings 
  lib entry: 10.10.10.10/32, rev 10
local binding:  label: 203
remote binding: lsr: 10.10.10.10:0, label: imp-null
remote binding: lsr: 30.30.30.30:0, label: 302
R2#show mpls forwarding-table 
Local      Outgoing   Prefix           Bytes Label   Outgoing   Next Hop    
Label      Label      or Tunnel Id     Switched      interface              
202        Pop Label  30.30.30.30/32               Gi1/0      192.168.23.3
203        Pop Label  10.10.10.10/32               Gi0/0      192.168.12.1
R2#
On R3, it also assigned a new label ( label swap).
R3#show mpls ldp bindings 
  lib entry: 10.10.10.10/32, rev 9
local binding:  label: 302
remote binding: lsr: 20.20.20.20:0, label: 203


R3#show mpls forwarding-table 
Local      Outgoing   Prefix           Bytes Label   Outgoing   Next Hop    
Label      Label      or Tunnel Id     Switched      interface              
300        Pop Label  20.20.20.20/32               Gi0/0      192.168.23.2
301        Pop Label  192.168.12.0/24              Gi0/0      192.168.23.2
302        203        10.10.10.10/32               Gi0/0      192.168.23.2
R3#



Finally, lets check the traceroute.

R1#traceroute 30.30.30.30 source 10.10.10.10
Type escape sequence to abort.
Tracing the route to 30.30.30.30
  1 192.168.12.2 [MPLS: Label 202 Exp 0] 48 msec 36 msec 8 msec
  2 192.168.23.3 44 msec 20 msec 36 msec

p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000; background-color: #ffffff} p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000; background-color: #ffffff; min-height: 13.0px} span.s1 {font-variant-ligatures: no-common-ligatures}

R1#













p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000; background-color: #ffffff} span.s1 {font-variant-ligatures: no-common-ligatures} p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000; background-color: #ffffff} span.s1 {font-variant-ligatures: no-common-ligatures} p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000; background-color: #ffffff} span.s1 {font-variant-ligatures: no-common-ligatures} p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000; background-color: #ffffff} span.s1 {font-variant-ligatures: no-common-ligatures}

Leave a comment

Quote of the week

"People ask me what I do in the winter when there's no baseball. I'll tell you what I do. I stare out the window and wait for spring."

~ Rogers Hornsby