Home > MPLS Knowledge > Basic MPLS Tutorial

Basic MPLS Tutorial

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

Categories: MPLS Knowledge Tags:
  1. follower of iptut
    May 26th, 2011 at 14:32 | #1

    Very good stuff..Thanks for sharing.

  2. soon2b CCIP
    July 11th, 2011 at 12:56 | #2

    Very informative and helpful.. BIG THANKS!

  3. Kerem
    August 18th, 2011 at 14:59 | #3

    good stauff, Thanks

  4. Prashant
    September 13th, 2011 at 22:19 | #4

    FIB is a part of control plane or Data Plane ,,,,,? pls explain?

  5. usman
    September 26th, 2011 at 15:57 | #5

    FIB is copy of RIB/Routing Table stored in dataplane

  6. Mowgoul
    November 24th, 2011 at 00:46 | #6

    There is an (FIB) error in dataplane/controlplane picture: RIB —> CEF —-> FIB

  7. Deepti
    April 16th, 2012 at 20:09 | #7

    Very informative & to th point….. Thanks a lot 🙂

  8. harsh sharma..punjab
    May 25th, 2012 at 05:45 | #8

    thanks …very clear nd compact info…

  9. Packeteer
    June 16th, 2012 at 00:00 | #9

    In the green and blue image under ‘Label Switch Router (LSR)’ why is router 4 performing Label removal? based on ‘Penultimate Hop Popping’ wouldnt R4 have advertised to R3 that it doesn’t have a label for the route (as it would advertise an ‘implicit-null’ value).

    Therefore R3 would have recieved the packet, removed the label (instead of replacing it) and forward it to R4 which would then just route the packet?

  10. Tahir
    July 18th, 2012 at 22:45 | #10

    @ Packeteer
    Dear all,
    two keypoints must be kept in mind
    1) Label poping is used to pop off the label at penultimate hop for a network directly connected to LSR
    2) Label untaging is done to untag the label at ultimate hop for a network not directly connected to any LSR and definitely outside the MPLS domain.

    In the above example the network is not directly connected to any LSR so untagging will be done instead of PHP (penultimate hop poping).
    Note: label untaging and label poping are two different things.

  11. Propls
    October 11th, 2012 at 21:14 | #11

    I would like to pose a question to clarify something for the “MPLS Domain” image above (with routers R1 thru R4).

    -If R1 is instead “connected to 2 routers”, such as R2 and R5, and both routers (R2 & R5) have information about network, how does R1 choose between R2 and R5?

  12. kumar
    October 16th, 2012 at 09:33 | #12


    Fundamentally routing table will have multiple paths . However when it prepares the Routing Information base or Label Information base ( LIB), the best path is taken into account. therefore we will have single best path in the LIBs. Best path is dependent on the matrix values and algorithms for Routing table that is running in the network (OSPF, EIGRP or BGP).
    Hence best path ( Single Route) will be there to switch the traffic in the router

  13. Think
    November 16th, 2012 at 20:08 | #13

    It will choose the R2? Cuz it’s more closer as well as more faster in reaching out to the R1.

  14. Sanju Yadav
    December 21st, 2012 at 10:19 | #14

    Very usefull information. Thank u soo much.

  15. Tesfaye
    January 2nd, 2013 at 15:50 | #15

    Thank you very much .

  16. Dennis
    January 10th, 2013 at 22:37 | #16

    Excellent explanation. Even a layman like me understands.

  17. BCG
    February 25th, 2013 at 09:58 | #17

    Very Good Tutorial

  18. sanu.pj
    March 2nd, 2013 at 22:49 | #18

    Nice explanation,it’s very good for entering students

  19. Elan
    March 9th, 2013 at 18:15 | #19

    Got a nice idea about MPLS

  20. Hpmpdmje
    April 9th, 2013 at 18:19 | #20

    How many are there in a book? http://community.parents.com/kemijeeun/blog/2013/04/04/little_lolitamodels_in_panties home lolitas welcoms you nice booty but the vid was wack dude must have a small dick cause he has to hold it on and the music suck

  21. Zninloqp
    April 13th, 2013 at 19:41 | #21

    Until August http://www.mindset.co.za/node/11168 pink lolita top 100 This is really sad, they’ve only got one Tranny video on this website…Id like to see some with women though. The whole genre isn’t all that pleasing with there always being men in every scene.

  22. getjoy
    August 6th, 2013 at 01:29 | #22

    How long are you planning to stay here? http://connect.masslive.com/user/rakycilefa/index.html nn home lolitas pics oh yeah that would be a nice cock to suck it out, would love to get that sticky load out of him, love it when the guys let me play with their cock after they shot their load

  23. Brooklyn
    August 17th, 2013 at 20:30 | #23

    I do some voluntary work http://connect.masslive.com/user/qiylokekyfi/index.html pre teen lolita blowjobs now that’s some nasty shit. I would love to find a girl who would let me do things like that to her. You gotta love those German women for their nastiness.

  24. Justin
    August 20th, 2013 at 06:49 | #24

    Where do you come from? http://connect.masslive.com/user/icyoaur/index.html nn loli photo blog The music is goes great with the video. But the slideshow of pics needs taken out. But with the exception of the slideshow of pics, this is the best compilation of cumshots ive ever seen.

  25. Achman
    October 10th, 2013 at 11:32 | #25

    Good but too technical, must be broken down for easy understanding.

  26. Anonymous
    February 11th, 2014 at 20:00 | #26

    download latest dumps from

  27. rsv
    October 28th, 2014 at 20:24 | #27

    good and clear info. any such information on mpls-te. Thanks.

  28. Anonymous
    November 22nd, 2015 at 20:49 | #28

    please why it include network and the destination is

  29. sanu
    April 25th, 2016 at 16:36 | #29

    Really good

  30. Anonymous
    June 24th, 2016 at 01:50 | #30

    Please check typo on DATA PLANE block diagram .. Forwarding Information Base should be FIB, not LIB. Thanks.

  31. cciedumps
    December 29th, 2017 at 01:24 | #31

    latest ccie dumps
    good luck all guys

  32. dumpspro
    January 26th, 2018 at 02:15 | #32