Preface

To understand how things work in an MPLS network, we need to have an overview of the protocols and components part of the MPLS network. With this thought process in mind, we have already discussed the concept of IP Routing Tables (RIB & FIB) used for IP packet forwarding and have also covered the basics of Multiprotocol Label Switching (MPLS) in the earlier articles. In this post, we will talk about an important protocol i.e. Label Distribution Protocol (LDP) that takes care of label generation and distribution in the MPLS network. 

Introduction

For MPLS networking to work, there are two protocols required. An Internal gateway protocol (IGP) and a protocol that provides labels (LDP is one) and distributes them among the routing devices.

Internal gateway protocols help in calculating all the possible paths between a source and a destination in the MPLS network. They are also used in determining the best route among them. 

The “Internal” word comes from the fact that these protocols act within a network (MPLS network of a Service provider.) OSPF and IS-IS are commonly used IGPs. The protocol that works between two networks is called an External gateway protocol (EGP). BGP is the most commonly used EGP. Remember, each routing protocol has its own RIB and tries to install the best route for a destination prefix in the Global IP Routing Table.

The other MPLS driver is a label generation and distribution protocol. Label Distribution Protocol (LDP) is the most popular protocol in this category. Protocols like Targeted Label Distribution Protocol (TLDP) and Resource Reservation Protocol for Traffic Engineering (RSVP-TE) perform similar functionality. But, we will focus on LDP in this article.

A Quick Recap on MPLS

As we discussed in our previous article, MPLS makes use of an MPLS header for traversing the network. MPLS header contains a label value, a “label” ( integer value), and values like QoS, TTL, and Bottom of Stack. The MPLS header lies between the L2 and L3 headers inside the MPLS network. When an IP packet enters the LER (label edge router), a label is attached and sent forward to the neighboring LSR (label switch router) that swaps the label and forwards it to the next LSR. The process continues until the MPLS label/header is stripped off (popped) from the IP packet at the edge of the MPLS network.

The use of labels in forwarding the IP packets is much more efficient than forwarding the packets using IP lookup. In IP lookup, it is required to fetch the destination address from the packet and perform the lookup in the routing tables to find the forwarding information.

We have also talked about various IP forwarding mechanisms in an earlier post. CEF (Cisco Express Forwarding) is the most efficient forwarding mechanism and is used extensively in Cisco devices. The other device vendors also follow a similar concept for their devices.

The swapping of the label is not the only function that is performed in the MPLS network. There are other functions like Popping (MPLS header and thus label is removed from the IP packet) and Stacking where an MPLS packet is encapsulated within another MPLS packet (used for Tunnel purposes).

What is Label Distribution Protocol (LDP)?

Label distribution protocol is the most commonly used protocol in the MPLS network. It helps in the generation and distribution of labels and thus aids in MPLS packet switching and forwarding. Using LDP, we can map the L3 routes with the Layer 2.5 (MPLS) labels. For LDP to work, MPLS and IGP should be enabled on the interfaces of the MPLS nodes.

If it is a Cisco device, CEF should be enabled as it builds up the Forwarding Information Base (FIB). It plays a crucial role in the creation of LFIB and therefore acts as a base for MPLS functionality.

How the Label Distribution Protocol (LDP) works?

LDP can be enabled on all interfaces or specific interfaces. Once enabled, the Label Distribution Protocol automatically generates and distributes the labels between the LDP peers within an MPLS network. LDP is enabled on both LERs and LSRs. 

LDP neighbor adjacency is established between the two routers if they have LDP enabled and can exchange the label information. The adjacency is a pre-requisite for exchanging the label information.

Before LDP, Tag Distribution Protocol (TDP) was used.

LDP together with IGP routes creates label-switched paths (LSPs) between a source node and a destination node within the MPLS network. LSP could be a simple path between the directly connected routers, or a path connecting the source and destination nodes via intermediary nodes.

An LSP is unidirectional, so if we have an LSP between source A and destination B with data flowing from A to B, we will need to have another LSP between A and B with data flowing from B to A. The paths of both LSP may not be the same.

LDP can also be considered as a signaling protocol that signals the establishment of an LDP session between two routing nodes to start exchanging labels. A TCP-based LDP session between the routing nodes is required for the exchange of label information. Make sure that apart from MPLS and IGP, LDP is also enabled on the device.

Let us go through what operations are performed and which messages are exchanged between the routing nodes when LDP is enabled.

Label Distribution Protocol Operations

Image 1 – LDP Operations

