The previous lesson ended on a question: who chose labels 58, 31, and 67, and how did the routers agree on them?
The answer is a dedicated protocol: the Label Distribution Protocol (LDP).Automatic Label Selection
LDP starts with a simple rule, shown below:

Figure 1 – Automatic local label selection by LSRs
For every network in its routing table, an LSR automatically picks a label.
This happens only on routers running MPLS.Answer the question below
Where does an LSR find the networks it assigns labels to?
Label Assignment per Router
Follow one network: 192.168.2.0/24, connected to R5.
All five routers have it in their routing table. The first four pick a label for it, and R5 answers differently:
Figure 2 – Local label assignment per router
R1 picked 24,
R2 picked 58,
R3 picked 31,
R4 picked 67,
R5 did not pick a number: it advertises Pop
This pairing of a network and a label is a label binding.
The choice is completely local: each router picks its labels independently.Check it on R1:
R1# show mpls ldp bindings 192.168.2.0 255.255.255.0 lib entry: 192.168.2.0/24, rev 12 local binding: label: 24 remote binding: lsr: 2.2.2.2:0, label: 58The output starts with lib entry. Bindings are stored in the LIB (Label Information Base): the label this router picked, and the labels its neighbors sent it.
The local binding line is R1's own choice: label 24, the same value as in the figure.
The second line holds a label R1 did not pick. Where it comes from is the rest of this lesson.Answer the question below
Which router picked label 31 for 192.168.2.0/24?
Answer the question below
192.168.1.0/24 is directly connected to R1. Which value does R1 advertise for it?
Every router picked its labels.
The next step is to share them with the MPLS neighbours.Labels Remain Local
Each label is known only by the router that chose it.
R2 has no idea that R3 picked 31, and R3 has no idea that R4 picked 67.
Figure 3 – Isolated local labels prior to exchange
Before any packet can flow, the routers must exchange these values.
Answer the question below
Before any exchange, how many routers know R3's label?
The LDP Session
Two neighbors first discover each other with LDP Hello messages, sent as multicast on their MPLS-enabled interfaces.

Figure 4 – LDP Hello neighbor discovery (multicast)
Each Hello also carries the router's LDP ID, the identity it presents to its neighbors.
Once discovered, the two neighbors open a TCP session on port 646, as you can see below.
Figure 5 – LDP TCP session on port 646
The LDP ID also announces the router's label space: one label table for the whole router, or one per interface.
Verify the session on R1:
R1# show mpls ldp neighbor Peer LDP Ident: 2.2.2.2:0; Local LDP Ident 1.1.1.1:0 TCP connection: 2.2.2.2.646 - 1.1.1.1.28914 State: Oper; Msgs sent/rcvd: 34/34; Downstream Up time: 00:12:47 LDP discovery sources: GigabitEthernet0/1, Src IP addr: 10.0.12.2 Addresses bound to peer LDP Ident: 10.0.12.2 2.2.2.2Read the TCP connection line: R2 answers on port 646, R1 uses a random high port. The State is Oper, so the session is up.
40 % Complete: you’re making great progress
Ready to pass your CCNP exam?