LDP labels propagation
LDP is used to exchange, build and maintain labels in MPLS enabled networks and to better understand label propagation, let's have a look at the following diagram
On this diagram we can see six MPLS enabled routers with two /24 networks at the edge. Router 5 and Router 6 (so as the others) start exchanging Multicast UDP Hello messages looking to establish a TCP LDP session with neighbors.
In our example the adjacencies are built over loopback interfaces which, in turn, must be reachable throughout the Core. Here we can use OSPF, IS-IS, EIGRP as an underlay to achieve this.
Once the adjacency is built, routers start building the labels table which, in a nutshell, will look like this:
Router | Prefix | Interface | Local Label | Remote Label |
R6 | B/24 | e.g. Et/1 | 600 | |
R5 | B/24 | e.g. Et/1 | 500 | 600 |
R4 | B/24 | e.g. Et/1 | 400 | 500 |
R3 | B/24 | e.g. Et/1 | 300 | 500 |
R2 | B/24 | e.g. Et/1 | 200 | 300 |
R1 | B/24 | e.g. Et/1 | 100 | 200 |
The most interesting part here is Router 2 making a decision on which label to add to the table (It's getting two for B/24 prefix. One from R4 and one from R3) To make a decision, the router ultimately looks into RIB looking for the exit interface for our prefix (in our case, the one facing R3). Based on that R2 discards label received from R4 and keeps the one received from R3.
ECMP is possible, although not by default and depends on the hardware.
In a similar way, routers exchange labels for prefix A/24.
Once the control plane is converged and Network A starts talking to Network B the following will happen:
- R1 will receive the IP packet, will look into RIB where it will see a reference to an MPLS enabled interface on the way to Network B. At this point it will insert a label tag (200) and forwards on to R2
- R2 will receive the packet, finds a label, swap it for 300 and forwards to R3. The router will not look into IP header and, therefore RIB, thus speeding up processing.
- R3 will, in turn, swap 300 for 500 and forwards to R5
- R5 will swap 500 for 600 and then forward to R6 where the label gets popped and the packet gets forwarded to the destination
