Multiprotocol Label Switching (MPLS) can be used to solve some of the problems associated with traditional destination based IP routing. Due to the hop-by-hop routing paradigm of traditional IP routing, all the routers along the path need to store all the routes in their routing table, which increases the amount of resources necessary on them. The other problem is that every router along the path has to perform a routing table lookup to match the packet with the entry in the routing table using the longest match lookup, which introduces forwarding latency. Also, when multiple paths are available to a particular network, only the path with the best metric is chosen based on the Interior Gateway Protocol (IGP) used. This results in over-utilization of certain paths and under-utilization of other available paths. It also results in sub-optimal routing on hub and spoke networks that use an overlay model such as Frame Relay and ATM, which introduces more hops.
When MPLS is used along with an IGP for unicast IP routing, the routers also exchange labels for the prefixes learned using the IGP. Only the edge router called ingress Label Switch Router (LSR) connected to the MPLS cloud has to perform a routing table lookup to classify the packet and apply the label. The core LSRs inside the MPLS cloud swap the label in the incoming packet with another label and forward the labeled packets toward the next-hop router. The routers at the other edge of the MPLS cloud called egress LSRs receive the labeled packets, remove the label and forward normal IP packets by doing a routing table lookup. The label might also be removed one hop previous to the egress LSR if Penultimate Hop Popping (PHP) is supported so that the egress LSR can do routing table lookup alone. Since the core LSRs do not perform a routing table lookup, it reduces the forwarding latency. MPLS can also solve other problems mentioned earlier by facilitating traffic engineering and cell mode MPLS for ATM.
MPLS can be used along with any protocol as IGP before implementing other applications, but the link state routing protocol's Intermediate System-to-Intermediate System (ISIS) or Open Shortest Path First (OSPF) has to be used as the IGP for the MPLS traffic engineering application.
Before configuring MPLS, configure ISIS or OSPF as the IGP.
To configure ISIS, issue the router isis command in the global configuration mode. Assign the area and system ID by configuring the ISIS Network Entity Title (NET) by issuing the net command under the router configuration mode. Include the interfaces on the router to run ISIS for IP by issuing the ip router isis commands under the specific interfaces.
To configure OSPF, issue the router ospf <x> command in the global configuration mode, where x refers to the process ID on the router. Include the interfaces on the router to run OSPF as part of the area that you require by issuing the network command under the router configuration mode.
Since Cisco Express Forwarding (CEF) is a prerequisite for configuring MPLS on Cisco devices, begin the MPLS configuration by enabling CEF on the routers by issuing the ip cef command in the global configuration mode. Issue the mpls ip command under the global configuration mode as well as under the specific interfaces to enable MPLS. Optionally, issue the mpls label protocol ldp command in the global configuration mode to choose the standards based Label Distribution Protocol (LDP) for label distribution. If this command is not configured, Tag Distribution Protocol (TDP) is used for label distribution and is known as Tag switching, which is Cisco proprietary.
For more information about using ISIS or OSPF with MPLS, refer to these documents: