MPLS Introduction

MPLS stands for Multiprotocol Label Switching. It is often called a layer 2 1/2 protocol as it sits between the data link and network layers. With MPLS, the packets are forwarded by labels instead of by IP addresses. There are many benefits to MPLS, but one of the biggest is that service providers no longer need to run BGP in the core of their network. The Provider Core routers, or P routers, swap MPLS labels based on destination prefix to send packets to their next location. These P routers still need to know the next-hop address of each egress router, but they can learn that via OSPF or ISIS.

An MPLS Label is 32 bits. Those 32 bits are composed of the following:

  • first 20 bits are the label value (value between 0 and )
  • bits 20 - 22 are the three EXP bits used solely for QoS
  • bit 23 is the Bottom of Stack bit - value is 0 unless it is the bottom label on the stack.
  • bits 24 to 31 are the 8 bits used for TTL

A label switch router (LSR) is a router that supports MPLS. 3 types are ingress, intermediate, and egress. An LSR can perform 3 operations: pop, push, or swap. Swap means that when a label stack is received, the LSR swaps the top label with a new label before it is switched on the outgoing link. Swaps are generally performed by the intermediate LSRs. A LSR that pushes labels onto a packet that was not labeled yet is called an imposing LSR, while a LSR that removes all labels from the labelled packet before switching is called a disposing LSR.

There are two terms to know when it comes to the path packets will take across the MPLS network. A label switched path os a sequence of LSRs that switch a packet through an MPLS network. An LSP is always unidirectional. A Forwarding Equivalence Class (FEC) is a group or flow of packets that are forwarded along the same path and are treated the same with regard to the forwarding treatment. All packets belonging to the same FEC have the same label, but not all packets that have the same label belong to the same FEC. The ingress LSR determines which packets belong to which FEC.

Each LSR will have to determine what label a packet should have based on the destination prefix. In addition, adjacent LSRs should be ins sync with regards to which labels they will use for each IGP prefix. A separate protocol is usually implemented to distribute labels. Label Distribution Protocol (LDP) is one such protocol.

The Label Forwarding Instance Base (LFIB) is used to forward labels. All the bindings of labels to prefixes are found in the LIB. The remote label chosen depends on which path is the best path found in the routing table.

The payload behind the MPLS labels is not needed for the P routers, as they only swap the top label and forward the packet on to the next LSR. However, the egress LSRs do need to know about the payload, as they have to strip the final label and pass the packet on to the ensuing protocol. The egress LSR must therefore know what value to use for the Neiwork Level Protocol identifier field in the outgoing frame. SInce the egress LSR created the local binding, it is that LSR assigned a local label to the FEC, so the egress LSR knows what the MPLS payload is by examining the label it created.

CEF switching must be used to label packets.

Reserved Labels

Labels 0 through 15 are reserved labels - an LSR cannot use them in the normal case for forwarding packets. Out of the 16 reserved labels, only a few are in use:

  • Label 0: explicit NULL label
  • Label 1: router alert label
  • Label 3: implicit NULL label
  • Label 14: OAM alert label
Explicit NULL Label (0)

With the Implicit NULL Label below, when the label is removed so are the EXP bits. The Explicit NULL Label solves this by placing the EXP bits in the EXP field of the explicit null label.

Router Alert Label (1)

his label can be present anywhere in the label stack except at the bottom. When the Router Alert label is the top label, it alerts the LSR that the packet needs a closer look. The packet is not forwarded in hardware, but it is looked at by a software process.

Implicit NULL Label (3)

An egress LSR assigns the implicit NULL label to a FEC if it does not want to assign a label to that FEC, thus requesting the upstream LSR to perform a pop operation. It is used when assigning a label would result in two lookups. The use of implicit NULL at the end of an LSP is called penultimate hop popping (PHP).

OAM Alert Label (14)

not used by Cisco

Fragmentation of MPLS Packets

If a labeled packet is received and the LSR notices that the outgoing MTU is not big enough for this packet, the LSR strips off the label stack, fragments the IP packet, puts the label stack (after the pop, swap, or push operation) onto all fragments, and forwards the fragments. Only if the IP header has the Don’t Fragment (DF) bit set does the LSR not fragment the IP packet, but it drops the packet and returns an ICMP error message “Fragmentation needed and do not fragment bit set” (ICMP type 3, code 4) to the originator of the IP packet. This ICMP error message is forwarded down the original path of the label, insteda of directly returned to the originating router. This is because the P router may not have a known path back to the originator.

Path MTU discovery can also be used to avoid fragmentation.