Friday, May 15, 2026

Complete MPLS L3VPN Configuration Lab Part 1 | OSPF, MPLS, LDP, MP-BGP & VRF Cisco IOS Guide

Complete MPLS L3VPN Configuration Lab Part 1 | OSPF MPLS MP-BGP VRF Cisco IOS

Complete MPLS Layer 3 VPN Configuration Lab Part 1

MPLS Layer 3 VPN is one of the most important technologies used in modern service provider and enterprise networks. This complete educational tutorial explains how to configure MPLS L3VPN step-by-step using Cisco IOS routers.

In this lab we will configure:

  • OSPF in the Service Provider Core
  • MPLS and LDP
  • MP-iBGP VPNv4
  • VRF Configuration
  • PE-CE BGP Routing
  • Customer Route Advertisement

๐ŸŽฏ Learning Objectives

  • Understand MPLS backbone design
  • Learn OSPF in SP core networks
  • Configure MPLS label switching
  • Understand LDP neighbor relationships
  • Learn MP-BGP VPNv4
  • Understand VRFs and Route Targets
  • Configure PE-CE routing using BGP
  • Verify MPLS VPN operations

1. MPLS Introduction

MPLS stands for Multiprotocol Label Switching.

Traditional IP routing performs routing table lookups for every packet. MPLS improves forwarding efficiency by assigning labels to packets.

MPLS Forwarding Formula

$$ Forwarding = Label\\ Lookup + LFIB\\ Decision $$

Where:

  • LFIB = Label Forwarding Information Base
  • Labels reduce routing complexity
  • Packets are switched instead of routed

MPLS VPN combines:

  • MPLS forwarding
  • MP-BGP VPNv4
  • VRFs
  • Route Targets

2. MPLS Network Topology


          SERVICE PROVIDER CORE

        R1 -------- R2
         |           |
         |           |
        R4 -------- R3


PE Routers:
R1 and R4

P Routers:
R2 and R3

Customer Routers:
R5 and R6

๐Ÿ’ก Router Roles

  • PE = Provider Edge Router
  • P = Provider Router
  • CE = Customer Edge Router

3. Task 1 - Configure OSPF Between SP Routers

The Service Provider core requires an Interior Gateway Protocol.

OSPF is commonly used because:

  • Fast convergence
  • Scalable design
  • Loop prevention
  • Hierarchical routing

OSPF Cost Formula

$$ Cost = \frac{Reference\\ Bandwidth}{Interface\\ Bandwidth} $$

Default Cisco reference bandwidth:

$$ 100Mbps $$

R1 OSPF Configuration

The router-id uniquely identifies the OSPF router.

R1

router ospf 1
 router-id 0.0.0.1
 network 192.1.12.0 0.0.0.255 area 0
 network 1.0.0.0 0.255.255.255 area 0
Explanation

The network statements advertise:

  • Core link toward R2
  • Loopback interface

The loopback interface provides stable reachability.

R2 OSPF Configuration

R2

router ospf 1
 router-id 0.0.0.2
 network 192.1.12.0 0.0.0.255 area 0
 network 192.1.23.0 0.0.0.255 area 0
 network 2.0.0.0 0.255.255.255 area 0

R3 OSPF Configuration

R3

router ospf 1
 router-id 0.0.0.3
 network 192.1.13.0 0.0.0.255 area 0
 network 192.1.23.0 0.0.0.255 area 0
 network 3.0.0.0 0.255.255.255 area 0

R4 OSPF Configuration

R4

router ospf 1
 router-id 0.0.0.4
 network 192.1.14.0 0.0.0.255 area 0
 network 4.0.0.0 0.255.255.255 area 0
Expected OSPF Neighbor Output
R1#show ip ospf neighbor

Neighbor ID     Pri   State           Dead Time   Address
0.0.0.2           1   FULL/DR         00:00:39    192.1.12.2

4. Task 2 - Configure MPLS and LDP

MPLS requires label distribution between routers.

Cisco routers use LDP (Label Distribution Protocol).

Label Distribution Logic

$$ Incoming\\ Label \rightarrow LFIB \rightarrow Outgoing\\ Label $$

Loopback interfaces are used as LDP router IDs because they are stable and reliable.

R1 MPLS Configuration

R1

mpls ldp router-id Loopback0

interface E0/0
 mpls ip

R2 MPLS Configuration

R2

mpls ldp router-id Loopback0

interface E0/0
 mpls ip

interface E0/1
 mpls ip

R3 MPLS Configuration

R3

mpls ldp router-id Loopback0

interface E0/0
 mpls ip

interface E0/1
 mpls ip

R4 MPLS Configuration

R4

mpls ldp router-id Loopback0

interface E0/0
 mpls ip
Expected MPLS Verification Output
R1#show mpls ldp neighbor

Peer LDP Ident: 2.2.2.2:0
 TCP connection: 2.2.2.2.646
 State: Oper
 Msgs sent/rcvd: 25/25

MPLS Label Stack Formula

$$ Packet = Label_1 + Label_2 + Payload $$

Where:

  • Label 1 = Transport Label
  • Label 2 = VPN Label