Label Distribution Protocol (LDP) Discovery and Hello Adjacency (Hello Message)

When Label Distribution Protocol is enabled on a router, a hello message is sent by that router to the neighboring routers that also have LDP enabled. Refer to Image 2. The Hello messages/packets are sent over the UDP. The Hello messages are also called discovery messages as their main function is to find the peer routers that also have LDP enabled.

The other point to note is that the Hello messages are sent to the LDP port 646 and multicast IP 224.0.0.2 which is the group multicast address for all the routers in a subnet. The LDP Hello messages are sent via the MPLS-enabled interface.

The Hello message contains information like Router ID (4 bytes), which is by default the highest loopback IP on the router. If there is no loopback interface, the Router ID is the highest IP address of a physical interface. This Router ID can also be changed but it has to be unique. The other information is label space (2 bytes) which tells whether the labels exchanged will be per-platform (the value is 0) or per-interface (values are non-zero.) 

LDP Discovery, Hello Adjacency, and Hello messages

Image 2 – LDP Discovery & Hello Adjacency

Router ID and Label Space ID combine (Router ID:Label Space ID) to form a six octet LDP ID (LDP Identifier) which is exchanged between the routers and identifies the label space of the particular LSR. If multiple label spaces are to be advertised, different LDP Identifiers should be used for each label space.

per-platform and per-interface

per-platform label space relates to the same set of labels for all interfaces between the neighboring LSRs, thus only 1 LDP session will suffice. In this, a single label is assigned for a destination network and advertised to all neighbors.

Per-platform label space in LDP

Image 3 – Per-platform label space in Label Distribution Protocol

per-interface label space relates to label binding to a specific interface. In per-interface mode, one TCP session for each interface is necessary. In this, different labels are assigned a per-interface basis.

Per-interface label space in label distribution protocol.

Image 4 – Per-interface label space in Label Distribution Protocol

Extended Discovery Mechanism

An Extended Discovery Mechanism is used when an LDP session needs to be established between non-directly connected neighbors. The hello packets are sent over UDP to the targeted node. But, this hello message is unicast rather than multicast that we use for directly connected LSR’s.

Session Establishment

Once the hello messages are successfully exchanged, the LDP session establishment process starts.

To establish the TCP session (will see in the section below), each router must learn the other router’s transport address. The transport address is the IP Address on the router over which the LDP session will run. The transport address is part of the LDP Hello message and is the address on the router on which TCP connection is established. This can be the loopback IP.

The transport IP address should be advertised via Interior Gateway Protocol (IGP) so that the IP is reachable to exchange labels. If the transport IP address is not advertised, then LDP neighbors shall send Hello messages but will not form the LDP neighbor adjacency.

If loopback IP has /24 network prefix and the IP is also designated as the transport address, then LDP will advertise the same network prefix. However, IGP (specifically OSPF), will advertise the loopback address with /32 as the default mechanism, and thus there will be a disparity. In such a case, both the loopback address and transport address should have the same network prefix. Using CLI commands, we can ask OSPF to advertise the actual network prefix rather than /32.

Label Distribution Protocol (LDP) Session Establishment (Initialization & KeepAlive messages)

The LSR’s must establish a TCP session between them before they can establish an LDP session. The TCP session enables the routers to exchange the label advertisements needed for the MPLS functionality. The following is what happens once the Hello Adjacency is established between the peers.

Label Distribution Protocol Session Establishment Messages and LDP adjacency.

Image 5 – LDP Session Establishment Messages and LDP adjacency.

Refer to Image 5.

Active LSR
  • A Label Switch Router LSR A will try to establish a TCP session with its peer (LSR B) using the source address as transport address IP that was exchanged in the Hello packets.
  • Before anything else, the LSR A will determine which of the routers (LSR A or LSR B) will play an ACTIVE role. The LSR with the higher transport address will become the ACTIVE LSR and will initiate the TCP session. The other LSR will play a PASSIVE role.
  • The ACTIVE LSR (LSR B) will initiate a TCP session with the PASSIVE LSR (LSR A) using the transport address of the PASSIVE LSR and the TCP port as 646.
  • Once the TCP session is established, the ACTIVE LSR will send the LDP Initialization message. The PASSIVE LSR will first check the Hello Adjacency that was established during Hello Messages exchange using the LDP ID that is sent by ACTIVE LSR in the Initialization message.
  • Once the adjacency is verified, the label space is also determined (sent as part of the Hello Adjacency). If the adjacency is not found, a Session Rejected / No hello error message is sent back.
