Home > Basic MPLS Tutorial

Basic MPLS Tutorial

February 23rd, 2018 Go to comments

MPLS is a new forwarding mechanism called “label switching” in which packets are forwarded based on labels. However, hosts are unaware about labeled packets so routers will need to add a label when entering “MPLS area” and remove that label after leaving there.

The idea of label switching is to have only the first router do an IP lookup and assign a label, then all future routes in the network can “cheat” by doing exact match “switching” based on a label. This would reduce load on the core routers, where high-performance was the most difficult to achieve, and distribute the routing lookups across lower speed edge routers.

In a traditional IP network:
* Each router performs an IP lookup (“routing”), determines a next-hop based on its routing table, and forwards the packet to that next-hop.
* Rinse and repeat for every router, each making its own independent routing decisions, until the final destination is reached.
MPLS does “label switching” instead:
* The first device does a routing lookup, just like before.
* But instead of finding a next-hop, it finds the final destination router.
* And it finds a pre-determined path from “here” to that final router.
* The router applies a “label” (or “shim”) based on this information.
* Future routers use the label to route the traffic without needing to perform any additional IP lookups.
* At the final destination router, the label is removed and the packet is delivered via normal IP routing.

Therefore in an MPLS network, data packets are assigned labels. Packet-forwarding decisions are made solely on the contents of this label, without the need to examine the packet itself.

Cisco Express Forwarding (CEF) table

To enable MPLS on a Cisco router, we must turn on CEF first so let’s analyze what lies inside a CEF table.

As you know, router uses routing protocols (like OSPF, EIGRP, RIP…), static routes and connected routes to create the Routing table (or Routing Information Base – RIB). When CEF is enabled, the router uses this table to create a more optimized table, called Forwarding Information Base (FIB), which contains the next hop and outgoing interfaces of specific routes. Although FIB table does not differ much from RIB table but the router only spends very little time to find the correct entry, resulting in a smaller forwarding delay and more packets can be proceeded per second.

Below shows the topology of a small network and the output of the “show ip cef” command on R1 router.



CEF (FIB) table of R1

Of course CEF table is clearer than Routing table as you can see below


Routing table of R1

How MPLS forward packets

MPLS forwards packets based on the Forwarding Information Base (FIB) and Label Forwarding Information Base (LFIB) tables. FIB and LFIB have all necessary label information as well as the outgoing interface and next-hop information.

FIB: As said above, router uses CEF to create this table. In most cases, the ingress router uses this table for incoming unlabeled packets. The router matches the destination IP address to the best prefix (network) it has in the FIB. It then injects a label and forwards that packet.

LFIB: Used by the core MPLS routers (which are not ingress and egress MPLS routers). They compare the label in the incoming packet with the label they have in their LFIB. If a match is found, the routers forward that packet based on that match. If not, the packet will be dropped. The LFIB is created by the LIB and FIB tables.

Note: All routers in MPLS domain have both FIB and LFIB tables but only edge routers use FIB (ingress router uses FIB, egress router uses LFIB and FIB)


The LIB table holds all the labels known to the LSR and associated information that could possibly be used to forward packets. However, each LSR must choose the best label to use so FIB and LFIB contain only labels of best paths. To choose the best label, LSRs rely on the routing protocol’s decision about the best route.

Label Switch Router (LSR) refers to any router that has awareness of MPLS labels, for example routers R1, R2, R3 and R4 in the below example. The entry and exit routers of an MPLS network are called edge LSR (or label edge routers – LER), which, respectively, inject (push) an MPLS label onto an incoming packet (label assignment) and remove (pop) it off the outgoing packet (label removal). An edge LSR is often a high-speed router device in the core of an MPLS network that participates in the establishment of Label Switched Paths (LSP) using the appropriate label signaling protocol and high-speed switching of the data traffic based on the established paths. In the below example, R1 and R4 are edge LSRs (LERs).

When a network’s inbound router receives traffic, it inserts an MPLS label between the IP packet and the appropriate Layer 2 header for the physical link. The label contains an index value that identifies a next-hop address for the particular LSP. When the next-hop transit router receives the packet, it uses the index in the MPLS label to determine the next-hop address for the packet and forwards the packet to the next router in the LSP.


In this example, when R1 receives a packet with a destination of it first performs a routing lookup and assigns “label 2” to this destination and forwards it to R2. R2 checks its Label Forwarding Information Base (LFIB) table and sees that the “outgoing” label of label 2 is label 7. It swaps label 2 with label 7 and forwards it to R3. R3 acts similarly to R2 and swaps label 7 with label 4 and forwarding it to R4. The edge router R4 removes that label and does a routing lookup to find and forward that packet to its next hop. The whole process is summarized below:

1. After OSPF convergence, all routers have information about network and this information is placed in the RIB.
2. On R1, the label distribution protocol (LDP) assigns the label 11 to the network and advertises the label to its neighbors.
3. Other routers running OSPF also have information about this network so they use their own LDP to assign a label to this network. They also advertise it to other neighbors by using LDP. For example, R2 advertises to R1 (and R3) that it uses label 2 for the network R1 receives this information and marks it as the outing label. R3 does not use this label but it also save this label in its LIB. R3 also advertises to R2 (and R4) it uses label 7 for this network. R4 advertises to R3 it uses label 4 for this network. Notice that labels are stored in the LIB.
4. Each router uses information about the network, local label and outgoing label to build the LFIB.

Now when an incoming packet to the destination arrives, the ingress router lookup in the FIB table and it learns this packet should be labeled 2. The router pushes lable 2 to that packet and forwards it to the outgoing interface to the downstream router (R2 in this case).

