1] Discovery messages : - Announce and sustain an LSR's presence in the network
2] Session messages : - Establish, upkeep, and tear down sessions between LSRs
3] Advertisement messages : - Advertise label mappings to FECs
4] Notification messages : - Signal errors
All LDP messages follow the type, length, value (TLV) format. LDP uses TCP port 646, and the LSR with the higher LDP router ID opens a connection to port 646 of another LSR:
1] LDP sessions are initiated when an LSR sends periodic hellos (using UDP multicast on 220.127.116.11) on interfaces enabled for MPLS forwarding. If another LSR is connected to that interface (and the interface enabled for MPLS), the directly connected LSR attempts to establish a session with the source of the LDP hello messages. The LSR with the higher LDP router ID is the active LSR. The active LSR attempts to open a TCP connection with the passive LSR (LSR with a lower router ID) on TCP port 646 (LDP).
2] The active LSR then sends an initialization message to the passive LSR, which contains information such as the session keepalive time, label distribution method, max PDU length, and receiver's LDP ID, and if loop detection is enabled.
3] The passive LDP LSR responds with an initialization message if the parameters are acceptable. If parameters are not acceptable, the passive LDP LSR sends an error notification message.
4] Passive LSR sends keepalive message to the active LSR after sending an initialization message.
5] The active LSR sends keepalive to the passive LDP LSR, and the LDP session comes up. At this juncture, label-FEC mappings can be exchanged between the LSRs