Passive LSR
  • The PASSIVE LSR then checks if the parameters (like LDP version, advertisement method, timer values, etc.) sent by the ACTIVE LSR in the LDP Initialization message can be accepted. The PASSIVE LSR will need to accept and choose the parameter options in order for the process to move ahead.
  • Once PASSIVE LSR finds the parameters to be acceptable, it sends back its own Initialization message containing parameters it wishes to use for the LDP session. It also sends a KeepAlive message that helps ACTIVE LSR identify that the PASSIVE LSR accepted the Initialization message and parameters.
Active and Passive LSR
  • When ACTIVE LSR receives the Initialization message from PASSIVE LSR, it verifies the parameters received. 
  • If the parameters are non-acceptable, ACTIVE LSR sends a Session Rejected/Parameters Error notification to PASSIVE LSR and closes the TCP session.
  • If everything is successful, the ACTIVE LSR will also send a KeepAlive message to PASSIVE LSR to acknowledge that the parameters have been accepted.

The successful negotiation of parameters forms the LDP adjacency between the LSRs. The routers can now be called LDP peers and exchange label information. 

Label Advertisement Methods in LDP

The label advertisement method (or distribution method) between the LDP peers is identified during the LDP Initialization messages exchange (where parameters are negotiated). There are two label advertisement methods used in LDP which are discussed below. It should be noted that label mappings are attached to FECs (Destination networks).

Downstream on Demand (DoD)

In DoD mode, an Upstream router part of the LDP session, requests labels for a specific FEC from the downstream router. The request is passed from the upstream router to downstream routers until it reaches the last downstream router (this downstream router is the one that is closest to the destination in the MPLS network. This could be an LSR or LER.)

The downstream router then assigns a label for the destination network and passes the information to the upstream router. Each LSR (upstream router) assigns a local label for the destination network and passes the label information to its upstream router until it reaches the initial LSR that requested the label information.

Working of DoD

Consider Image 6. In the example, LSR A requests label mapping information for 12.12.12.0/24 from its downstream router. The request thus repeats and finally reaches LSR C. LSR C (downstream router closest to destination) then sends the label mapping of value 30 to upstream router LSR B. In simple terms, LSR C is asking LSR B that when a packet meant for the destination network (12.12.12.0/24) arrives on it, send it forward with label value 30 to LSR C. So, label 30 will be the outgoing label for LSR B and Incoming label for LSR C for destination 12.12.12.0/24.

Similarly, LSR B will then assign a local label 20 for the destination network and pass the information to LSR A. Here, LSR B is asking LSR A that when a packet meant for the destination network (12.12.12.0/24) arrives on it, send it forward with label value 20 to LSR B. So, label 20 will be the outgoing label for LSR A and Incoming label for LSR B for destination 12.12.12.0/24.

Downstream on demand (DoD) distribution method in label distribution protocol

Image 6 – Downstream on demand (DoD) distribution method

When an IP packet will arrive on LSR A for the destination 12.12.12.0/24, the label of value 20 will be attached and the MPLS packet will be forwarded to LSR B. LSR B will then check its routing table and verify the entry for label 20. When LSR B will identify that label 20 is for 12.12.12.0/24, it will swap the value 20 with the value 30 and send the packet to LSR C. The LSR C will know that label 30 is for the directly connected destination network 12.12.12.0/24 and will pop (strip off) the MPLS label and send it to the destination.

Downstream Unsolicited (DU)

In this mode, as can be seen in Image 7, a router part of the LDP session, distributes/advertises the label mapping for a destination to its peer routers without the peer routers requesting for the information.

Downstream Unsolicited distribution (DU) method in label distribution protocol.

Image 7 – Downstream Unsolicited (DU) distribution method

The label swapping procedure between the LSRs A, B, & C for network 12.12.12.0/24 will be the same as discussed in the above section of DoD.

Notification Messages

The other messages that play a role in LDP are Notification messages. They provide information about any errors, status messages, acknowledgment messages, etc. Suppose, a FATAL message is received by a router from an LDP peer, then the router can terminate the LDP session with the peer router and restrict any information exchange with the peer.

Label Distribution Protocol (LDP) Commands

The following are some of the Cisco commands that can be used to check the LDP-related information. (Note: the values in the output are just for demonstration purposes.)

show mpls ldp neighbor -> command to see LDP neighbors.

