VPN Technologies · Topic 1 of 3
MPLS Operations and LDP
Describe MPLS label switching, the roles of LSR and LER devices, how LDP distributes labels, and how a label switched path forwards packets on IOS XE.
- 5 min
- MPLS forwards by label, and the IGP still builds the paths.
- Push at the ingress, swap in the core, pop at or before the egress.
- The label is 20 bits within a 32 bit entry that also holds TTL.
What it is
MPLS forwards packets using short labels instead of looking up the destination IP address at every hop.
A label is added in front of the packet when it enters the MPLS network. Routers in the middle forward by label, and the label is removed before the packet leaves.
MPLS is the foundation for provider VPN services. Label switching does not replace routing, because the routing protocol still decides which paths exist.
How it works
Labels are attached at the edge, swapped in the core and removed at the end.
Device roles
| Term | Meaning |
|---|---|
| LSR | Label switching router, which forwards packets by label |
| LER | Label edge router, at the border of the MPLS network |
| Ingress LER | Adds a label to an incoming packet |
| Egress LER | Removes the label and forwards the packet |
| P router | Provider core router, which sees only labels |
| PE router | Provider edge router, which connects to customers |
A PE router acts as an LER. A P router acts as an LSR.
The label
An MPLS label sits between the Layer 2 header and the IP header. The label entry is 32 bits long.
- 20 bits for the label value.
- 3 bits for traffic class, formerly called experimental.
- 1 bit that marks the bottom of the label stack.
- 8 bits for TTL.
Labels can be stacked. Values 0 to 15 are reserved, and two are worth knowing. Label 0 is explicit null and label 3 is implicit null.
Label operations
An LSR performs one of three actions on a labelled packet.
| Operation | What happens |
|---|---|
| Push | A label is added to the packet |
| Swap | The top label is replaced with another label |
| Pop | The top label is removed |
Penultimate hop popping (PHP) removes the label one hop before the egress router. The egress router advertises implicit null, label 3, for its own prefixes. The last LSR then pops the label, which saves the egress router a lookup.
Label Distribution Protocol
LDP assigns labels to IGP prefixes and tells neighbours about them. Each LSR builds a binding for each prefix in its routing table, and sends it to its LDP neighbours.
LDP neighbours find each other with hello messages sent to multicast address 224.0.0.2 on UDP port 646. They then open a TCP session on port 646 to exchange bindings.
R1(config)# mpls label protocol ldp
R1(config)# mpls ldp router-id Loopback0 force
R1(config)# interface GigabitEthernet0/0
R1(config-if)# mpls ip
The LDP router ID is usually a loopback. The loopback address must be reachable through the IGP, otherwise the TCP session cannot open.
Forwarding tables
Three tables work together.
- The routing table and FIB hold IP prefixes and next hops. CEF builds the FIB.
- The LIB holds all labels learned from neighbours.
- The LFIB holds the labels actually used for forwarding.
The LSR uses the label from the neighbour that is the next hop for the prefix in its routing table. A label switched path (LSP) is the chain of labels from ingress to egress. An LSP is unidirectional, so return traffic uses a separate LSP.
R2# show mpls interfaces
R2# show mpls ldp neighbor
R2# show mpls ldp bindings
R2# show mpls forwarding-table
In show mpls forwarding-table, the outgoing label column shows Pop Label where PHP applies. A prefix with No Label has no binding from the next hop.
Troubleshooting
Check these things in order when labels are missing.
- Is CEF enabled?
- Is
mpls ipset on both ends of each core link? - Is there an LDP neighbour in
show mpls ldp neighbor? - Can the LDP router IDs reach each other through the IGP?
- Is there a label for the next hop of the prefix?
LDP labels only follow IGP prefixes. If a loopback is missing from the IGP, its LSP is also missing.
What to remember for the exam
Seven facts cover most questions on this topic.
- MPLS forwards by label, and the IGP still builds the paths.
- Push at the ingress, swap in the core, pop at or before the egress.
- The label is 20 bits within a 32 bit entry that also holds TTL.
- Implicit null, label 3, causes penultimate hop popping.
- LDP uses UDP 646 for hellos and TCP 646 for sessions.
mpls ipon an interface enables label switching on the link.- An LSP is one way, so traffic in each direction has its own LSP.
CEF must be on. MPLS on IOS XE depends on it, and a router without CEF cannot label switch.
Common mistakes
These four mistakes appear often.
LDP router ID not reachable. The hellos work but the TCP session never forms.
Enabling mpls ip on one end only. There is no LDP adjacency across that link.
Expecting labels for all prefixes. LDP by default labels IGP prefixes, not BGP routes.
Treating the LSP as two way. Each direction has its own labels and path.
Check yourself
Work through these three questions.
Which three operations can an LSR perform on a label?
Push, swap and pop.
Why does penultimate hop popping exist?
The egress router advertises implicit null, so the last LSR before it removes the label and the egress router avoids an extra lookup.
Which command enables LDP label switching on an interface?
The
mpls ipinterface command enables it.
Topic 1 of 3 in VPN Technologies
Test yourself on VPN Technologies
The full Cisco CCNP 300-410 ENARSI question bank has 857 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 Cisco. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.