Multiprotocol Label Switching (MPLS) is a packet forwarding protocol based on switching labels that are associated with next-hops and layer 3 routing logic. MPLS logic is very similar to multilayer switching, where a routing decision is made once and then flow switched. In the case of MPLS, a packet entering the MPLS domain at an ingress MPLS enabled router will have its layer three header inspected for routing parameters such as destination address, quality of service, priority or any other parameter that may affect the choice of a route. Once the routing engine has determined the best route, the ingress MPLS router will assign the route and label based on the routes forward equivalent class (FEC). Subsequent packets arriving will be label switched providing much improved performance and lower CPU processor overhead.
The core principles here are that, like multilayer switching, the principle of ‘route once, switch many’ is applied to leverage the advantages of high performance layer 2 switching. Cisco, in its implementation of MPLS, utilizes its own proprietary Cisco Express Forwarding (CES) engine as the basis for label switching. Express switching consists of two components:
- A layer 3 routing engine that handles standard routing lookups and maintains a routing table
- Layer 3 forwarding engine, responsible for high performance switching of packets
The layer 3 routing engine builds its routing table using either static routes or an interior routing protocol such as OSPF. The routing table information is used to build a more efficient table called the Forwarding Information Base (FIB). The FIB contains the already predetermined next-hop MAC addresses for all routes, which is a feature of the adjacency table constructed by Cisco Express Switching, and keeps the best most specific routes at the top.
The FIB holds the following information
- Destination network address
- Destination network masks
- Next hop address
- MAC address of next-hop
MPLS checks through the layer three routing table and assigns labels to each route dependent on its Forward Equivalent Class (FEC). Once it has assigned routes to the same FEC by determining the routes forwarding criteria, it assigns each FEC a label.
Many routes can share the same MPLS label as the label is bound to the forwarding equivalent class, so routes in the same class will be routed out the same egress router interface, hence the same next hop label.
MPLS Network Model
A router in an MPLS network has one of two roles,
- MPLS Label Switch Router – deployed in the core of the MPLS cloud
- MPLS Edge Label Switch Router – deployed at the perimeter of the cloud and interfaces with non-MPLS routers.
Sometimes these are referred to as MPLS Provider (P) Routers, and Provider Edge (PE) routers with the interface to the non-MPLS router being a Customer Edge (CE) router.
A LSR operates in the cloud of the MPLS network and only has interfaces connecting with other label routers with either LSR or ELR. An LSR’s job is to construct its routing table using the internal routing protocol and assign each FEC (a group of similar routes) a label. It then exchanges labels with its neighbors. LSRs then forward traffic by label switching. An LSR swaps an ingress label for an egress label and forwards the packet out to the next-hop. In summary an LSR performs two functions:
- Control Plane – swaps routing and label information
- Data Plane – switches and forwards packets based on the labels
An Edge Label Switch Router on the other hand has interfaces with non-MPLS and MPLS neighbors, so it must apply and remove labels as well as perform conventional layer three inspection and routing table look-ups. An Edge Label Switch Router can handle both pure IP packets and IP packets carrying labels. It manages this, because within the Ethernet frame, there is a field called Ether-Type and this is altered to indicate the presence of an MPLS label.
- 0x8847 – indicates a labeled unicast IP packet
- 0x8848 – indicates a labeled multicast IP Packet
The MPLS Label
The MPLS label is basic – unlike the multitude of parameters within the layer 3 header – and is suited for high performance switching.
There are two type of MPLS label
- Frame Mode
- Cell Mode
The frame based MPLS label is used in IP so that is the one this article will consider.
|Label 20 bits||Experimental (QoS) (3 bits)||Bottom of Stack (1 bit)||TTL (8 bits)|
The 32-bit Frame Mode label shown above consists of four parts:
- Label – a 20 bit label (2^20 labels)
- Experimental – Officially unassigned but many vendors use this for QoS using the three bit (0-7) bits to map to layer 2 Ethernet Frame priority, and layer 3, QoS / Differental Service Code Point (DSCP).
- The Bottom of Stack field – this indicated this is the last label in the stack.
- TTL – Time to Live (8 bits) indicates the number of routers this packet can pass through before it is considered stale and dropped. 2^8 = 256 as MPLS is designed to accommodate large global networks.
Label Distribution Protocol (LDP)
LDP is the default distribution protocol. It operates on a hello broadcast on TCP port 646. LDP exchanges labels with other LDP neighbors and builds its label information bases (lIB). Once labels have been exchanged, Label Switch Paths (LSP’s), which are in effect virtual circuits, are constructed from Edge LSR to Edge LSR which traverses the MPLS domain. These are uni-directional hop-by-hop LSPs, because their path was calculated by the routing protocols shortest path calculations. There are explicit LSPs, which are static configurations that do not follow the shortest path as seen by the routing protocol. These are often configured in MPLS Traffic Engineering when a preferred but less optimal path is required.