router# show mpls ldp neighbor 11.11.11.11
Peer LDP Identifier: 11.11.11.11:0
TCP connection: 11.11.11.11:646 – 11.12.12.12:65530
Graceful Restart: No
State: Oper; Msgs sent/rcvd: 46/43
Up time: 00:310:20
LDP Discovery Sources:
POS 0/2/0/0
Addresses bound to this peer:
11.11.11.11 11.11.2.1

show mpls ldp discovery -> shows both link discovery and targeted discovery. When no interface filter is specified, this command generates a list of interfaces running the LDP discovery process.

router# show mpls ldp discovery
Local LDP Identifier: 11.11.11.11:0
Discovery Sources:
Interfaces:
POS 0/1/0/0 : xmit/recv
LDP Id: 11.13.13.13:0, Transport address: 11.13.13.13

The transport address can be changed via the command -> mpls ldp discovery transport-address <IP of interface>. The command should be fired under interface config mode.

The command -> no mpls ldp discovery transport-address will remove the transport address advertized.

For more Label Distribution Protocol related commands and configuration, check the links in the Good Reads section below.

LDP and RSVP(-TE)

When we talk about LDP, Resource ReSerVation Protocol (RSVP) sometimes makes into the discussion. It is a signaling protocol. RSVP is configured for reserving resources (bandwidth, etc.) in the path (between Source and Destination Nodes) to achieve a certain QoS (Quality of Service) for application data. 

RSVP is a Transport Layer protocol (not a Routing Protocol) and uses two messages RESV and PATH for its functioning. A PATH message is sent from the Source router to the Destination router to reserve resources for specific application data. This PATH message flows through devices in between Source and Destination routers. After the PATH message reaches the destination router, the RESV message is sent from the destination router towards the source router with the devices in between acknowledging that the resources have been reserved.

Once the RESV message is received by the Source router, it starts sending the application data.

An extension of RSVP i.e. RSVP-TE (where TE is Traffic Engineering) is very popular and is used in MPLS networks. RSVP-TE is commonly used with Point-to-Point LSPs or Tunnels. Using RSVP-TE, the paths between source and destination routers can be engineered to reserve certain resources required to send important application data. RSVP-TE also helps in Fast Reroute (FRR) and Load Balancing in the MPLS network.

While LDP uses IGP for its functionality, RSVP uses a combination of CSPF (Constrained Shortest Path First) algorithm and Explicit Route objects (ERO) for its functionality. Also, the LDP process is initiated by the egress or destination router, while RSVP is initiated by the Source or Ingress Router, though it can be initiated by the destination router too.

Label Distribution Protocol: FAQs

How does Label Distribution Protocol help in the MPLS network?

Label Distribution Protocol (LDP) helps in assigning labels to the routes on each router part of the MPLS core. The labels are called LDP labels or Transport labels in MPLS terminology.

How are label switched paths (LSPs) defined?

Using LDP and Interior Gateway Protocol, Label Switched Paths or LSPs are defined.

What is the pre-requisite for exchanging labels?

LDP Discovery and LDP Session Establishment are the prerequisites after which the labels are exchanged between the nodes.

What is the Transport address?

An IP called the Transport Address is used to create a TCP session between the LDP peers which is further used for exchanging labels.

What are the methods of assigning labels?

There are two methods using which the labels can be assigned: Downstream on Demand (DoD) and Downstream Unsolicited (DU).

Which tables are created when LDP is enabled?

Using LDP, two tables are created i.e. Label Information Base (LIB) and Label Forwarding Information Base (LFIB).

When is RSVP-TE used?

An extension of RSVP i.e. RSVP-TE is used instead of LDP when Traffic Engineering is required in the MPLS network. Traffic Engineering, not limited to, comprises of creating tunnels between the two nodes and allocating resources for the specific traffic data flow.

What are Notification messages in LDP?

Notification messages are sent to the peering nodes when there is an issue with the LDP session on a particular node.

What is the LDP multicast address?

LDP has a multicast IP address: 224.0.0.2 where the Hello messages are sent.

What’s Next?

I hope this article would have given you some insights into the Label Distribution Protocol. The next topic to discuss will be relating to the two routing tables (LIB & LFIB) that are built using the LDP, and are used in the MPLS network for label switching and packet forwarding.

Good Reads & References

  1. Label Distribution Protocol – RFC 5036
  2. MPLS Label Distribution Protocol – Cisco

Images are subject to Copyright @The Unprecedented Cult

CURATED & WRITTEN BY

AYUSH PANDYA
(AUTHOR – THE UNPRECEDENTED CULT)

Ayush Pandya

Author. Blogger. Poet. Lyricist.

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments