LDP Operation
LDP Operation
LDP Operation
1) LDP Discovery:
There are two types of LDP discoveries-
● A basic discovery mechanism used to discover directly connected LSR neighbors
In basic discovery mechanism, an LSR sends out periodic Hello messages as UDP
packets to “all routers on this subnet” i.e. 224.0.0.2 to discover neighbors. The Hello
messages contain the LDP Identifier (Router ID: Label Space) it intends to use with other
information. The LDP ID is a 6-byte value with 4-byte Router ID and 2-byte Label
Space.
The 4-byte Router ID is configurable. By default, the Router ID is the highest Loopback
interface on the router or in case the Loopback interface is not present, the highest active
interface. Router ID can be configured using mpls ldp router-id <intf-type>
<intf-number> [force] command.
The 2-byte Label Space indicates per-platform or per-interface label space. If the value is
0, it indicates per-platform label space. If the value is non-zero, it indicates per-interface
label space.
To view LDP discoveries on all interfaces, use show mpls ldp discovery [detail]
command. The output also shows the Hello and Holdtime intervals.
The show mpls interfaces command provides a concise view of which interfaces are
running LDP.
To change the interval between sending Hello messages or change the Holdtime interval,
use mpls ldp discovery {hello {holdtime | interval} command from global configuration
mode. The default Hello interval is 5 seconds. The default Holdtime is 15 seconds and
default interval value is 5 seconds.
If two LDP peers are configured with different Holdtime values, then the smallest value
of the two is used between them.
In extended discovery mechanism, an LSR sends out Targeted Hello messages as UDP
packets to specific address of the targeted LSR.
The targeted LDP neighborship can be configured using mpls ldp neighbor <ip-address>
targeted ldp command from global configuration mode.
2) LDP Session Establishment:
The exchange of LDP Hello messages between two LSRs (LSR1 and LSR2) results in Hello
adjacency which triggers LDP Session establishment. It is a two step process-
● Transport connection establishment
a. LSR1 attempts to open a TCP session with LSR2. It will use the source address as the
transport address that it used to advertise Hello messages to LSR2. Or it will use the
transport address as the one mentioned using mpls ldp discovery transport-address
<interface name | IP Address> command. These addresses will be advertised in Hello
messages.
b. LSR1 will determine whether it will play active or passive role by comparing the source
address of itself and LSR2 used for TCP connection.
c. If LSR1 is active, it will attempt to establish a TCP connection by connecting to
well-known TCP port (port 646) at transport-address of LSR2. If LSR1 is passive, it waits
for LSR2 to open a TCP connection with itself.
● Session Initialization
After LSR1 and LSR2 establish a TCP connection, they negotiate various session
parameters using Initialization messages. The session parameters include LDP protocol
version, label distribution method, timer values, VPI/VCI values for LC-ATM, DLCI
range for label controlled FR, etc.
ii) If it finds a matching Hello adjacency, the adjacency specifies the local label space for
the session. Next, it checks whether the session parameters are acceptable. If yes, it
replies with an Initialization message of its own with its own session parameters and a
Keepalive message to notify that it accepts the session parameters. If the parameters are
not acceptable, it responds with a Session Rejected/ Parameters Error Notification
message and closes the TCP connection.
iii) If it cannot find a matching Hello adjacency, it sends a Session Rejected/ No Hello
Error Notification message to LSR2 and closes the TCP connection.
iv) If LSR1 receives a Keepalive message in response to its Initialization message, the
LDP session is operational.
v) If LSR1 receives an Error Notification message, LSR2 has rejected LSR1’s session
parameters and LSR1 closes the TCP connection.
ii) If LSR1 receives an Initialization message, it checks for session parameters. If they are
acceptable, it sends a Keepalive message; otherwise, replies with a Session Rejected/
Parameters Error Notification message and closes the TCP connection.
An LSR throttles its session setup attempts with an exponential backoff in situations
when Initialization messages are negatively acknowledged. In Cisco IOS, the throttled
rate can be controlled using mpls ldp backoff <initial-backoff> <maximum-backoff>
command. By default, initial-backoff value is 15 seconds and maximum-backoff value is
120 seconds.
3) Maintaining Hello Adjacencies:
LDP uses the regular receipt of LDP Discovery Hello messages to indicate a peer’s intent to use
a label space identified by a Hello. An LSR maintains a Hold Timer for each Hello adjacency
which it resets with every arrival of Hello for that particular adjacency.
If the timer expires, LDP concludes that the peer does not wish to label switch with that label
space or the peer is dead. The LSR then deletes the Hello adjacency which results in the LSR
terminating the LDP session by sending a Notification message and closing the TCP connection.
4) Maintaining LDP Sessions:
After an LDP session is established, an LSR maintains the integrity of the session by sending
Keepalive messages every 60 seconds by default. The Keepalive timer for each peer session
resets whenever it receives any packet on that session. If the Keepalive timer expires (180
seconds by default), LDP concludes that the TCP connection is bad or the peer is dead.
An LSR can terminate the LDP session at any stage by sending a Shutdown message to its peer.
To view the LDP session parameters of a neighbor, use show mpls ldp neighbor <ip-address>
detail command. The output shows LDP session Keepalive and Holdtime intervals.
The LDP session holdtime value can be changed using mpls ldp holdtime <value> command.
The default is 180 seconds.
5) Label Distribution and Management:
a) Label distribution methods- There are two types of Label distribution methods-
- Unsolicited Downstream- An LSR distributes label bindings to other LSRs that have not
explicitly requested them.
- Downstream-on-demand- An LSR requests a label binding for a particular FEC from its
next-hop LSR.
An LSR may run both these methods as it depends on the type of interfaces which are supported
by a particular implementation.
b) Label Retention modes- There are two types of label retention modes-
- Liberal- An LSR retains all the label bindings for a particular FEC that it receives from
different LSRs which are not its next-hop LSRs.
-Conservative- An LSR discards label bindings that are received from LSRs that are not its
next-hop.
Liberal label retention mode adapts quickly to routing changes while conservative label retention
mode requires an LSR to maintain fewer labels.
c) Label Distribution Control modes- There are two types of modes-
- Independent Label Distribution Control mode- When using Independent LSP control, an LSR
can advertise label bindings to its next-hop LSRs at any time.
- Ordered Label Distribution Control mode- An LSR may initiate advertising label bindings to its
neighbor LSRs only if it has received a label binding for that particular FEC from its downstream
LSR, or if it is the egress LSR for that FEC.
6) LDP Identifier and Next-hop addresses:
An LSR maintains learned labels in a LIB. An LIB entry for a prefix associates a collection of
(LDP Identifier, label) pairs with the prefix; one such pair for each peer advertising for that
particular prefix.
The LIB information can be viewed using show mpls ldp bindings command.
To enable an LSR to map between a peer LDP identifier and peer’s addresses, LSRs advertise
their addresses using Address messages. An LSR uses Address Withdraw messages to
withdraw any addresses previously advertised to a peer.
Address messages and Address Withdraw messages:
When a new LDP session is established and before sending Label Mapping and Label Request
messages, an LSR must advertise its interface addresses in one more Address messages. These
interface addresses are called Bounded Addresses.
To view bounded addresses, use show mpls ldp neighbor detail command.