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

LDP OverviewRFC 5036 · DRAFT STANDARD · October 2007Basic Discovery MechanismRFC 5036 · DRAFT STANDARD · October 2007Transport Connection EstablishmentRFC 5036 · DRAFT STANDARD · October 2007Label Distribution Control ModeRFC 5036 · DRAFT STANDARD · October 2007Liberal Label Retention ModeRFC 5036 · DRAFT STANDARD · October 2007

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.

LSR-A · Lo0 192.0.2.1Link-local discoveryDiscovery: Hello adjacencyLSR-B · Lo0 192.0.2.2Discovery: Hello adjacencyFEC 192.0.2.9/32UDP Hello · 646
  • Link
  • Blocking
  • Packet in flight
  • Discarded
  • Emphasis
Select a device to read its state. Arrow keys walk the topology.
Text equivalent of this diagram
Devices and links at this step
ElementKindState
LSR-A · Lo0 192.0.2.1routerDiscovery: Hello adjacency
LSR-B · Lo0 192.0.2.2routerDiscovery: Hello adjacency
FEC 192.0.2.9/32cloud
LSR-A · Lo0 192.0.2.1LSR-B · Lo0 192.0.2.2linkup
LSR-B · Lo0 192.0.2.2FEC 192.0.2.9/32linkup
1 / 4

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.

Outer label 16001 (S=0) toward the egress PE, inner VPN label 5001 (S=1) selecting the VRF.

MPLS
Stacked after the link-layer header, before the inner IP or Ethernet payload. RFC 3032

Configure it

LDP with a loopback transport address and interface enablement.

Cisco IOS-XE 17.12 · ASR 1001-X, ISR 4451draft

  1. mpls ldp router-id Loopback0 force
    mpls label protocol ldp

    Stable 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

  2. interface GigabitEthernet0/0/0
     mpls ip

    Enables 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

  3. mpls ldp discovery transport-address interface Loopback0

    Advertises 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.

  1. An LDP session between two directly connected routers will not establish, though the interfaces are up and IGP adjacency is fine.

    Narrow it down

    1. Check whether each router can reach the other’s transport address, which is usually a loopback.
    2. Confirm the loopback is advertised in the IGP.
    3. 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 2007
  2. Traffic is blackholed for a few seconds after a link comes back, on a network where the IGP converges quickly.

    Narrow it down

    1. Compare how long the IGP takes to converge against how long LDP takes to exchange labels.
    2. Check whether LDP-IGP synchronisation is configured.
    3. 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.

  3. Labels are missing for some prefixes and present for others, with no pattern in the IGP.

    Narrow it down

    1. Check for a label filtering policy limiting which FECs get labels.
    2. Confirm whether the router is configured to allocate labels for host routes only.
    3. 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.

  4. No LDP neighbour appears on a link that forwards IGP traffic.

    Narrow it down

    1. Confirm LDP is enabled on the interface (or that a targeted session was intended).
    2. Check for an ACL dropping UDP/TCP 646.
    3. 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 2007
  5. The LDP session flaps while the IGP adjacency stays up.

    Narrow it down

    1. Check Hello hold time versus session KeepAlive.
    2. Look for TCP resets or MD5 mismatch on the transport connection.
    3. 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.

PEIGP next-hop: P1P1 · restored linkNo label yetP2 · old pathRemote PEIGP ready
  • Link
  • Blocking
  • Packet in flight
  • Discarded
  • Emphasis
Select a device to read its state. Arrow keys walk the topology.
Text equivalent of this diagram
Devices and links at this step
ElementKindState
PErouterIGP next-hop: P1
P1 · restored linkrouter
P2 · old pathrouter
Remote PErouter
PEP1 · restored linklinkup
P1 · restored linkRemote PElinkup
PEP2 · old pathlinkup
P2 · old pathRemote PElinkup
1 / 4

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.

LSR-AHello: UpLSR-B · Lo0 missing in IGPShared LANDiscovery only
  • Link
  • Blocking
  • Packet in flight
  • Discarded
  • Emphasis
Select a device to read its state. Arrow keys walk the topology.
Text equivalent of this diagram
Devices and links at this step
ElementKindState
LSR-ArouterHello: Up
LSR-B · Lo0 missing in IGProuter
Shared LANcloud
LSR-AShared LANlinkup
LSR-B · Lo0 missing in IGPShared LANlinkup
1 / 3

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

Check yourself

  • Discovery works and the session does not establish. What should you check?
  • Who chooses the path a label-switched path follows?
  • Traffic is dropped for a few seconds after a link restores. What fixes it?
  • Why do many designs allocate labels only for loopbacks?
  • What does basic LDP discovery use?
  • What does liberal label retention do?
  • In ordered control mode, when may a router advertise a mapping upstream?
  • How is an LDP LSP established across the network?