MPLS label header encoding
The following diagram illustrates the structure of the 32-bit MPLS label header. When a packet enters an LSP, the ingress LER pushes a label onto the packet.
An MPLS label header comprises of the following parts:
Label value (20 bits)
The label value is an integer in the range of 16 through 1048575. (Labels 0 through 15 are reserved by the IETF for special usage.)
EXP field (3 bits)
The EXP field is designated for experimental usage. By default, a device uses the EXP field to define a Class of Service (CoS) value for prioritizing packets traveling through an LSP.
S (Bottom of Stack) field (one bit)
An MPLS packet can be assigned multiple labels. When an MPLS packet has multiple labels, they are logically organized in a last-in, first-out label stack. An LSR performs a pop or swap operation on the topmost label; that is, the most recently applied label in the stack. The Bottom of Stack field indicates whether this label is the last (oldest) label in the stack. When the label is the last one in the stack, the Bottom of Stack field is set to one. If not, the Bottom of Stack field is set to zero.
A device acting as an LSR can perform one push, swap, or pop operation on an incoming MPLS packet. The device can accept MPLS packets that contain multiple labels, but only the topmost label is acted upon.
TTL field (eight bits)
The TTL field indicates the Time To Live (TTL) value for the MPLS packet. At the ingress LER, the TTL value of an IP packet is copied to its MPLS TTL field. At each transit LSR hop, the MPLS TTL value is decremented by one. When the MPLS TTL value reaches zero, the packet is discarded. The MPLS TTL value is copied into the IP header at the egress LER.