LDP Label Allocation Revisited
One of my readers was having an LDP argument with his colleague:
Yesterday I was arguing with someone who works for a large MPLS provider about LDP label allocation. He kept saying that LDP assigns a label to each next-hop, not to each prefix. Reading your blog, I believe this is the default behavior on Juniper but on Cisco LDP assigns a unique label for each IGP (non-BGP) prefix.
He’s absolutely right; Cisco and Juniper use different rules when allocating MPLS labels.
Cisco IOS allocates a label to every IGP prefix in the IP routing table (not to BGP prefixes). Junos allocates a label to every local loopback interface and to all prefixes that have label assigned by the downstream router, resulting in labels assigned to all loopback interfaces.
Loopback interfaces happen to be BGP next hops in MPLS/VPN environments, and for regular BGP destinations if you’re using next-hop-self on IBGP sessions, so his colleague was probably used to Junos way of doing things.
But then that brings up an interesting question. The max number of labels you can have is close to 1 million (2 to the power of 20) which is not enough if you want to assign a label to reach internet prefix.
Nobody is allocating prefixes to BGP routes unless you’re using send-label with a BGP neighbor. Cisco IOS is using recursive route lookup and uses MPLS label for BGP next hop for BGP prefixes.
I know it’s crazy thought to carry a full Internet routing table in IGP, but assuming that is the case how is LDP going to scale?
Nobody is doing that either. Dumping BGP table into IGP successfully kills every IGP known to mankind at this moment.
I wonder why Cisco chose this approach as the default? Does allocating a label per prefix have some advantages I’m not seeing?
I guess it’s mostly for historic reasons. I don’t see other advantages… and of course I’m probably missing something obvious, so please write a comment and fix it.
As for Alcatel-Lucent routers they also bind labels for "system" ip address and for prefixes with allocated labels from a downstream router http://noshut.ru/2015/06/ldp-ordered-label-distribution-control-explained/
One interesting question I faced when learning LDP is how do routers perform split-horizon? If we have three routers in line (R1-R2-R3) and R1 starts tp propagate label for its lo1=1.1.1.1/32, how would R2 determine not to send it back to R1?
So at the end this label would be ignored on R1 as the path-calculation of the IGP will not use R2 as next-hop for 1.1.1.1/32 as it is directly connected.
Independent label allocation came from the original Cisco TDP. Maybe Bruce Davies could answer what the exact reasoning was. I've heard faster convergence before since the whole network doesn't have to be "up" speaking MPLS before MPLS could be switched.
Sure it does, just look for the "mpls label mode all-vrfs protocol bgp-vpnv4 per-?
per-prefix per-vrf" command and its limitations for different platforms. On MPLS PE routers VRFs there are several limitations once you decide to allocate per vrf or per CE label, you cannot use (e|i)BGP multipath, EIGRP multipath, BGP PIC,CSC scenarios...
This means that the per prefix allocation on Cisco makes use of mpls label switching at the edge, so once you use 1 label to represent more prefixes you need additional lookup at the edge to forward the packet to the correct next hop.
But as you said, if you like to deploy these "advanced" features like BGP PIC, per-prefix is a must.
In real life however it wasn't as clear, Ordered has some issues with convergence time in rings, which led to lot's of mess and some shortcuts in implementations...
Old good times :)