MPLS LDP (Label Distribution Protocol)

(Rene Molenaar) #1

This topic is to discuss the following lesson:

Ldp uses 646 udp for adjacency and tcp 646 for session creation. Would you pleases elaborate
(Edwin P) #2

Very good! Explained in plain english , i wish all IT doc were like this!
Thanks Rene

(saif s) #3

thank u reneeeeee <3


Thanks Rene for the excellent post. bit confused with the LFIB part how it is being built ? if router is learning the same route from the multiple destinations and they have their own labels imposed on it and advertised to our router in that case how router will decide which one to use ?

(Rene Molenaar) #5

Hi Niranjan,

The routing decisions remain the same, we use our routing table for this. Other routers can advertise all the labels they want to us but our local router will decide the path we use, just like with normal routing without labels.


(César S) #6

Hi Rene,

Thanks for a great explanation

Quick question if you do not mind… the prefixes that will be installed on the LFIB, do they need to be learned by the same routing protocol?

I set up the following lab in order to fully understand how it works (I came across a similar setup during one of my mock labs):

Cust1A <-> ISP11 <-> R1 <-> R2 <-> ISP21 <-> Cust1B

  • R1 and R2 are running OSPF and MPLS is enabled (they should be the transport network)
  • ISP11 and ISP21 are running eBGP with R1 and R2 respectively and MP-eBGP between themselves to exchange VPNv4 prefixes
  • VRF Cust1 on ISP11 peers with Cust1A using EIGRP, and the same goes for VRF Cust1 on ISP12 with Cust1b
MPLS labels are exchanged between ISP11 and R1, but they are not installed on the LFIB ("show mpls forwarding-table" on R1 shows "no label" for any destination reachable via ISP11.

If ISP11, R1, R2 and ISP12 run a common protocol (let’s say all of them are in OSPF area 0), everything works fine.

I am looking for further details on the Cisco documentation (I believe this scenario is called Inter-AS MPLS topology), but any comments would be more than welcome

Thanks in advance,


(Rene Molenaar) #7

Hi César,

Do you still have the configs for this setup? I’d like to take a look.


(César S) #8

Hi Rene,

Thanks for your reply

In the end I managed to get it working sending the labels via eBGP:

router bgp 65211
bgp log-neighbor-changes
no bgp default ipv4-unicast
neighbor remote-as 65221
neighbor ebgp-multihop 255
neighbor update-source Loopback0
address-family ipv4
neighbor activate
neighbor send-label

I still need to read a few documents about this topic, but any comments you might have will be more than welcome

Please, find the topology diagram (my previous one was simplified) and the configuration file

Thanks again for looking into this,



lab_config.txt (54.9 KB)

(Venkata K) #9

Hi Rene

Why LDP uses loop back address to form the LDP neighbors?? It can use the phyiscal interface address as we form LDP neighbor ship with directly connected neigbhors only in most of the cases

(Rene Molenaar) #10

Hi Venkata,

This is explained in the following topic:


(Md Arif T) #11

Hi Rene,

Good Day and thanks for your patience to write down valuable and depth discussion in important key point in the computing data communication.

I started study mpls in your document but I have curiosity, how mpls protocols is faster than traditional ospf , is-is,eigrp and so many.

It’s label switching but still using igp routing for label switching PE to PE, So I studied cisco and online documents but i am not that much clear , they said packet strip only one time for final destination then level switched until the destination PE router.

Can you send or post me some discussion about traditional routing systems and mpls mechanism. I am expecting your clear discussion or reference.

Thanks for your good cooperation.

(Rene Molenaar) #12

Hi MD Arif T,

The main difference is that:

  • In MPLS we are switching based on labels.
  • In IP we are routing based on destinations.

Theoretically doing lookups for labels is faster than lookups in the routing table for destinations. I doubt there is much of a performance different nowadays though…keep in mind that MPLS is > 15 years old, back then it might have made more of a difference.

The main advantage of MPLS is that we are able to transport non-IP traffic and we have VPNs.


(Salvatore C) #13

Ciao Rene’,

I really love the way you explain networking topics

just one clarification, to be sure that I’ve properly understood. Some paragraphs before you wrote:

“Since the LIB is built with information from the RIB, we will start with the routing table. Here’s R1”

in this case wouldn’t be more appropriate to show the data from RIB more than the routing table?

Thanks in advance for your answer


(Rene Molenaar) #14

Hello Salvatore,

Glad to hear you like it :slight_smile:

When I’m talking about the RIB (Routing Information Base), then I refer to the global routing table (show ip route). There are some discussions about this as some people don’t see this as the RIB.

The way I see it is that different routing protocols have their own “tables”:

  • BGP: BGP Table
  • RIP: Database

The best routes (based on administrative distance) from different routing protocols are placed in the RIB (routing table), and that’s it. Sometimes people like to call the BGP table the BGP “rib”, the OSPF LSDB the “OSPF RIB” etc. This is confusing.


(Jonathan O) #15

Hi Rene,

I was reviewing Keith Barkers MPLS course and I was a bit confused on one of his “opt out” questions. Which was “LDP and OSPF are both which type of protocols?”. So far the only thing I’ve been able to come up with would be, Link-State. Since they both build adjacencies based on hellos and also both build thier own tables… Would you agree?

(Rene Molenaar) #16

Hi Jonathan,

That is a good question…LDP isn’t a link-state protocol though.

The only similarities I can think of are:

  • OSPF and LDP both use the highest IP address on a loopback interface as the router ID.
  • Both protocols advertise "something". OSPF prefixes and LDP labels.


(sze jie k) #17

Hi Rene,

Thanks for the nice readup.
Though i have not fully understand the workings of MPLS, it seems like the LABELs are build from the routing information available in the routers. (RIB to LIB).

As we know for when multiple routes are available to the similar destination, the route with the least ad/cost is use for routing.

But how about MPLS? how does LDP choose which LABEL to put into the LFIB ?


(Rene Molenaar) #18

Hi Alan,

That’s correct. The information in the RIB is used to build the LIB.

LDP won’t “choose” any routes by itself. The best routes were installed in the routing table and that’s what we will use. For the prefixes you will find in the routing table we will use labels, that’s it.


(sze jie k) #19

Hi Rene,

Thanks for your reply.
As you mentioned, information inside the RIB is use to build the LIB.
So i would imagine to have a LABEL for all the available routes.

e.g. I have 3 best routes to the same destination with rip, eigrp, ospf in the RIB.  via  - rip  via  - eigrp  via  - ospf

q1) Can i check for FIB, does it contain the same amount of available routes as in the RIB ?