5. Task 3 - Configure MP-iBGP VPNv4

MP-BGP distributes VPNv4 routes between PE routers.

Traditional IPv4 BGP cannot carry VRF information.

VPNv4 Address Structure

$$ VPNv4 = RD + IPv4\\ Prefix $$

R1 MP-BGP Configuration

R1

router bgp 100
 neighbor 4.4.4.4 remote-as 100
 neighbor 4.4.4.4 update-source lo0

 address-family vpnv4
  neighbor 4.4.4.4 activate

R4 MP-BGP Configuration

R4

router bgp 100
 neighbor 1.1.1.1 remote-as 100
 neighbor 1.1.1.1 update-source lo0

 address-family vpnv4
  neighbor 1.1.1.1 activate
Why Use Loopbacks?

Loopback interfaces are more stable than physical interfaces.

If one physical link fails:

  • IGP recalculates path
  • BGP session remains active

6. Task 4 - Configure VRF Cust-A

VRFs create isolated routing tables.

VRF Isolation Formula

$$ CustomerA\\ Routes \neq CustomerB\\ Routes $$

R1 VRF Configuration

R1

vrf definition Cust-A
 rd 100:1

 address-family ipv4
  route-target both 100:1
 !

interface E0/3
 vrf forwarding Cust-A
 ip address 192.1.15.1 255.255.255.0
 no shut

router bgp 100

 address-family ipv4 vrf Cust-A
  neighbor 192.1.15.5 remote-as 65005

R4 VRF Configuration

R4

vrf definition Cust-A
 rd 100:1

 address-family ipv4
  route-target both 100:1
 !

interface E0/3
 vrf forwarding Cust-A
 ip address 192.1.46.4 255.255.255.0
 no shut

router bgp 100

 address-family ipv4 vrf Cust-A
  neighbor 192.1.46.6 remote-as 65006
RD and RT Explanation

RD makes routes unique.

RT controls route import/export.

Because both VRFs use:

route-target both 100:1

they can exchange routes.

7. Task 5 - Configure CE Routers

Customer Edge routers establish BGP with PE routers.

R5 Configuration

R5

interface E0/0
 ip address 192.1.15.5 255.255.255.0
 no shut

interface Loopback0
 ip address 10.5.5.5 255.255.255.0

router bgp 65005
 neighbor 192.1.15.1 remote-as 100
 network 10.5.5.0 mask 255.255.255.0

R6 Configuration

R6

interface E0/0
 ip address 192.1.46.6 255.255.255.0
 no shut

interface Loopback0
 ip address 10.6.6.6 255.255.255.0

router bgp 65006
 neighbor 192.1.46.6 remote-as 100
 network 10.6.6.0 mask 255.255.255.0
Important Note

The PE router belongs to AS 100 while customer routers belong to:

  • R5 = AS 65005
  • R6 = AS 65006

This is called eBGP PE-CE routing.

8. Verification Commands

Verify OSPF

show ip ospf neighbor
show ip route ospf

Verify MPLS

show mpls interfaces
show mpls ldp neighbor
show mpls forwarding-table

Verify MP-BGP

show bgp vpnv4 unicast all

Verify VRF Routes

show ip route vrf Cust-A

Verify VPN Labels

show bgp vpnv4 unicast all labels

9. MPLS Mathematics and Technical Concepts

OSPF SPF Calculation

$$ Shortest\\ Path = Min(Cost_1 + Cost_2 + ... + Cost_n) $$

BGP Path Selection

$$ Best\\ Path = Highest\\ Weight + Highest\\ LocalPref $$

VPN Route Import Logic

$$ Import = \begin{cases} TRUE, & RT_{import}=RT_{export} \\\\ FALSE, & otherwise \end{cases} $$

MPLS Scalability Formula

$$ Total\\ VPNs = PE\\ Routers \times VRFs $$

10. Troubleshooting MPLS VPN

Issue Possible Cause Solution
OSPF adjacency down Area mismatch Verify OSPF areas
LDP neighbor missing MPLS disabled Enable mpls ip
BGP session down Loopback unreachable Verify IGP reachability
VPN routes missing RT mismatch Verify Route Targets
Customer cannot ping VRF issue Verify VRF routing table

๐Ÿ’ก Key Takeaways

  • OSPF provides SP core reachability
  • MPLS enables label switching
  • LDP distributes labels
  • MP-BGP distributes VPNv4 routes
  • VRFs isolate customer routing tables
  • BGP connects PE and CE routers
  • Route Targets control route sharing

Final Conclusion

This MPLS Layer 3 VPN Part 1 tutorial demonstrated how to build the complete MPLS backbone foundation using:

  • OSPF
  • MPLS
  • LDP
  • MP-BGP
  • VRFs
  • PE-CE BGP Routing

Understanding these technologies is essential for mastering enterprise WANs and service provider MPLS architectures.

No comments:

Post a Comment

Featured Post

How HMT Watches Lost the Time: A Deep Dive into Disruptive Innovation Blindness in Indian Manufacturing

The Rise and Fall of HMT Watches: A Story of Brand Dominance and Disruptive Innovation Blindness The Rise and Fal...

Popular Posts