L3 · mpls · reviewed
LDP
Label Distribution Protocol
UDP discovery on 646, then a TCP session that maps FECs to labels so the IGP’s path can be label-switched.
Presenter modeEmbed this figure
Why it exists
MPLS needs a label per FEC at every hop. Without a distribution protocol, operators would provision those bindings by hand. LDP automates the common case: follow the IGP and label whatever it already chose. LDP OverviewRFC 5036 · DRAFT STANDARD · October 2007
It does not engineer paths. That limitation is why RSVP-TE and segment routing exist — they can build a path the IGP would not have picked.
Discover, session, then Label Mapping
Two LSRs find each other with UDP Hellos, open TCP to the transport address, and exchange a Label Mapping that binds a FEC to a label — the same label the MPLS stack will carry.
Both routers send LDP Hello to 224.0.0.2 UDP/646 on the link. Discovery is local; it does not yet mean labels can be exchanged. LSR-A · Lo0 192.0.2.1: Discovery Hello adjacency. LSR-B · Lo0 192.0.2.2: Discovery Hello adjacency. FEC 192.0.2.9/32.
- Link
- Blocking
- Packet in flight
- Discarded
- Emphasis
Text equivalent of this diagram
| Element | Kind | State |
|---|---|---|
| LSR-A · Lo0 192.0.2.1 | router | Discovery: Hello adjacency |
| LSR-B · Lo0 192.0.2.2 | router | Discovery: Hello adjacency |
| FEC 192.0.2.9/32 | cloud | — |
| LSR-A · Lo0 192.0.2.1 — LSR-B · Lo0 192.0.2.2 | link | up |
| LSR-B · Lo0 192.0.2.2 — FEC 192.0.2.9/32 | link | up |
Both routers send LDP Hello to 224.0.0.2 UDP/646 on the link. Discovery is local; it does not yet mean labels can be exchanged.
What changed
- Emphasis: UDP Hello · 646
- LSR-A · Lo0 192.0.2.1: Discovery → Hello adjacency
- LSR-B · Lo0 192.0.2.2: Discovery → Hello adjacency
- Link-local discovery
How it works
Basic discovery uses multicast Hellos on the link. Extended discovery uses targeted Hellos for non-directly connected peers. Either way, the session itself is TCP to a transport address. LDP DiscoveryRFC 5036 · DRAFT STANDARD · October 2007
Once the session is up, Label Mapping messages bind FECs to labels. Independent control lets a router advertise without waiting for downstream; ordered control waits for a mapping from downstream first. Label Distribution Control ModeRFC 5036 · DRAFT STANDARD · October 2007
Liberal retention keeps mappings that are not currently in use; conservative retention discards them. Liberal makes failover faster and uses more label state. Liberal Label Retention ModeRFC 5036 · DRAFT STANDARD · October 2007
On the wire
Constructed examples, encoded from the field table below them — not captured traffic.
- MPLS
- Stacked after the link-layer header, before the inner IP or Ethernet payload. RFC 3032
Configure it
mpls ldp router-id Loopback0 force mpls label protocol ldpStable router-ID from a loopback so Hellos and the TCP session survive interface flaps. `force` applies the change without waiting for session teardown timers on some trains.
RFC 5036 §2.5.2
interface GigabitEthernet0/0/0 mpls ipEnables LDP discovery and label switching on the link. Without this, Hellos are not sent and no session forms for that adjacency.
Common mistake: Enabling MPLS on a link whose IGP adjacency is down — LDP finds no neighbour until the IGP path exists.
RFC 5036 §2.4.1
mpls ldp discovery transport-address interface Loopback0Advertises the loopback as the TCP transport address so the session does not bind to a physical address that can go away.
RFC 5036 §2.5.2
Verify
show mpls ldp neighbor- Neighbour LDP ID and TCP session state (Operational).
show mpls ldp bindings- Local and remote label bindings for FECs.
Caveats
- Marked draft: syntax has not been checked against Cisco documentation or a device.
- LDP labels follow the IGP path; a session alone does not choose traffic engineering.
When it breaks
Symptom first, because that is what you have when it happens.
An LDP session between two directly connected routers will not establish, though the interfaces are up and IGP adjacency is fine.
Narrow it down
- Check whether each router can reach the other’s transport address, which is usually a loopback.
- Confirm the loopback is advertised in the IGP.
- Look at which address each router is advertising as its transport address.
Cause
Discovery happens on the link, but the session is a TCP connection to the transport address. A loopback that is not routable makes discovery succeed and the session fail.
Fix
Advertise the loopbacks and confirm they are reachable. Configuring the transport address explicitly removes the ambiguity on routers with several loopbacks.
Transport Connection EstablishmentRFC 5036 · DRAFT STANDARD · October 2007Traffic is blackholed for a few seconds after a link comes back, on a network where the IGP converges quickly.
Narrow it down
- Compare how long the IGP takes to converge against how long LDP takes to exchange labels.
- Check whether LDP-IGP synchronisation is configured.
- Look for the IGP using a path LDP has no label for yet.
Cause
The IGP converged first and started using a path for which LDP has not yet distributed a label. The packet arrives at a router with no label to push and is dropped.
Fix
Enable LDP-IGP synchronisation, which holds the IGP metric at maximum until LDP is ready on that link.
Labels are missing for some prefixes and present for others, with no pattern in the IGP.
Narrow it down
- Check for a label filtering policy limiting which FECs get labels.
- Confirm whether the router is configured to allocate labels for host routes only.
- Compare the label information base against the routing table.
Cause
Label allocation is filtered. Many designs allocate labels only for loopbacks, because that is all a VPN transport path needs, and anything relying on a label for another prefix then fails.
Fix
Widen the filter, or confirm nothing needs those labels. Allocating for everything wastes label space on large networks, which is why the filter exists.
No LDP neighbour appears on a link that forwards IGP traffic.
Narrow it down
- Confirm LDP is enabled on the interface (or that a targeted session was intended).
- Check for an ACL dropping UDP/TCP 646.
- Verify multicast Hellos are not filtered on the LAN.
Cause
Without a Hello adjacency there is no discovery, so no session and no mappings — even when IP routing looks perfect.
Fix
Enable LDP on the interface or configure targeted Hellos for the non-adjacent case.
Basic Discovery MechanismRFC 5036 · DRAFT STANDARD · October 2007The LDP session flaps while the IGP adjacency stays up.
Narrow it down
- Check Hello hold time versus session KeepAlive.
- Look for TCP resets or MD5 mismatch on the transport connection.
- Confirm whether session protection is configured to ride out brief Hello loss.
Cause
Hellos maintain discovery; KeepAlives maintain the TCP session. Brief Hello loss can tear discovery while the session is meant to survive — or authentication failure resets TCP outright.
Fix
Align timers, fix authentication, and use session protection where brief Hello loss is expected.
Maintaining LDP SessionsRFC 5036 · DRAFT STANDARD · October 2007
Design notes
Discovery proving the link is up does not prove labels can flow. Always verify the TCP session and LIB entries, not only the Hello adjacency.
Allocating labels only for loopbacks is a deliberate scale choice for VPN transport. It is also why a mid-prefix suddenly has no label when someone assumed “LDP labels everything.”
SR-MPLS can replace LDP for the same IGP prefixes by advertising SIDs in the IGP. The MPLS data plane stays; the distribution protocol goes away.
Misconceptions
- “LDP chooses the path.”
- The IGP chooses the path; LDP distributes labels for it. That is why LDP cannot do traffic engineering and why RSVP-TE and segment routing exist — they can build a path the IGP would not have chosen. LDP OverviewRFC 5036 · DRAFT STANDARD · October 2007
- “A label-switched path is signalled end to end.”
- Each router advertises labels to its neighbours independently and the path emerges from the concatenation. Nothing sets it up end to end, which is why a gap in the middle produces a path that exists on both sides of the gap and not through it. Label Distribution and ManagementRFC 5036 · DRAFT STANDARD · October 2007
- “LDP needs its own routing protocol.”
- It has none and needs none. It follows whatever the IGP produced, which is what makes it simple to run and impossible to steer. LDP Identifiers and Next Hop AddressesRFC 5036 · DRAFT STANDARD · October 2007
More walkthroughs
IGP wins the race; labels arrive latefailure
A restored link makes the IGP prefer a path before LDP has exchanged mappings for it. Packets arrive with nowhere to push a label and blackhole until the session catches up — or until sync holds the metric high.
The PE–P1 link returns. The IGP immediately prefers it: lower metric, shorter path. LDP on that link has not finished exchanging mappings yet. PE: IGP next-hop P1. P1 · restored link. P2 · old path. Remote PE.
- Link
- Blocking
- Packet in flight
- Discarded
- Emphasis
Text equivalent of this diagram
| Element | Kind | State |
|---|---|---|
| PE | router | IGP next-hop: P1 |
| P1 · restored link | router | — |
| P2 · old path | router | — |
| Remote PE | router | — |
| PE — P1 · restored link | link | up |
| P1 · restored link — Remote PE | link | up |
| PE — P2 · old path | link | up |
| P2 · old path — Remote PE | link | up |
The PE–P1 link returns. The IGP immediately prefers it: lower metric, shorter path. LDP on that link has not finished exchanging mappings yet.
What changed
- Link PE ↔ P1 · restored link is now up
- Emphasis: IGP ready
- PE: IGP next-hop → P1
- No label yet
Hellos without a sessionfailure
Link Hellos succeed, but the TCP session never establishes because the advertised transport address — a loopback — is missing from the IGP.
Both sides form a Hello adjacency on the LAN. Discovery looks healthy in the neighbour table. LSR-A: Hello Up. LSR-B · Lo0 missing in IGP. Shared LAN.
- Link
- Blocking
- Packet in flight
- Discarded
- Emphasis
Text equivalent of this diagram
| Element | Kind | State |
|---|---|---|
| LSR-A | router | Hello: Up |
| LSR-B · Lo0 missing in IGP | router | — |
| Shared LAN | cloud | — |
| LSR-A — Shared LAN | link | up |
| LSR-B · Lo0 missing in IGP — Shared LAN | link | up |
Both sides form a Hello adjacency on the LAN. Discovery looks healthy in the neighbour table.
What changed
- Emphasis on LSR-A ↔ Shared LAN
- Emphasis on LSR-B · Lo0 missing in IGP ↔ Shared LAN
- LSR-A: Hello → Up
- Discovery only