Wednesday, May 13, 2026

Complete MPLS L3VPN Configuration Guide | OSPF, MPLS LDP, VRF & MP-BGP Step-by-Step Lab

Complete MPLS Layer 3 VPN Configuration Guide | OSPF MPLS MP-BGP VRF

Complete MPLS Layer 3 VPN Configuration Guide Using OSPF, MPLS LDP, MP-BGP and VRF

MPLS Layer 3 VPN is one of the most important technologies used in modern service provider networks. Large telecom companies and enterprise service providers use MPLS VPN architecture to transport customer traffic securely across a shared backbone network.

This tutorial explains every configuration step in detail including:

  • OSPF routing inside the provider core
  • MPLS label switching
  • LDP neighbor formation
  • MP-BGP VPNv4 peering
  • VRF creation
  • Route distinguisher and route target concepts
  • Static route redistribution
  • Verification commands
  • Troubleshooting techniques
  • MPLS mathematical concepts

๐Ÿ’ก Learning Objective

By the end of this lab you will understand how service providers isolate customer routes while transporting them through a common MPLS backbone.


Table of Contents


Understanding the MPLS VPN Topology

The topology consists of:

  • R1 and R4 as PE routers
  • R2 and R3 as P routers
  • R5 and R8 belonging to Customer A
  • R6 and R7 belonging to Customer B

The provider routers exchange routes internally using OSPF and MPLS. Customer routes are exchanged using MP-BGP VPNv4.

MPLS Scalability Formula

Traditional full mesh IBGP sessions require:

$$ \frac{n(n-1)}{2} $$

Where:

$$ n = Number\ of\ routers $$

MPLS VPN drastically improves scalability.


Task 1 - Configure OSPF Between SP Routers

OSPF is used as the Interior Gateway Protocol for the provider backbone.

Why OSPF Is Used in MPLS Networks

  • Fast convergence
  • Loop-free routing
  • Efficient SPF calculations
  • Reliable link-state protocol
  • Excellent scalability

OSPF Cost Formula

OSPF calculates path cost using:

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

Example:

$$ Cost = \frac{100000000}{10000000} $$ $$ Cost = 10 $$

OSPF Configuration on R1

This configuration enables OSPF process 1 and advertises the loopback and internal provider links.


router ospf 1
 router-id 1.1.1.1
 network 1.1.1.1 0.0.0.0 area 0
 network 192.1.12.0 0.0.0.255 area 0
CLI Verification Output

R1#show ip ospf neighbor

Neighbor ID     Pri   State   Dead Time   Address       Interface
2.2.2.2           1   FULL    00:00:38    192.1.12.2   Ethernet0/0

OSPF Configuration on R2


router ospf 1
 router-id 2.2.2.2
 network 2.2.2.2 0.0.0.0 area 0
 network 192.1.12.0 0.0.0.255 area 0
 network 192.1.23.0 0.0.0.255 area 0

OSPF Configuration on R3


router ospf 1
 router-id 3.3.3.3
 network 3.3.3.3 0.0.0.0 area 0
 network 192.1.23.0 0.0.0.255 area 0
 network 192.1.34.0 0.0.0.255 area 0

OSPF Configuration on R4


router ospf 1
 router-id 4.4.4.4
 network 4.4.4.4 0.0.0.0 area 0
 network 192.1.34.0 0.0.0.255 area 0

๐Ÿ’ก Important OSPF Concept

Loopback interfaces are advertised because they provide stable router identifiers and reliable endpoints for MPLS LDP and BGP sessions.


Task 2 - Configure MPLS and LDP

MPLS stands for Multiprotocol Label Switching.

Instead of routing every packet using complex IP lookups, MPLS forwards packets using labels.

Understanding MPLS Forwarding

Operation Description
Push Ingress PE adds label
Swap P router swaps labels
Pop Egress PE removes label

MPLS Header Structure