R2 receives a labeled packet so it lookups in the LFIB, swaps the label 2 with label 7 and forwards it to the outgoing interface. Other core LSRs proceed incoming labeled packet in the same way as R2.

The packet continues traveling to the egress LER. Because egress LER receives a labeled packet so it lookups in its LFIB table too. In the LFIB, router R4 learns that label 4 is assigned to an implicit-null (or pop label) so the router removes (pop) the label and forwards that packet to the network

That is all the theory. Now let’s return to our simple example with 3 routers to see what are actually inside these tables.



LIB table of R1


LFIB table of R1

MPLS key points

  • Assignment of a particular packet to a particular FEC is done just once, as the packet enters the network.
  • Packets are “labeled” before they are forwarded to the next hop.
  • All forwarding is driven by labels.
  • No further analysis of the packet’s network layer header at subsequent hops.
  • Label is used as an index into a table which specifies the next hop and a new label. The old label is swapped with the new label and the packet is forwarded to its next hop.

It’s important to think of MPLS as having two components, the control plane and data plane. LDP is mainly used for the control plane to exchange labels. From the control plane we can build the data plane. On cisco routers this is CEF table.

Control plane: Exchanges Layer 3 routing information and labels; contains complex mechanisms to exchange routing information, such as OSPF, EIGRP, IS-IS, and BGP, and to exchange labels; such as LDP, and RSVP

Data plane: Forwards packets based on labels; has a simple forwarding engine

Comments (24) Comments
Comment pages
1 2 3958
  1. Bekarion
    July 30th, 2018

    Guys someone send me icnd2 dumps please

  2. Anonymous
    August 1st, 2018

    cavidismayilade7 @ gmail.com send me dump

  3. jack
    August 4th, 2018

    pls send me ccna dump here ngyongann @hotmail.com

  4. Layla
    September 5th, 2018

    I checked various audio lectures & video lectures for the preparation of CCNA 200-125 exam but that all was in petty. Then I got CCNA 200-125 PDF on braindumpscerts.com by learning this study material I passed my exam. The biggest advantage is a 100 % success rate. Practice questions format & quality of content is amazing. I got 90% marks. Thanks to braindumpscerts.com

  5. Shah Alam
    September 30th, 2018

    Please send me CCNA 200-125 Latest Dumps.

  6. Anonymous
    October 5th, 2018

    Anyone mind sending me the 200-125 question dumps? brandyncain17gmail.com? Thanks again!

  7. hi all
    November 7th, 2018

    9tut September 2018 dump is still valid. my two friends took this exam last week with above 900 marks. they only prepared that dump. cheers guys

  8. Ray
    November 8th, 2018

    any one has 200-125 question dumps? r_l_w_k yahoo.com, thanks for the help.

  9. mahlatsi
    November 12th, 2018

    can you please send me ccna valid dump guys my email is {email not allowed}

  10. Jeff
    November 21st, 2018

    Hi Guys,
    Anyone please forward me the valid dump for 200-125 to {email not allowed}

    May god bless all.
    Thank you very much.

  11. Simon
    November 27th, 2018

    Hi Guys,
    Anyone please forward me the valid dump for sopprusbarbosa at gmail dot com

  12. Bill Gates
    December 9th, 2018

    Please send me dumps of CCNP Tshoot and CCIE written for free ….

  13. Ciscology
    December 10th, 2018

    Useful information. Thank you 9tut

  14. malik
    January 13th, 2019

    can someone share latest dump ccna question for me.. to aizen8811hotmail.com.. appreciate it.

  15. Anonymous
    February 17th, 2019

    please help with ccna composite {email not allowed}

  16. jurmala78at.comast.net
    February 17th, 2019

    please e
    send ccna dumps

  17. hamada.15@live.com
    February 27th, 2019

    Pls can any one send me the lasts dumbs in my email {email not allowed} i will enter the exam after 2 weeks

  18. hamada.15@live.com
    February 27th, 2019

    Pls can any one send me the lasts dumbs in my email { hamada.15 @ live.com } i will enter the exam after 2 weeks

    April 28th, 2019

    Please give me adress where I can subscribe on 9tut.con
    I want update my CCNA
    {email not allowed}

  20. Verizz
    May 6th, 2019

    HERE YOU GO. Pass examS.

    CCNA 200-125
    CCNP ROUTE 300-101
    CCNP SWITCH 300-115
    CCNP TSHOOT 300-135
    CCIE R&S 400-101

    R E M O V E-S P A C E S

    c b . l k / 4 N f J Y

  21. chiraphat091@gmail.com
    May 12th, 2019

    Pls can any one send me the lasts dumbs in my email {chiraphat091 @ gmail.com } i will enter the exam after 2 weeks

  22. nickojam
    June 23rd, 2019

    please.. i failed in my first ccna 200-125 exam. Exam fee is difficult in my situation.. I will retake exam soon.. please to whom kind hearted, help me with the latest dumps.. nickojamkoh2914 @ gmail.com

  23. please clarify
    June 27th, 2019

    The below is from the example from the tutorial. Can please please clarify if is the same as Is this a typo?

    ***1. After OSPF convergence, all routers have information about network “” and this information is placed in the RIB.
    2. On R1, the label distribution protocol (LDP) assigns the label 11 to the network “” and advertises the label to its neighbors.***

    thank you!!

  24. Seth
    August 22nd, 2019

    hi ?@Layla I hope you doing fine. I am currently preparing for my CCNA exams. Would mind sharing with me PDF study material you used my email address is {email not allowed} Thanks in advance.

Comment pages
1 2 3958
Add a Comment