q2) if the above is yes, i would believe FLIB and FIB would have the same amount of labels ?

q3) it is said that in MPLS, the LABELs are use to do switching/routing from Source to Destination and it is faster because there is no need to do best route selection using the IP headers. – is this true ?
But how do we ensure that the LABELs being used (added) and the next hop to send to represent the best routing path available ?

or to put it in another way

- in normal routing, best route selection is done via (ad, metric, prefix length)…
- in mpls, since all available routes will have a tag, how does the router know which tag to use (without looking at the routing table for the best route) ?


(Rene Molenaar) #20

Hi Alan,

If OSPF, EIGRP and RIP have learned the route then only one will be installed in the routing table. EIGRP will be selected since it has the lowest administrative distance.

By default, LDP will generate a label for each route in the routing table. This is something that you can change by using access-lists if you want.

The LFIB has pretty much the same information as the FIB, however some entries in the FIB (like directly connected interfaces) won’t show up in the LFIB.

Theoretically, switching based on labels is faster than routing where we do a lookup for the IP destination. Nowadays this doesn’t matter much. Keep in mind MPLS is already quite old.

The RIB only has the best routes in it, the FIB is built with information from the RIB. That’s why you know that we also use the best path with label switching. Labels are advertised between routers, that’s how they know which label to use.

If you want to see this in action, boot a couple of routers and configure OSPF on EIGRP on them…advertise some loopbacks. Then enable MPLS on the interfaces and take a look at the different tables:

  • show ip route = RIB
  • show ip cef = FIB
  • show mpls ldp bindings = LIB
  • show mpls forwarding-table = LFIB