Files
isp-backbone-course/modules/02-mpls.md

82 lines
2.9 KiB
Markdown
Raw Normal View History

# Module 2: MPLS — Labeling the Backbone
> **Course**: [ISP Backbone Lab Course](../README.md)
> **Previous**: [Module 1: IS-IS](01-isis.md)
> **Next**: [Module 3: iBGP](03-ibgp.md)
---
## Network Diagram
![MPLS Label Switched Path](../diagrams/Module2_MPLS_LabelPath.png)
*MPLS label switched path showing Push → Swap → Swap → PHP Pop → IP Lookup*
---
## What Is MPLS and Why Do ISPs Use It?
MPLS (Multi-Protocol Label Switching) is the **heart of every modern ISP backbone**. Here's the key insight:
> **Core routers (P routers) don't need to know about customer routes.**
Without MPLS, every P router would need a full routing table — millions of routes. That's slow, expensive, and a security risk. Instead:
1. PE routers push an **MPLS label** onto packets entering the core
2. P routers only look at the label — a simple number — and swap/forward it
3. The PE on the other side pops the label and delivers to the customer
Think of it like shipping containers. The cargo ship (P router) doesn't care what's inside the container. It just reads the shipping label and moves it to the right port.
## LDP (Label Distribution Protocol)
LDP is how routers agree on which labels to use. It's simple:
1. Router A tells Router B: "If you want to reach my loopback 10.0.0.1, use label 24"
2. Router B remembers this and tells its own neighbors: "To reach 10.0.0.1, send it to me with label 30" (its own locally assigned label)
3. This builds a **Label Switched Path (LSP)** across the network
## Lab 2 Config: Enable MPLS/LDP
**On every P and PE router (add to existing config):**
```
mpls ip
mpls ldp router-id Loopback0 force
!
interface GigabitEthernet0/1
mpls ip
!
interface GigabitEthernet0/2
mpls ip
!
interface GigabitEthernet0/3
mpls ip
```
**That's it.** MPLS is beautifully simple to enable. The magic is in what it *enables* (VPNs, TE, etc.)
## Key Concept: PHP (Penultimate Hop Popping)
When a packet is one hop away from its destination, the second-to-last router **pops the label** instead of swapping it. Why? So the destination router only has to do one lookup (IP) instead of two (label + IP). This is called PHP and you'll see it as `implicit-null` or label `3` in the LFIB.
## Verification Commands
```
show mpls interfaces ! Which interfaces have MPLS enabled?
show mpls ldp neighbor ! LDP sessions established?
show mpls ldp bindings ! What labels are assigned to what prefixes?
show mpls forwarding-table ! The LFIB — the actual label switching table
traceroute 10.0.0.14 source 10.0.0.11 ! Should show MPLS labels in the path!
```
## Understanding Check
1. Why don't P routers need customer routes?
2. What is the LFIB and how is it different from the RIB/FIB?
3. Explain PHP — why does the second-to-last hop pop the label?
4. What would break if you forgot `mpls ldp router-id Loopback0 force`?
---
> **Next Module**: [Module 3: iBGP — The Brain of the ISP →](03-ibgp.md)