LDP Working Mechanism
LDP Overview
LDP defines the label distribution process and messages transmitted during label distribution. LSRs use LDP to map Layer 3 routing information to Layer 2 switched paths, and set up an LSP.
LDP Messages
LDP defines the following messages:
Discovery message: used to announce or maintain an LSR on a network. For example, Hello messages are discovery messages.
Session message: used to establish, maintain, and terminate sessions between LDP peers. For example, Initialization and Keepalive messages are session messages.
Advertisement message: used to create, modify, and delete label mappings for FECs.
Notification message: used to provide advisory and error information.
To ensure the reliability of message transmission, LDP uses Transmission Control Protocol (TCP) transport for Session, Advertisement, and Notification messages. LDP uses User Datagram Protocol (UDP) transport only for transmitting the Discovery message.
LDP Working Process
-
After LSRs send Hello messages to discover LDP peers, the LSRs establish an LDP session. LDP peers periodically send Hello and Keepalive messages to maintain the LDP session.
LDP peers periodically send Hello messages to maintain the adjacency. If an LSR does not receive any Hello message from a peer before the Hello timer expires, the local LSR deletes the adjacency. After the adjacency is deleted, the local LSR sends a Notification message to terminate the LDP session.
LDP peers periodically send Keepalive messages over the LDP session to maintain the LDP session. If an LSR does not receive a Keepalive message from a peer before the Keepalive timer expires, the local LSR terminates the TCP connection and sends a Notification message to terminate the LDP session.
-
After a session is established, LDP peers advertise the mappings between FECs and labels and set up an LSP.
LDP Session Setup
LSRs use LDP discovery mechanisms to discover LDP peers and establish an LDP session. An LDP LSP can be set up to transmit services only after an LDP session is set up.
LDP Discovery Mechanisms
LSRs use LDP discovery mechanisms to discover LDP peers. LSRs can use the following types of LDP discovery mechanisms:
Basic discovery mechanism: used to discover directly-connected LSR peers on a link.
An LSR periodically sends LDP Link Hello messages to implement the mechanism and establish a local LDP session.
LDP Link Hello messages are encapsulated in UDP packets with the multicast destination address 224.0.0.2. If an LSR receives an LDP Link Hello message on an interface, an LDP peer is connected to this interface.
Extended discovery mechanism: used to discover LSR peers that are not directly connected on a link.
An LSR periodically sends LDP Target Hello messages to a specified destination IP address according to the mechanism to establish a remote LDP session.
The LDP Target Hello messages are encapsulated in UDP packets with the unicast destination IP addresses. If an LSR receives an LDP Target Hello message, an LDP peer is connected to the LSR.
LDP Session Setup Process
Two LSRs exchange Hello messages to trigger the establishment of an LDP session.
Figure 3-1 shows how an LDP session is set up.
The LDP session setup process consists of the following steps:
Two LSRs send Hello messages to each other.
Each Hello message contains the transport address (device IP address) that the two LSRs use to establish an LDP session.
The LSR with a larger transport address initiates a TCP connection.
As shown in Figure 3-1, LSR_1 initiates a TCP connection and LSR_2 waits for the TCP connection request.
After the TCP connection is successfully established, LSR_1 sends an Initialization message to negotiate with LSR_2 about parameters used for establishing the LDP session.
These parameters include the LDP version, label distribution mode, Keepalive timer value, maximum packet data unit (PDU) length, and label space.
If LSR_2 accepts parameters in the Initialization message, LSR_2 sends an Initialization message and a Keepalive message to LSR_1.
If LSR_2 rejects the parameters in the Initialization message, LSR_2 sends a Notification message to LSR_1 to stop the establishment of the LDP session.
Parameters in the Initialization message include the LDP version, label distribution mode, Keepalive timer value, maximum PDU length, and label space.
If LSR_1 accepts the parameters in the Initialization message sent from LSR_2, LSR_1 sends a Keepalive message to LSR_2.
If LSR_1 rejects the parameters in the Initialization message, LSR_1 sends a Notification message to LSR_2 to stop the establishment of the LDP session.
After both LSR_1 and LSR_2 have accepted Keepalive messages from each other, an LDP session is established between them.
LDP LSP Setup
LDP peers send Label Request and Mapping messages to advertise FEC-to-label mappings and establish LSPs based on the mappings. Label distribution and management depend on the label advertisement mode, label distribution control mode, and label retention mode.
Label Advertisement and Management
Label Advertisement Modes
An LSR assigns a label to a specified FEC and notifies its upstream LSR of the label. This means that labels are allocated by a downstream LSR and distributed from downstream to upstream.
As described in Table 3-1, two label advertisement modes are available. The label advertisement modes on upstream and downstream LSRs must be the same.
Label Advertisement Mode |
Definition |
Description |
---|---|---|
Downstream Unsolicited (DU) mode |
An LSR distributes labels to a specified FEC without having to receive Label Request messages from its upstream LSR. |
As shown in Figure 3-2, the downstream egress triggers the establishment of an LSP destined for the FEC 192.168.1.1/32 using a host route and sends a Label Mapping message to the upstream transit node to advertise the label of the host route to 192.168.1.1/32. |
Downstream on Demand (DoD) mode |
An LSR distributes labels to a specified FEC only after receiving Label Request messages from its upstream LSR. |
As shown in Figure 3-2, the downstream egress triggers the establishment of an LSP destined for the FEC 192.168.1.1/32 in host mode. The upstream ingress sends a Label Request message to the downstream egress. After receiving the message, the downstream egress sends a Label Mapping message to the upstream LSR. |
When the DU mode is used, LDP supports label distribution for all peers by default. Each node can send Label Mapping messages to all peers without distinguishing upstream and downstream nodes. If an LSR distributes labels only to upstream peers, it must identify its upstream and downstream nodes based on routing information before sending Label Mapping messages. An upstream node cannot send Label Mapping messages to its downstream node. If the upstream/downstream roles change because the corresponding route changes, the new downstream node sends Label Mapping messages to its upstream node. In this process, network convergence is slow.
Label Distribution Control Modes
The label distribution control mode refers to a label distribution method used on an LSR during LSP establishment.
Independent mode: A local LSR can distribute a label bound to an FEC and then inform the upstream LSR, without waiting for the label distributed by the downstream LSR.
Ordered mode: An LSR advertises the mapping between a label and an FEC to its upstream LSR only when this LSR is the outgoing node of the FEC or receives the Label Mapping message of the next hop for the FEC.
Label Distribution Control Mode |
DU Mode |
DoD Mode |
---|---|---|
Independent Mode |
A transit LSR can assign a label to the ingress node without waiting for the label assigned by the egress node. |
The directly-connected ingress transit node that sends a Label Request message replies with a label without waiting for the label assigned by the egress node. |
Ordered Mode |
The LSR (the transit LSR in Figure 3-2) must receive a Label Mapping message from the downstream LSR (the egress node in Figure 3-2). Then, the transit LSR can distribute a label to the ingress node in the diagram. |
The directly connected transit node of the ingress node that sends the Label Request message must receive a Label Mapping message from the downstream (the egress node in the diagram). Then, the transit node can distribute a label to the ingress node in Figure 3-2. |
Label Retention Modes
The label retention mode refers to the way an LSR processes the label mapping received but not immediately used.
The label mapping that an LSR receives may or may not originate at the next hop.
As described in Table 3-3, two label retention modes are available.
Label Retention Mode |
Definition |
Description |
---|---|---|
Liberal mode |
Upon receiving a Label Mapping message from a neighbor LSR, an LSR retains the message regardless of whether the neighbor LSR is its next hop. |
When the next hop of an LSR changes due to a change in network topology, note that:
|
Conservative mode |
Upon receiving a Label Mapping message from a neighbor LSR, an LSR retains the message only when the neighbor LSR is its next hop. |
DU label advertisement mode, ordered label control mode, and liberal label retention mode (default mode)
DoD label advertisement mode, ordered label control mode, and conservative label retention mode
LDP LSP Setup Process
LSP setup is the process of mapping an FEC to a label and advertising the mapping to neighboring LSRs. Figure 3-3 shows how an LSP is set up in DU and Ordered mode.
The LDP LSP setup process consists of the following steps:
By default, upon a route change, if an edge node (egress) finds a new host route that does not belong to any existing FEC, the egress node creates an FEC for the route.
If the egress node has available labels, it distributes a label for the new FEC and sends a Label Mapping message to the upstream node. The Label Mapping message contains the distributed label and FEC.
After receiving the Label Mapping message, the upstream transit node checks whether the sender (egress node) is the next hop of the FEC. If so, the transit node adds the label-to-FEC mapping in the Label Mapping message to its label forwarding table, and then sends the Label Mapping message of the specified FEC to the upstream LSR (ingress).
After receiving the Label Mapping message, the ingress node checks whether the sender (transit node) is the next hop of the FEC. If so, the ingress node adds the label-to-FEC mapping in the Label Mapping message to its label forwarding table. An LSP is established, and the packets of this FEC can be forwarded based on labels.
This process sets up a common LDP LSP. Another type of LSP is the proxy egress LSP. A proxy egress establishes LSPs using routes in which the next-hop addresses are not local addresses. If penultimate hop popping (PHP) is enabled, an LSR at the penultimate hop is a specific proxy egress along an LSP. A proxy egress is configured manually. The proxy egress applies to a network with MPLS-incapable routers or helps load-balance traffic based on Border Gateway Protocol (BGP) routes.
On the network shown in Figure 3-4, LSR_1, LSR_2, and LSR_3 are in an MPLS domain. LSR_4 is not enabled with MPLS LDP or does not support MPLS LDP. If a policy is configured to use all IGP routes to establish LDP LSPs, LSR_3 functions as a proxy egress and becomes the penultimate hop of the route. This allows LSR_1, LSR_2, and LSR_3 to establish LDP LSPs to LSR_4.