Understanding MPLS Label Operations on EX Series Switches
In the traditional packet-forwarding paradigm, as a packet travels from one switch to the next, an independent forwarding decision is made at each hop. The IP network header is analyzed and the next hop is chosen based on this analysis and on the information in the routing table. In an MPLS environment, the analysis of the packet header is made only once, when a packet enters the MPLS tunnel (that is, the path used for MPLS traffic).
When an IP packet enters a label-switched path (LSP), the ingress provider edge (PE) switch examines the packet and assigns it a label based on its destination, placing the label in the packet’s header. The label transforms the packet from one that is forwarded based on its IP routing information to one that is forwarded based on information associated with the label. The packet is then forwarded to the next provider switch in the LSP. This switch and all subsequent switches in the LSP do not examine any of the IP routing information in the labeled packet. Rather, they use the label to look up information in their label forwarding table. They then replace the old label with a new label and forward the packet to the next switch in the path. When the packet reaches the egress PE switch, the label is removed, and the packet again becomes a native IP packet and is again forwarded based on its IP routing information.
MPLS Label Switched Paths and MPLS Labels on EX Series Switches
When a packet enters the MPLS network, it is assigned to an LSP. Each LSP is identified by a label, which is a short (20-bit), fixed-length value at the front of the packet. Labels are used as lookup indexes for the label forwarding table. For each label, this table stores forwarding information. Because no additional parsing or lookup is done on the encapsulated packet, MPLS supports the transmission of any other protocols within the packet payload.
![]() | Note: MPLS for EX Series switches supports only single-label packets. |
Figure 1 shows the encoding of a single label. The encoding appears after data link layer headers, but before any network layer header.
Figure 1: Label Encoding

Reserved Labels
Labels range from 0 through 1,048,575. Labels 0 through 999,999 are for internal use.
Some of the reserved labels (in the 0 through 15 range) have well-defined meanings. The following reserved labels are used by EX Series switches:
- 0, IPv4 Explicit Null label—This value is legal only when it is the sole label entry (no label stacking). It indicates that the label must be popped on receipt. Forwarding continues based on the IP version 4 (IPv4) packet.
- 1, Router Alert label—When a packet is received with a top label value of 1, it is delivered to the local software module for processing.
- 2, IPv6 Explicit Null label—This value is legal only when it is the sole label entry (no label stacking). It indicates that the label must be popped on receipt.
- 3, Implicit Null label—This label is used in the control protocol (RSVP) only to request label popping by the downstream switch. It never actually appears in the encapsulation. Labels with a value of 3 must not be used in the data packet as real labels. No payload type (IPv4 or IPv6) is implied with this label.
MPLS Label Operations on EX Series Switches
EX Series switches support the following label operations:
- Push
- Pop
- Swap
The push operation affixes a new label to the top of the IP packet. For IPv4 packets, the new label is the first label. The time to live (TTL) field value in the packet header is derived from the IP packet header. The push operation cannot be applied to a packet that already has an MPLS label.
The pop operation removes a label from the beginning of the packet. Once the label is removed, the TTL is copied from the label into the IP packet header, and the underlying IP packet is forwarded as a native IP packet
The swap operation removes an existing MPLS label from an IP packet and replaces it with a new MPLS label, based on the following:
- Incoming interface
- Label
- Label forwarding table
Figure 2 shows an IP packet without a label arriving on the customer-edge interface (ge-0/0/1) of the ingress PE switch. The ingress PE switch examines the packet and identifies that packet’s destination is the egress PE switch. The ingress PE switch applies label 100 to the packet and sends the MPLS packet to its outgoing MPLS core interface (ge-0/0/5). The MPLS packet is transmitted on the MPLS tunnel through the provider switch, where it arrives at interface ge-0/0/5 with label 100. The provider switch swaps label 100 to label 200 and forwards the MPLS packet through its core interface (ge-0/0/7) to the next hop on the tunnel, which is the egress PE switch. The egress PE switch receives the MPLS packet through its core interface (ge-0/0/7), removes the MPLS label and sends the IP packet out of its customer-edge interface (ge-0/0/1) to a destination that is beyond the scope of the tunnel.
Figure 2: MPLS Label Swapping

Figure 2 shows the path of a packet as it passes in one direction from the ingress PE switch to the egress PE switch. However, the MPLS configuration also allows traffic to travel in the reverse direction. Thus, each provider edge switch operates as both an ingress switch and an egress switch.
Ultimate and Penultimate Hop Popping
EX Series switches support ultimate and penultimate hop popping (that is, popping off the MPLS label) as follows:
- With circuit cross-connect (CCC), ultimate hop popping (UHP) is enabled by default and label 0 (IPv4 Explicit Null Label) is advertised. With UHP, the egress PE switch is responsible for popping the MPLS label at the termination of the CCC.
- With IP and MPLS, penultimate hop popping (PHP) is enabled by default. With PHP, the penultimate provider switch is responsible for popping the MPLS label and forwarding the traffic to the egress PE switch. The egress PE switch then performs an IP route lookup and forwards the traffic. This reduces the processing load on the egress PE switch, because it is not responsible for popping off the MPLS label.
Related Topics
- Understanding JUNOS MPLS Components for EX Series Switches
- Example: Configuring MPLS on EX Series Switches
- Configuring MPLS on Provider Edge Switches Using Circuit Cross-Connect (CLI Procedure)
- Configuring MPLS on Provider Edge Switches Using IP Over MPLS (CLI Procedure)
- Configuring MPLS on Provider Switches (CLI Procedure)
- Junos OS MPLS Applications Configuration Guide at http://www.juniper.net/techpubs/software/junos/junos101/index.html
- Junos OS VPNs Configuration Guide at http://www.juniper.net/techpubs/software/junos/junos101/index.html

