Request For Comments
Q.2941 Generic Identifier and Q.2957 User-to-user Signaling for the Internet Protocol
MPLS White Papers
- a 20-bit label value.
- a 3-bit experimental field reserved for future use.
- a 1-bit bottom of stack flag. If this is set, it signifies the current label is the last in the stack.
- an 8-bit TTL (time to live) field.
MPLS works by prepending packets with an MPLS header, containing one or more ‘labels’. This is called a label stack.
Each label stack entry contains four fields:
These MPLS labeled packets are forwarded (switched is the correct term) after a Label Lookup/Switch instead of a lookup into the IP table. Label Lookup and Label Switching may be faster than usual RIB lookup because it can take place directly into fabric and not CPU.
The exit points of an MPLS network are called Label Edge Routers (LER). Routers that are performing routing based only on Label Switching are called Label Switch Routers (LSR). Remember that a LER is not usually the one that is popping the label. For more information see Penultimate Hop Popping.
Devices that function as ingress and/or egress routers are often called PE (Provider Edge) routers. Devices that function only as transit routers are similarly called P (Provider) routers. The job of a P router is significantly easier than that of a PE router, so they can be less complex and may be more dependable because of this.
When an unlabeled packet enters the ingress router and needs to be passed on to an MPLS tunnel, the router first determines the forwarding equivalence class the packet should be in, and then inserts one (or more) labels in the packet’s newly created MPLS header. The packet is then passed on to the next hop router for this tunnel.
When a labeled packet is received by an MPLS router, the topmost label is examined. Based on the contents of the label a swap, push or pop operation can be performed on the packet’s label stack. Routers can have prebuilt lookup tables that tell them which kind of operation to do based on the topmost label of the incoming packet so they can process the packet very quickly. In a swap operation the label is swapped with a new label, and the packet is forwarded along the path associated with the new label.
In a push operation a new label is pushed on top of the existing label, effectively “encapsulating” the packet in another layer of MPLS. This allows the hierarchical routing of MPLS packets. Notably, this is used by MPLS VPNs.
In a pop operation the label is removed from the packet, which may reveal an inner label below. This process is called “decapsulation”. If the popped label was the last on the label stack, the packet “leaves” the MPLS tunnel. This is usually done by the egress router, but see PHP below.
During these operations, the contents of the packet below the MPLS Label stack are not examined. Indeed transit routers typically need only to examine the topmost label on the stack. The forwarding of the packet is done based on the contents of the labels, which allows “protocol independent packet forwarding” that does not need to look at a protocol-dependent routing table and avoids the expensive IP longest prefix match at each hop.
At the egress router, when the last label has been popped, only the payload remains. This can be an IP packet, or any of a number of other kinds of payload packet. The egress router must therefore have routing information for the packet’s payload, since it must forward it without the help of label lookup tables. An MPLS transit router has no such requirement.
In some special cases, the last label can also be popped off at the penultimate hop (the hop before the egress router). This is called Penultimate Hop Popping (PHP). This may be interesting in cases where the egress router has lots of packets leaving MPLS tunnels, and thus spends inordinate amounts of CPU time on this. By using PHP, transit routers connected directly to this egress router effectively offload it, by popping the last label themselves. Since the egress router will do a higher-layer routing table lookup anyway, the amount of higher-layer work needed for a previously popped packet remains the same, and the actual label popping need not be done.
MPLS can make use of existing ATM network infrastructure, as its labelled flows can be mapped to ATM virtual circuit identifiers, and vice-versa