MPLS uses a 32-bit header:

$$ 20\ bits = Label $$ $$ 3\ bits = EXP $$ $$ 1\ bit = Bottom\ of\ Stack $$ $$ 8\ bits = TTL $$

Total:

$$ 20 + 3 + 1 + 8 = 32\ bits $$

R1 MPLS Configuration


mpls ldp router-id Loopback0

mpls label range 100 199

interface Ethernet0/0
 mpls ip

The command mpls ip enables MPLS forwarding on the interface.


R2 MPLS Configuration


mpls ldp router-id Loopback0

mpls label range 200 299

interface Ethernet0/0
 mpls ip

interface Ethernet0/1
 mpls ip

R3 MPLS Configuration


mpls ldp router-id Loopback0

mpls label range 300 399

interface Ethernet0/0
 mpls ip

interface Ethernet0/1
 mpls ip

R4 MPLS Configuration


mpls ldp router-id Loopback0

mpls label range 400 499

interface Ethernet0/0
 mpls ip

interface Ethernet0/1
 mpls ip
Verify MPLS LDP Neighbor

R1#show mpls ldp neighbor

Peer LDP Identifier: 2.2.2.2:0
 TCP connection: 2.2.2.2.646 - 1.1.1.1.11000
 State: Oper

Forwarding Efficiency Formula

Traditional routing lookup:

$$ Lookup\ Complexity = O(log n) $$

MPLS forwarding:

$$ Forwarding = Label\ Swap $$

This significantly reduces forwarding overhead.


Task 3 - Configure MP-BGP VPNv4 Peering

MP-BGP distributes VPN routes between PE routers.

The VPNv4 address family combines the Route Distinguisher with the IPv4 prefix.

VPNv4 Address Formula

$$ VPNv4 = RD + IPv4\ Prefix $$

Example:

$$ 1000:1 + 10.5.5.0/24 $$

Result:

$$ 1000:1:10.5.5.0/24 $$

R1 MP-BGP Configuration


router bgp 1000
 neighbor 4.4.4.4 remote-as 1000
 neighbor 4.4.4.4 update-source Loopback0

 address-family vpnv4
  neighbor 4.4.4.4 activate

R4 MP-BGP Configuration


router bgp 1000
 neighbor 1.1.1.1 remote-as 1000
 neighbor 1.1.1.1 update-source Loopback0

 address-family vpnv4
  neighbor 1.1.1.1 activate
Verify VPNv4 Peering

R1#show bgp vpnv4 unicast summary

Neighbor        V    AS MsgRcvd MsgSent Up/Down State/PfxRcd
4.4.4.4         4  1000      25      30 00:22:10 4

Task 4 - Configure VRFs

VRF stands for Virtual Routing and Forwarding.

VRFs allow multiple routing tables on the same router.

VRF Routing Table Formula

Without VRF:

$$ 1\ Router = 1\ Routing\ Table $$

With VRF:

$$ 1\ Router = n\ Routing\ Tables $$

Where:

$$ n = Number\ of\ Customers $$

Customer A VRF on R1


vrf definition Cust-A
 rd 1000:1

 address-family ipv4
  route-target both 1000:1

interface Ethernet0/1
 vrf forwarding Cust-A
 ip address 192.1.15.1 255.255.255.0
 no shutdown

Customer A VRF on R4


vrf definition Cust-A
 rd 1000:1

 address-family ipv4
  route-target both 1000:1

interface Ethernet0/2
 vrf forwarding Cust-A
 ip address 192.1.48.4 255.255.255.0
 no shutdown

Customer B VRF on R1


vrf definition Cust-B
 rd 1000:2

 address-family ipv4
  route-target both 1000:2

interface Ethernet0/2
 vrf forwarding Cust-B
 ip address 192.1.16.1 255.255.255.0
 no shutdown

Customer B VRF on R4


vrf definition Cust-B
 rd 1000:2

 address-family ipv4
  route-target both 1000:2

