MPLS · Topic 1 of 5

MPLS Terminology, Header and Forwarding

Learn MPLS terms for the JN0-364: LSR, LER, LSP and FEC, the 32 bit label header, push, swap and pop, end-to-end forwarding and penultimate hop popping.

  • 6 min
  • Includes a diagram
In a nutshell
  • An LSP is unidirectional: ingress pushes, transit swaps, penultimate pops (PHP), egress does an IP lookup.
  • The MPLS header is 32 bits: label 20, TC 3, S 1, TTL 8.
  • The S bit is set on the bottom label of the stack only.

What it is

Multiprotocol Label Switching (MPLS) forwards packets by a short fixed-length label instead of by the destination IP address. The first router on a path decides once which path a packet takes and adds a label. Every router after that only looks at the label.

Providers use MPLS for VPNs, BGP-free cores and traffic engineering. The exam expects you to know the terms, the header and what each router does to the label.

IP packetarrivesIngress LERpush labellabeled packetTransit LSRswap labellabeled packetEgress LERIP lookup

How it works

Terminology

TermMeaning
Label-switching router (LSR)Any router that forwards by label
Label edge router (LER)An LSR at the edge of the MPLS domain, where IP traffic enters or leaves
Ingress routerHead end of an LSP; it pushes the first label
Transit routerA router in the middle of an LSP; it swaps the label
Penultimate routerThe second-to-last router; it pops the label when penultimate hop popping is used
Egress routerTail end of an LSP; it forwards the packet by its IP header
Label-switched path (LSP)The path through the routers; always unidirectional
Forwarding equivalence class (FEC)A group of packets that get the same label and the same treatment, for example everything toward one egress loopback

The MPLS header

The MPLS header is a 32 bit shim placed between the Layer 2 header and the IP header. On Ethernet, the EtherType 0x8847 tells the receiver that an MPLS unicast packet follows.

FieldBitsPurpose
Label20The label value, 0 to 1,048,575
Traffic class (TC), formerly EXP3Class of service marking
Bottom of stack (S)1Set to 1 on the last label before the IP header
Time to live (TTL)8Decremented at every hop, like the IP TTL

A packet can carry several labels, a label stack, and only the top label is used for forwarding. A Layer 3 VPN packet has an outer transport label and an inner VPN label; only the inner one has the S bit set.

Layer 2 headerthenLabel20 bitsthenTC3 bitsthenS1 bitthenTTL8 bitsthenIP packet

Label operations

OperationWho does itEffect
PushIngress routerAdds a label (or several) to the packet
SwapTransit routerReplaces the top label with the label the next hop expects
PopPenultimate or egress routerRemoves the top label

End-to-end forwarding

R1, the ingress, pushes a label and sends the packet to R2, which swaps it for a new label. R3, the penultimate router, pops the label because R4 advertised label 3, so R4 receives a plain IP packet. Walk one packet across four routers, R1 to R4, where R4 is the egress.

  1. R1 receives an IP packet. Its route to the destination points into an LSP, so R1 pushes the label R2 advertised for that FEC and sends the packet to R2.
  2. R2 looks up the label in its mpls.0 table, swaps it for the label R3 advertised and forwards it.
  3. R3 is the penultimate router. R4 advertised label 3 (implicit null), so R3 pops the label and sends a plain IP packet to R4.
  4. R4 does a normal IP lookup and forwards the packet.

This is penultimate hop popping (PHP). It saves the egress router from doing two lookups, a label lookup followed by an IP lookup. Both RSVP and LDP in Junos OS use PHP by default.

R1push labelswap at R2R3popplain IPR4IP lookup

If the egress router advertises label 0 (explicit null) instead, the penultimate router swaps to label 0 and the egress pops it. The packet still carries a label on the last hop, so the TC bits survive to the egress for class of service.

TTL handling

By default the ingress router copies the IP TTL into the MPLS TTL, and the egress copies the result back. A traceroute through the LSP then shows every core router. With no-propagate-ttl under [edit protocols mpls], the ingress sets the MPLS TTL to 255 and the core is hidden from traceroute.

user@R1# set protocols mpls no-propagate-ttl

MPLS forwarding on a Junos device

An interface only accepts labeled packets when the logical unit has family mpls and the interface is listed under protocols mpls. Missing either one means labeled packets arriving on that interface are dropped.

user@R2# set interfaces ge-0/0/1 unit 0 family mpls
user@R2# set protocols mpls interface ge-0/0/1.0

The forwarding decision for labeled packets comes from mpls.0, the label table, which the routing engine copies to the Packet Forwarding Engine. show route table mpls.0 shows each incoming label with its operation, such as Swap 300112 or Pop.

Exam tip

When an exam exhibit shows Pop on a router that is not the egress, that router is the penultimate hop and the egress advertised implicit null.

Common mistakes

Thinking an LSP is bidirectional. Every LSP is one way. Return traffic needs its own LSP from the other end.

Mixing up label 0 and label 3. Label 3 (implicit null) tells the upstream router to pop, so it never appears on the wire. Label 0 (explicit null) is really carried on the last hop.

Forgetting protocols mpls interface. family mpls on the unit alone is not enough on Junos OS. The interface must also be listed under [edit protocols mpls].

Placing the header in the wrong spot. The MPLS header sits between Layer 2 and Layer 3, not inside the IP header.

Watch out

With PHP, the egress router receives an unlabeled packet. If an exhibit asks which router performs the final label pop, the answer is the penultimate router, not the egress.

What to remember for the exam

  • An LSP is unidirectional: ingress pushes, transit swaps, penultimate pops (PHP), egress does an IP lookup.
  • The MPLS header is 32 bits: label 20, TC 3, S 1, TTL 8.
  • The S bit is set on the bottom label of the stack only.
  • A FEC is a set of packets forwarded the same way with the same label.
  • Implicit null is label 3 and triggers PHP; explicit null is label 0 and keeps a label on the last hop.
  • RSVP and LDP use PHP by default in Junos OS.
  • Interfaces need family mpls and set protocols mpls interface.
  • no-propagate-ttl hides the core from traceroute.

Check yourself

  • Which router removes the label when the egress router advertises label 3?

    The penultimate router pops it, so the egress receives a plain IP packet.

  • How many bits does the label field use, and how many does the whole MPLS header use?

    The label is 20 bits inside a 32 bit header.

  • Two routers exchange traffic over MPLS in both directions. How many LSPs are needed?

    Two, because every LSP is unidirectional.

Topic 1 of 5 in MPLS

Test yourself on MPLS

The full Juniper JNCIS-SP JN0-364 question bank has 860 questions, with timed practice exams and an explanation for every answer.

This study guide is independent and is not affiliated with, endorsed by, or sponsored by Juniper. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.