In conventional Layer 3 forwarding mechanisms, as a packet traverses the network, each switch extracts all the information
relevant to forwarding the packet from the Layer 3 header. This information is then used as an index for a routing table lookup
to determine the next hop for the packet.
In the most common case, the only relevant field in the header is the destination address field, but in some cases, other
header fields might also be relevant. As a result, the header analysis must be done independently at each switch through which
the packet passes. In addition, a complicated table lookup must also be done at each switch.
In label switching, the analysis of the Layer 3 header is done only once. The Layer 3 header is then mapped into a fixed
length, unstructured value called a label .
Many different headers can map to the same label, as long as those headers always result in the same choice of next hop.
In effect, a label represents a forwarding equivalence class --that is, a set of packets which, however different they may be, are indistinguishable by the forwarding function.
The initial choice of a label need not be based exclusively on the contents of the Layer 3 packet header; for example, forwarding
decisions at subsequent hops can also be based on routing policy.
Once a label is assigned, a short label header is added at the front of the Layer 3 packet. This header is carried across
the network as part of the packet. At subsequent hops through each MPLS switch in the network, labels are swapped and forwarding
decisions are made by means of MPLS forwarding table lookup for the label carried in the packet header. Hence, the packet
header does not need to be reevaluated during packet transit through the network. Because the label is of fixed length and
unstructured, the MPLS forwarding table lookup process is both straightforward and fast.