MPLS-LDP (Label Distribution Protocol) is a protocol used in MPLS (Multi-Protocol Label Switching) networks to establish label-switched paths (LSPs) between two nodes. It works by exchanging label information between nodes in the network, allowing them to forward packets along a predetermined path. The nodes in an MPLS network are known as Label Edge Routers (LERs). When establishing an LSP, the LERs must be determined so that the path is known.
The LERs are determined by the LDP protocol. When a node in the network wishes to establish an LSP, it sends out an LDP Initialization message. This message contains the IP address of the node that sent it, as well as the IP address of the node that it wishes to establish an LSP with. This is known as the \FEC\ (Forwarding Equivalence Class).
Once the FEC is established, the two nodes exchange LDP Label Mapping messages. These messages contain the labels that will be used to forward traffic between the two nodes. The labels are unique to each node, and are used to identify the LSP. Once the labels have been exchanged, the LSP is established and the two nodes become LERs in the network.
In addition to establishing the LERs in an LSP, the LDP protocol is also responsible for maintaining and updating the LSP. This is done by exchanging LDP Keepalive messages. These messages are sent to ensure that the LSP is still active and that the labels are still valid. If the LDP Keepalive message fails to receive a response, it will tear down the LSP and the two nodes will no longer be LERs.
In summary, the LERs for an MPLS-LDP LSP are determined by exchanging LDP Initialization, Label Mapping and Keepalive messages between two nodes in the network. The labels exchanged in the Label Mapping messages are used to identify the LSP, and the Keepalive messages are used to maintain and update the LSP. Once the LERs are determined, packets can be forwarded along the established LSP.