MPLS basics: LDP ( Label Distribution Protocol) on Cisco IOS-XR devices

As many of you already know about the LDP protocol used in MPLS networks but here in this article I am going to talk about the basics and the configuration of LDP protocol.

LDP stands for Label distribution protocol which almost all of you already knew. LDP is the protocol used for exchanging the Labels in the MPLS network and is one of the backbone for the MPLS networks.

Here in this article we will talk about multi-vendor environment as sometimes CSEs in IOS-XR team are receiving cases, which required troubleshooting of multi-vendor MPLS networks. In this case, it might be helpful to know useful commands in order to configure and check MPLS topology not only on IOS-XR devices, but on devices of another vendor also.

Fig 1.1- MPLS Network
This article contains some IOS-XR MPLS configurations and diagnostics commands, and similar commands, which should be helpful for troubleshooting MPLS network from JUNOS devices point of view.

Label distribution protocols create and maintain the label-to-forwarding equivalence class (FEC) bindings along the label switched path (LSP) from MPLS ingress label-switching router (LSR) to MPLS egress LSR.

As majorly it is broken to two main parts, depends on label distribution protocols, which is being used in MPLS networks:
  • Label Distribution Protocol (LDP)
  • Resource Reservation Protocol (RSVP)
Fig 1.2- IOS-XR vs Junos Configs
Label Distribution Protocol (LDP) in MPLS
Label Distribution Protocol (LDP) have the following characteristics:
  • LDP always follows the best path from IGP point of view
  • LDP does not support traffic-engineering paths
  • LDP executes hop by hop
LDP uses several types of messages in order to establish the session, exchange of label mappings, and to report errors. All messages have the same structure and encoding as Type/Length/Value (TLV):
  • Discovery messages – hello UDP messages, which are sending to 646 port using all-routers multicast address (, or unicast address (used for targeted LDP sessions)
  • Session messages – used for establishing, maintaining and terminating sessions between LDP peers. These messages are sending using TCP protocol as a transport, port 646
  • Advertisement messages – create, change and delete label mappings for FEC
  • Notification messages – for reporting errors and another notifications
Tips for configuration of LDP on IOS-XR devices
Mandatory steps for enabling LDP on IOS-XR device
  • Before implementing any MPLS technologies on IOS-XR devices, you should install composite mini-image and MPLS package.
  • You must activate IGP also.
Configure transit interfaces under MPLS LDP section, or enable MPLS LDP auto-configuration.
let's talk about the configuration part now.


Enters MPLS LDP configuration mode.

NDNA(config)# mpls ldp

Specifies the router ID of the local node. In Cisco IOS XR software, the router ID is specified as an interface name or IP address. By default, LDP uses the global router ID (configured by the global router ID process).

NDNA(config-ldp)# router-id <IP address>

Enters interface configuration mode for the LDP protocol. This is mandatory procedure in order to activate LDP on a specific interface.

NDNA(config-ldp)# interface <interface type and number>

Directs the system to accept targeted hello messages from any source and activates passive mode on the LSR for targeted hello acceptance.

NDNA(config-ldp)# discovery targeted-hello accept

Configures outbound label advertisement control by specifying one of the following options:
interface Specifies an interface for label advertisement. to ldp-id for prefix-acl

NDNA(config-ldp-af)# label local advertise to <LDP router-ID> for pfx_acl1
NDNA(config-ldp-af)# label local advertise interface <interface type and number>

Provides an alternative transport address for a TCP connection.

NDNA(config-ldp-if-af)# discovery transport-address <IP address>

Configures password authentication (using the TCP MD5 option) for a given neighbor.

NDNA(config-ldp)# neighbor <LDP router-ID> password <password>

Causes a router to advertise an explicit null label in situations where it normally advertises an implicit null label (for example, to enable an ultimate-hop disposition instead of PHOP).

NDNA(config-ldp-af)# label local advertise explicit-null

Enables the LDP graceful restart feature.

NDNA(config-ldp)# graceful-restart

Configures inbound label acceptance for prefixes specified by prefix-acl from neighbor (as specified by its IP address).

NDNA(config-ldp)# label accept for <pfx acl> from <IP address>

Configures label allocation control for prefixes as specified by prefix-acl.

NDNA(config-ldp-af)# label local allocate for <pfx acl>

Configures LDP session protection for peers specified by peer-acl with a maximum duration, in seconds.

NDNA(config-ldp)# session protection for <peer acl> duration <seconds>

Enables LDP IGP synchronization for OSPF

NDNA(config-ospf)# mpls ldp sync
NDNA(config-ospf)# area <area num> mpls ldp sync
NDNA(config-ospf)# area <area num> interface <interface type and number> mpls ldp sync  

Enables LDP IGP synchronization for IS-IS.

NDNA(config-isis-if-af)# mpls ldp sync

Enables LDP auto-configuration.

NDNA(config-ospf)# mpls ldp auto-config
NDNA(config-ospf-ar)# mpls ldp auto-config 

Enables LDP nonstop routing, MLDP and Enables MoFRR support

NDNA(config-ldp)# nsr
NDNA(config-ldp)# mldp
NDNA(config-ldp-mldp-af)# mofrr