interface Ethernet0/1
 vrf forwarding Cust-B
 ip address 192.1.47.4 255.255.255.0
 no shutdown

๐Ÿ’ก RD vs RT

  • Route Distinguisher makes routes unique.
  • Route Target controls route import/export.

Task 5 - Customer A Route Exchange

Static Route on R1


ip route vrf Cust-A 10.5.5.0 255.255.255.0 192.1.15.5

router bgp 1000

 address-family ipv4 vrf Cust-A
  redistribute static

Default Route on R5


ip route 0.0.0.0 0.0.0.0 192.1.15.1

Static Route on R4


ip route vrf Cust-A 10.8.8.0 255.255.255.0 192.1.48.8

router bgp 1000

 address-family ipv4 vrf Cust-A
  redistribute static

Task 6 - Customer B Route Exchange

R1 Configuration


ip route vrf Cust-B 10.6.6.0 255.255.255.0 192.1.16.6

router bgp 1000

 address-family ipv4 vrf Cust-B
  redistribute static

R4 Configuration


ip route vrf Cust-B 10.7.7.0 255.255.255.0 192.1.47.7

router bgp 1000

 address-family ipv4 vrf Cust-B
  redistribute static

Verification Commands

Verify OSPF Neighbors


show ip ospf neighbor

Verify MPLS Interfaces


show mpls interfaces

Verify MPLS Labels


show mpls forwarding-table

Verify VRF Routing Table


show ip route vrf Cust-A

Verify VPNv4 Routes


show bgp vpnv4 unicast all

Troubleshooting MPLS VPN

OSPF Neighbor Issues

  • Check interface IP addressing
  • Verify subnet masks
  • Check OSPF area mismatch
  • Verify interfaces are up

MPLS LDP Issues

  • Verify MPLS enabled on interfaces
  • Check LDP router-id
  • Verify IGP reachability

BGP VPNv4 Issues

  • Verify VPNv4 address family activated
  • Check loopback reachability
  • Verify update-source configuration

Advanced MPLS Mathematical Concepts

Traffic Engineering Formula

$$ BW_{available} = BW_{total} - BW_{used} $$

Optimal path selection:

$$ Path_{optimal} = Min(Cost + Congestion) $$

VPN Route Scaling

Without MPLS VPN:

$$ Routing\ Entries = Customers \times Prefixes $$

With VRF isolation:

$$ Entries = Separate\ Routing\ Tables $$

MPLS Label Stack Formula

$$ Packet = VPN\ Label + Transport\ Label + Payload $$

Example:

$$ Packet = 200 + 400 + IP $$

SPF Tree Calculation

Shortest Path First:

$$ SPF = Min\left( \sum Cost_i \right) $$

Complete Packet Flow Explanation

  1. R5 sends packet to R1.
  2. R1 checks VRF Cust-A.
  3. R1 pushes VPN and transport labels.
  4. R2 swaps labels.
  5. R3 swaps labels.
  6. R4 removes transport label.
  7. R4 forwards packet inside Cust-A VRF.
  8. Packet reaches R8.

Why MPLS VPN Is Important

Feature Benefit
Scalability Supports thousands of customers
Isolation Separate customer routing tables
Performance Fast label switching
Security Customer separation using VRFs
Flexibility Supports multiple VPN services

Reload Instructions

After completing the lab:


reload

Do not save the configuration if preparing for the next lab exercise.



Final Summary

This MPLS Layer 3 VPN lab demonstrated:

  • OSPF provider core routing
  • MPLS label switching
  • LDP label distribution
  • MP-BGP VPNv4 peering
  • VRF customer isolation
  • Customer route exchange
  • End-to-end MPLS VPN communication

๐ŸŽฏ Final Takeaway

MPLS VPN allows service providers to securely transport customer routes over a shared backbone while maintaining scalability, isolation and high performance.

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