MPLS Operation
The implementation of MPLS for data forwarding involves the following four steps:
1. |
MPLS label assignment (per LSR)
|
2. |
MPLS LDP or TDP session establishment (between LSRs/ELSRs)
|
3. |
MPLS label distribution (using a label distribution protocol)
|
4. |
MPLS label retention
|
MPLS operation typically involves adjacent LSR's forming an LDP session, assigning local labels to destination prefixes and exchanging these labels over established LDP sessions. Upon completion of label exchange between adjacent LSRs, the control and data structures of MPLS, namely FIB, LIB, and LFIB, are populated, and the router is ready to forward data plane information based on label values.
MPLS Label Assignment
A label is assigned to IP networks reachable by a router and then imposed on data packets forwarded to those IP networks. IP routing protocols advertise reachability to destination networks. The same process needs to be implemented for routers or devices that are part of the MPLS domain to learn about the labels assigned to destination networks by neighboring routers. The label distribution protocol (LDP or TDP) assigns and exchanges labels between adjacent LSRs in an MPLS domain following session establishment. As previously mentioned, labels can be assigned either globally (per router) or per interface on a router.
LDP Session Establishment
Following label assignment on a router, these labels are distributed among directly connected LSRs if the interfaces between them are enabled for MPLS forwarding. This is done either by using LDP or tag distribution protocol (TDP). TDP is deprecated and, by default, LDP is the label distribution protocol. The command mpls label protocol {ldp | tdp} is configured only if LDP is not the default label distribution protocol or if you are reverting from LDP to TDP. The command can be configured in global and interface configuration mode. The interface configuration command will, however, override the global configuration.
TDP and LDP function the same way but are not interoperable. It is important to note that when Cisco routers are in use, the default protocol that is running on an MPLS-enabled interface is dependent on the version of IOS running on the device; care must be taken when configuring Cisco routers in a multivendor environment. TDP uses TCP port 711 and LDP uses TCP port 646. A router might use both TDP and LDP on the same interface to enable dynamic formation of LDP or TDP peers depending on the protocol running on the interface of the peering MPLS neighbor. LDP is defined in RFC 3036 and is implemented predominantly between adjacent peers (adjacencies as defined by the IGP). In some cases, LDP sessions can also be configured between nonadjacent peers, where it is called a directed LDP session, which is covered in more detail in Chapters 11 and 12.
There are four categories of LDP messages:
- Discovery messages – Announce and sustain an LSR's presence in the network
- Session messages – Establish, upkeep, and tear down sessions between LSRs
- Advertisement messages – Advertise label mappings to FECs
- Notification messages – Signal errors
Figure 1-10. LDP Session Establishment
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:
- LDP sessions are initiated when an LSR sends periodic hellos (using UDP multicast on 224.0.0.2) 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).
- 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.
- 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.
- Passive LSR sends keepalive message to the active LSR after sending an initialization message.
- 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.
MPLS Label Distribution with LDP
In an MPLS domain running LDP, a label is assigned to a destination prefix found in the FIB, and it is distributed to upstream neighbors in the MPLS domain after session establishment. The labels that are of local significance on the router are exchanged with adjacent LSRs during label distribution. Label binding of a specific prefix to a local label and a next-hop label (received from downstream LSR) is then stored in the LFIB and LIB structures. The label distribution methods used in MPLS are as follows:
- Downstream on demand – This mode of label distribution allows an LSR to explicitly request from its downstream next-hop router a label mapping to a particular destination prefix and is thus known as downstream on demand label distribution.
- Unsolicited downstream – This mode of label distribution allows an LSR to distribute bindings to upstream LSRs that have not explicitly requested them and is referred to as unsolicited downstream label distribution.
Figure 1-11 depicts the two modes of label distribution between R1 (Edge LSR) and R2 (LSR). In the downstream-on-demand distribution process, LSR R2 requests a label for the destination 172.16.10.0. R1 replies with a label mapping of label 17 for 172.16.10.0. In the unsolicited downstream distribution process, R1 does not wait for a request for a label mapping for prefix 172.16.10.0 but sends the label mapping information to the upstream LSR R2.
Figure 1-11. Unsolicited Downstream Versus Downstream on Demand
MPLS Label Retention
If an LSR supports liberal label retention mode, it maintains the bindings between a label and a destination prefix, which are received from downstream LSRs that might not be the next hop for that destination. If an LSR supports conservative label retention mode, it discards bindings received from downstream LSRs that are not next-hop routers for a destination prefix. Therefore, with liberal retention mode, an LSR can almost immediately start forwarding labeled packets after IGP convergence, where the numbers of labels maintained for a particular destination are large, thus consuming memory. With conservative label retention, the labels maintained are labels from the confirmed LDP or TDP next-hop neighbors, thus consuming minimal memory.