Mpls Multiprotocol Label Switching
Category: Advanced Networking Concepts
Type: Network Concepts
Generated on: 2025-07-10 09:09:53
For: Network Engineering, Administration & Technical Interviews
This cheatsheet provides a comprehensive overview of MPLS, covering its core concepts, implementation, troubleshooting, and practical applications. It’s designed for both students learning networking and professionals working with MPLS networks.
1. Quick Overview
- What is it? MPLS is a data-carrying technique for high-performance telecommunications networks. It directs data from one network node to the next based on short path labels rather than long network addresses, avoiding complex lookups in a routing table.
- Why is it important?
- Speed: Faster packet forwarding due to label switching.
- Traffic Engineering: Ability to control traffic paths for QoS and bandwidth optimization.
- VPN Support: Enables the creation of Virtual Private Networks (VPNs) like L3VPNs and L2VPNs.
- Convergence: Can carry various network layer protocols (IP, ATM, Frame Relay) over a single infrastructure.
2. Key Concepts
- LSR (Label Switching Router): A router that supports MPLS.
- LER (Label Edge Router): An LSR at the edge of the MPLS domain. Handles label imposition (ingress) and label disposition (egress).
- FEC (Forwarding Equivalence Class): A group of packets that are forwarded in the same manner (same path, same QoS). Packets with the same destination address belong to the same FEC.
- Label: A short, fixed-length identifier used for forwarding packets.
- Label Stack: MPLS supports stacking labels, allowing for hierarchical routing and complex VPN scenarios.
- LSP (Label Switched Path): The path a packet takes through the MPLS network, determined by the labels.
- LIB (Label Information Base): A table in each LSR that stores incoming and outgoing label mappings.
- LFIB (Label Forwarding Information Base): The forwarding table used by the LSR to forward packets based on labels. Derived from the LIB.
- Control Plane: Protocols used to distribute labels and build the LIBs (e.g., LDP, RSVP-TE).
- Data Plane: The actual forwarding of packets based on labels.
- Label Distribution Protocol (LDP): A protocol used to distribute labels between LSRs.
- Resource Reservation Protocol - Traffic Engineering (RSVP-TE): A protocol used to establish LSPs with specific bandwidth and QoS requirements.
- PHP (Penultimate Hop Popping): The process where the penultimate (second-to-last) LSR removes the label before forwarding the packet to the egress LER. This reduces processing overhead on the egress LER.
3. How It Works
Basic MPLS Forwarding:
- Ingress LER: Receives an IP packet.
- FEC Assignment: The ingress LER determines the FEC based on the packet’s destination address and/or other criteria.
- Label Imposition: The ingress LER adds an MPLS label to the packet header.
- LSP Traversal: The packet is forwarded to the next LSR based on the label. Each LSR swaps the incoming label with an outgoing label based on its LFIB.
- Penultimate Hop Popping (PHP): The penultimate LSR removes the label.
- Egress LER: The egress LER receives the packet (now without the MPLS label) and forwards it to its final destination using standard IP routing.
+-------------+ +-------+ +-------+ +-------------+ | Ingress LER |----| LSR |----| LSR |----| Egress LER | +-------------+ +-------+ +-------+ +-------------+ | | | | | | IP Packet | | | IP Packet | | + Label | | | | | -------------->| Label | Label |--------------->| | | Swap | Swap | PHP (Pop Label)| | | | | | +----------------+--------+--------+----------------+Label Distribution (LDP Example):
- LSRs establish LDP sessions with their neighbors.
- LSRs advertise label bindings for specific FECs (e.g., destination prefixes).
- Each LSR builds its LIB based on the received label bindings.
- The LIB is used to create the LFIB, which is used for packet forwarding.
4. Protocol Details
-
MPLS Header: Added between the Layer 2 and Layer 3 headers.
+-----------------------------------------------------------------+| Label (20 bits) | Exp (3 bits) | S (1 bit) | TTL (8 bits) |+-----------------------------------------------------------------+- Label: The actual MPLS label value.
- Exp (Experimental): Used for QoS markings (CoS/ToS).
- S (Bottom of Stack): Indicates if this is the last label in the stack (1 = last label).
- TTL (Time To Live): Similar to IP TTL, used to prevent routing loops.
-
LDP Messages: Used for label distribution. Common message types include:
- Discovery: Discovering LDP peers.
- Session Establishment: Establishing LDP sessions.
- Label Mapping: Advertising label bindings.
- Label Request: Requesting a label binding.
- Label Withdraw: Withdrawing a label binding.
- Notification: Reporting errors and status information.
5. Real-World Examples
-
VPNs (Virtual Private Networks):
- L3VPN (Layer 3 VPN): Provides IP connectivity between remote sites, with routing information exchanged between the service provider and the customer. Uses BGP for route distribution and MPLS for forwarding.
- L2VPN (Layer 2 VPN): Extends Layer 2 connectivity (e.g., Ethernet) across the service provider network. Common types include VPWS (Virtual Private Wire Service) and VPLS (Virtual Private LAN Service).
-
Traffic Engineering:
- Constrained Shortest Path First (CSPF): Calculates the best path for an LSP based on constraints such as bandwidth and delay.
- Fast Reroute (FRR): Provides fast recovery from link or node failures by pre-calculating backup paths.
-
QoS (Quality of Service):
- Exp Bits: Used to classify traffic and apply different QoS policies.
- DiffServ-aware MPLS TE: Combines DiffServ and MPLS TE to provide end-to-end QoS.
6. Common Issues
- Label Depletion: Running out of labels, especially in large networks.
- Solution: Increase the label space or optimize label allocation.
- LSP Instability: LSPs flapping due to routing changes or network instability.
- Solution: Implement route dampening, tune IGP timers, or use FRR.
- MTU Issues: MPLS adds overhead to packets, which can cause fragmentation if the MTU is not properly configured.
- Solution: Adjust MTU settings on interfaces or use path MTU discovery.
- LDP Session Failures: LDP sessions going down due to network connectivity issues or misconfigurations.
- Solution: Verify network connectivity, check LDP configuration, and ensure proper authentication.
- Incorrect Label Swapping: Packets being forwarded to the wrong destination due to misconfigured label mappings.
- Solution: Carefully review label mappings and verify the LFIB on each LSR.
Troubleshooting Commands:
show mpls ldp neighbor: Displays LDP neighbor information.show mpls ldp bindings: Displays label bindings.show mpls forwarding-table: Displays the LFIB.traceroute mpls: Traces the path of an MPLS packet.ping mpls: Pings an MPLS endpoint.
7. Configuration Examples (Cisco IOS)
Basic MPLS Configuration:
interface Loopback0 ip address 10.0.0.1 255.255.255.255
interface GigabitEthernet0/0 ip address 192.168.1.1 255.255.255.0 mpls ip <-- Enables MPLS on the interface
router ospf 1 network 192.168.1.0 0.0.0.255 area 0 network 10.0.0.1 0.0.0.0 area 0
mpls ldp router-id Loopback0 force <-- Sets the Router ID for LDPL3VPN Configuration (Simplified):
PE Router:
router bgp 65000 neighbor 10.0.0.2 remote-as 65001 neighbor 10.0.0.2 update-source Loopback0 neighbor 10.0.0.2 send-community extended ! address-family ipv4 vrf CustomerA redistribute connected neighbor 192.168.2.1 remote-as 65002 <-- CE Router neighbor 192.168.2.1 activate exit-address-family
ip vrf CustomerA rd 65000:1 route-target export 65000:1 route-target import 65000:1
interface GigabitEthernet0/1 ip vrf forwarding CustomerA ip address 192.168.2.2 255.255.255.08. Interview Questions
-
What is MPLS, and how does it differ from traditional IP routing?
- MPLS uses labels for forwarding, which are short, fixed-length identifiers. Traditional IP routing uses destination IP addresses, which require longer lookups in routing tables. MPLS offers faster forwarding and traffic engineering capabilities.
-
Explain the difference between LDP and RSVP-TE.
- LDP is a simple protocol for distributing labels based on the IGP. RSVP-TE is a more complex protocol used to establish LSPs with specific bandwidth and QoS requirements. RSVP-TE allows for explicit path control and traffic engineering.
-
What is PHP, and why is it used?
- Penultimate Hop Popping (PHP) is the process where the second-to-last LSR removes the label before forwarding the packet to the egress LER. This reduces processing overhead on the egress LER, as it does not need to perform a label lookup.
-
How does MPLS support VPNs?
- MPLS provides the infrastructure for creating L3VPNs and L2VPNs. L3VPNs use BGP to distribute routing information and MPLS for forwarding. L2VPNs extend Layer 2 connectivity using protocols like VPWS and VPLS.
-
Explain the role of the LIB and LFIB in MPLS forwarding.
- The LIB (Label Information Base) stores incoming and outgoing label mappings. The LFIB (Label Forwarding Information Base) is derived from the LIB and is used for actual packet forwarding. The LFIB is essentially the forwarding table used by the LSR to switch labels.
-
What are some common troubleshooting steps for MPLS networks?
- Verify LDP neighbor relationships, check label bindings, examine the LFIB, use
traceroute mplsto trace the path of a packet, and check for MTU issues.
- Verify LDP neighbor relationships, check label bindings, examine the LFIB, use
9. Related Concepts
- BGP (Border Gateway Protocol): Used for route distribution in L3VPNs.
- OSPF (Open Shortest Path First) / IS-IS (Intermediate System to Intermediate System): IGPs used to provide basic IP connectivity and for LDP to build its label mappings.
- QoS (Quality of Service): MPLS can be used to implement QoS policies.
- Segment Routing (SR): An alternative to traditional MPLS TE that uses source routing and segments to control traffic paths. Often referred to as MPLS-SR (Segment Routing with MPLS data plane).
- VXLAN (Virtual Extensible LAN): A tunneling protocol used to extend Layer 2 networks over an IP infrastructure. Often used in data centers.
This cheatsheet provides a solid foundation for understanding MPLS. Further study and hands-on practice are recommended to master this technology. Consult vendor documentation for specific configuration details and advanced features.