MPLS L3VPN Configuration Guide [Step by Step]
Topology (GNS3 Lab):
We will pass through the Configuration of MPLS and L3VPN service step by step, this Topology was created with GNS3.
Step 1: Enable MPLS on P & PE
First, we need to enable MPLS on Provider EDGE and Core routers:
On (P) and (PE) routers, we will enable MPLS by entering the command “mpls ip” under all the interfaces which are part of the MPLS backbone.
In our case, we should activate MPLS under the interfaces below:
- for PE-1: “FastEthernet0/1”
- for P1: “FastEthernet0/0” and “FastEthernet0/1”
- for P2: “FastEthernet0/0” and “FastEthernet0/1”
- for PE-2: “FastEthernet0/0”
* Configuration:
On Router P1:
P1(config)# interface FastEthernet0/0
P1(config-if)# mpls ip
P1(config-if)# interface FastEthernet0/1
P1(config-if)# mpls ip
On Router PE-1:
PE-1(config)# interface FastEthernet0/1
PE-1(config-if)# mpls ip
On Router P-2:
P2(config)# interface FastEthernet0/0
P2(config-if)# mpls ip
P2(config-if)# interface FastEthernet0/1
P2(config-if)# mpls ip
On Router PE-2:
PE-1(config)# interface FastEthernet0/0
PE-1(config-if)# mpls ip
An Alternative way to Enable LDP and MPLS is by using the OSPF LDP autoconfig feature:
PE-1(config)#router ospf 10
PE-1(config-router)#mpls ldp autoconfig area 0
* Verification:
We can verify using the command: “show mpls interfaces” or “show mpls ldp neighbor“:
PE-1#show mpls interfaces
Interface IP Tunnel BGP Static Operational
FastEthernet0/1 Yes (ldp) No No No Yes
P1#show mpls ldp neighbor
Peer LDP Ident: 10.10.10.2:0; Local LDP Ident 10.10.10.1:0
TCP connection: 10.10.10.2.49750 - 10.10.10.1.646
State: Oper; Msgs sent/rcvd: 41/41; Downstream
Up time: 00:28:01
LDP discovery sources:
FastEthernet0/1, Src IP addr: 1.1.2.2
Addresses bound to peer LDP Ident:
1.1.2.2 10.10.10.2 1.1.3.1
Peer LDP Ident: 10.10.13.1:0; Local LDP Ident 10.10.10.1:0
TCP connection: 10.10.13.1.20438 - 10.10.10.1.646
State: Oper; Msgs sent/rcvd: 42/50; Downstream
Up time: 00:27:50
LDP discovery sources:
FastEthernet0/0, Src IP addr: 1.1.1.2
Addresses bound to peer LDP Ident:
1.1.1.2 10.10.13.1
Step 2: Basic IP assigment and Intra-BB OSPF routing configuration
First of all, we will configure the interfaces of P and PE with the basic IP assignment:
PE-1 router:
interface Loopback1
ip address 10.10.13.1 255.255.255.255
!
interface FastEthernet0/1
ip address 1.1.1.2 255.255.255.252
mpls ip
speed auto
duplex auto
!
router ospf 100
router-id 10.10.13.1
network 1.1.1.0 0.0.0.3 area 0
network 10.10.13.1 0.0.0.0 area 0
P-1 router:
interface Loopback1
ip address 10.10.10.1 255.255.255.255
!
interface FastEthernet0/0
ip address 1.1.1.1 255.255.255.252
speed auto
duplex auto
mpls ip
!
interface FastEthernet0/1
ip address 1.1.2.1 255.255.255.252
speed auto
duplex auto
mpls ip
!
router ospf 100
router-id 10.10.10.1
network 1.1.1.0 0.0.0.3 area 0
network 1.1.2.0 0.0.0.3 area 0
network 10.10.10.1 0.0.0.0 area 0
P-2 router:
interface Loopback1
ip address 10.10.10.2 255.255.255.255
!
interface FastEthernet0/0
ip address 1.1.2.2 255.255.255.252
speed auto
duplex auto
mpls ip
!
interface FastEthernet0/1
ip address 1.1.3.1 255.255.255.252
speed auto
duplex auto
mpls ip
!
router ospf 100
router-id 10.10.10.2
network 1.1.2.0 0.0.0.3 area 0
network 1.1.3.0 0.0.0.3 area 0
network 10.10.10.2 0.0.0.0 area 0
PE-2 router:
interface Loopback1
ip address 10.10.14.1 255.255.255.255
!
interface FastEthernet0/0
ip address 1.1.3.2 255.255.255.252
speed auto
duplex auto
mpls ip
!
router ospf 100
router-id 10.10.14.1
network 1.1.3.0 0.0.0.3 area 0
network 10.10.14.1 0.0.0.0 area 0
Step 3: Configure MP-BGP on PE Routers
MP-BGP is configured only on the PE routers: P routers rely entirely on the provider IGP and MPLS to forward traffic through the provider network, and CE routers have no knowledge of routes outside their own VRF.
On PE-1 router:
router bgp 65000
bgp log-neighbor-changes
neighbor 10.10.14.1 remote-as 65000
neighbor 10.10.14.1 update-source Loopback1
!
address-family vpnv4
neighbor 10.10.14.1 activate
neighbor 10.10.14.1 send-community extended
exit-address-family
On PE-2 router:
router bgp 65000
bgp log-neighbor-changes
neighbor 10.10.13.1 remote-as 65000
neighbor 10.10.13.1 update-source Loopback1
!
address-family vpnv4
neighbor 10.10.13.1 activate
neighbor 10.10.13.1 send-community extended
exit-address-family
Step 4: Configure VRF per Customer on PE routers
on PE-1:
ip vrf Customer_A
rd 65000:1
route-target export 65000:1
route-target import 65000:1
!
ip vrf Customer_B
rd 65000:2
route-target export 65000:2
route-target import 65000:2
on PE-2:
ip vrf Customer_A
rd 65000:1
route-target export 65000:1
route-target import 65000:1
!
ip vrf Customer_B
rd 65000:2
route-target export 65000:2
route-target import 65000:2
Step 5: Configure OSPF adjacency between CE-PE
Customer A:
On PE-1:
interface FastEthernet0/0
ip vrf forwarding Customer_A
ip address 1.1.3.1 255.255.255.252
ip ospf 2 area 0
speed auto
duplex auto
!
router ospf 2 vrf Customer_A
router-id 1.1.3.1
redistribute bgp 65000 subnets
On PE-2:
interface FastEthernet0/1
ip vrf forwarding Customer_A
ip address 1.1.6.1 255.255.255.252
ip ospf 2 area 0
speed auto
duplex half
!
router ospf 2 vrf Customer_A
router-id 1.1.6.1
redistribute bgp 65000 subnets
Customer B:
On PE-1:
interface FastEthernet1/0
ip vrf forwarding Customer_B
ip address 2.2.3.1 255.255.255.252
ip ospf 3 area 0
duplex full
!
router ospf 3 vrf Customer_B
router-id 2.2.3.1
redistribute bgp 65000 subnets
On PE-2:
interface FastEthernet1/0
ip vrf forwarding Customer_B
ip address 2.2.6.1 255.255.255.252
ip ospf 3 area 0
duplex full
!
router ospf 3 vrf Customer_B
router-id 2.2.6.1
redistribute bgp 65000 subnets
Step 6: Route Redistribution
On PE-1:
router ospf 2 vrf Customer_A
router-id 1.1.3.1
redistribute bgp 65000 subnets
router ospf 3 vrf Customer_B
router-id 2.2.3.1
redistribute bgp 65000 subnets
!!
router bgp 65000
address-family ipv4 vrf Customer_A
redistribute ospf 2
exit-address-family
!
address-family ipv4 vrf Customer_B
redistribute ospf 3
exit-address-family
On PE-2:
router ospf 2 vrf Customer_A
router-id 1.1.6.1
redistribute bgp 65000 subnets
router ospf 3 vrf Customer_B
router-id 2.2.6.1
redistribute bgp 65000 subnets
!!
router bgp 65000
address-family ipv4 vrf Customer_A
redistribute ospf 2
exit-address-family
!
address-family ipv4 vrf Customer_B
redistribute ospf 3
exit-address-family
Verification:
- MPLS forwarding Table:
PE-1:
PE-1#show mpls forwarding-table
Local Outgoing Prefix Bytes Label Outgoing Next Hop
Label Label or Tunnel Id Switched interface
16 16 10.10.10.2/32 0 Fa0/1 1.1.1.1
17 Pop Label 10.10.10.1/32 0 Fa0/1 1.1.1.1
18 17 1.1.3.0/30 0 Fa0/1 1.1.1.1
19 Pop Label 1.1.2.0/30 0 Fa0/1 1.1.1.1
20 18 10.10.14.1/32 0 Fa0/1 1.1.1.1
21 No Label 1.1.3.0/30[V] 0 aggregate/Customer_A
22 No Label 10.10.11.1/32[V] 2173386 Fa0/0 1.1.3.2
23 No Label 2.2.3.0/30[V] 2442 aggregate/Customer_B
24 No Label 10.20.11.1/32[V] 0 Fa1/0 2.2.3.2
PE-1#
PE-2:
PE-2#show mpls forwarding-table
Local Outgoing Prefix Bytes Label Outgoing Next Hop
Label Label or Tunnel Id Switched interface
16 19 10.10.13.1/32 0 Fa0/0 1.1.3.1
17 Pop Label 10.10.10.2/32 0 Fa0/0 1.1.3.1
18 16 10.10.10.1/32 0 Fa0/0 1.1.3.1
19 17 1.1.1.0/30 0 Fa0/0 1.1.3.1
20 Pop Label 1.1.2.0/30 0 Fa0/0 1.1.3.1
21 No Label 1.1.6.0/30[V] 0 aggregate/Customer_A
22 No Label 10.10.12.1/32[V] 1018150 Fa0/1 1.1.6.2
23 No Label 2.2.6.0/30[V] 0 aggregate/Customer_B
24 No Label 10.20.22.1/32[V] 1812 Fa1/0 2.2.6.2