Label Distribution Protocol (LDP) in MPLS


Today I am going to talk about the LDP in little details. 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 multivendor environment as sometimes CSEs in IOS-XR team are receiving cases, which required troubleshooting of multivendor 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.

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.

Fig 1.1- Sample LDP/TDP protocol in MPLS

As majorly it is broken to two main parts, depends on label distribution protocols, which is being used in MPLS networks:
  1. Label Distribution Protocol (LDP)
  2. Resource Reservation Protocol (RSVP)
But we will discuss on LDP here. We already discussed on RSVP protocol in our earlier article as shown below

Fig 1.2- LDP and MPLS-TE in Cisco IOS and Juniper Junos

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 (224.0.0.2), 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.

Fig 1.3- MPLS Commands in IOS-XR and Junos

let's talk about the configuration part now.

Enters MPLS LDP configuration mode.
RouteXP_router(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).
RouteXP_router(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.
RouteXP_router(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.
RouteXP_router(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
RouteXP_router(config-ldp-af)# label local advertise to <LDP router-ID> for pfx_acl1 
RouteXP_router(config-ldp-af)# label local advertise interface <interface type and number> 


Provides an alternative transport address for a TCP connection.
RouteXP_router(config-ldp-if-af)# discovery transport-address <IP address> 

Configures password authentication (using the TCP MD5 option) for a given neighbor.
RouteXP_router(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).
RouteXP_router(config-ldp-af)# label local advertise explicit-null 

Enables the LDP graceful restart feature.
RouteXP_router(config-ldp)# graceful-restart 

Configures inbound label acceptance for prefixes specified by prefix-acl from neighbor (as specified by its IP address).
RouteXP_router(config-ldp)# label accept for <pfx acl> from <IP address> 

Configures label allocation control for prefixes as specified by prefix-acl.
RouteXP_router(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.
RouteXP_router(config-ldp)# session protection for <peer acl> duration <seconds> 

Enables LDP IGP synchronization for OSPF
RouteXP_router(config-ospf)# mpls ldp sync
RouteXP_router(config-ospf)# area <area num> mpls ldp sync
RouteXP_router(config-ospf)# area <area num> interface <interface type and number> mpls ldp sync   

Enables LDP IGP synchronization for IS-IS.
RouteXP_router(config-isis-if-af)# mpls ldp sync 

Enables LDP auto-configuration.
RouteXP_router(config-ospf)# mpls ldp auto-config
RouteXP_router(config-ospf-ar)# mpls ldp auto-config  

Enables LDP nonstop routing, MLDP and Enables MoFRR support.
RouteXP_router(config-ldp)# nsr 
RouteXP_router(config-ldp)# mldp 
RouteXP_router(config-ldp-mldp-af)# mofrr