Configuring MPLS L3 VPN on Cisco using GNS3 (cont.)

Configuring MPLS L3 VPN on Cisco using GNS3 (cont.)

·

7 min read

Introduction

Ahh yes...configuration. Let us take a look in our simple topology below. I made it like that just to understand the basics:

[NOTE] This is the second part this content. You can see our MPLS overview here.

Before we start our configuration, you might want to read some important terms:

  1. Provider (P) router - router(s) that serves as core devices; they do not need to know any customer routes.

  2. Provider Edge (PE) router - router(s) that are placed nearest to the customer router (CE) that have a direct connection; they know customer routes.

  3. Customer Edge (CE) - customer routers used to connect to the Multi-Protocol Label Switching (MPLS) network via connection with Provider Edge (PE) router.

  4. Virtual Routing and Forwarding (VRF) - basically instance of logical router inside a router.

Keep in mind that we have two (2) characters here: Service Provider and Customer

Configuration Time!

Setting up the MPLS underlay

For our MPLS network to work, what we need is to have our routers reach each others via IP routing. In this setup, we will use Open Shortest Path First (OSPF) (IGP) as routers mode in reaching each other. In this stage, our goal is to make our routers can reach each other.

PE-RTR-1:

PE-RTR-1#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
PE-RTR-1(config)#interface loopback0
PE-RTR-1(config-if)#ip address 1.1.1.11 255.255.255.255
PE-RTR-1(config-if)#exit
PE-RTR-1(config)#interface g0/0
PE-RTR-1(config-if)#no shut
PE-RTR-1(config-if)#interface g0/0.2
PE-RTR-1(config-subif)#encapsulation dot1q 2
PE-RTR-1(config-subif)#ip address 10.0.0.2 255.255.255.252
PE-RTR-1(config-subif)#exit
PE-RTR-1(config)#router ospf 1
PE-RTR-1(config-router)#passive-interface loopback0
PE-RTR-1(config-router)#exit
PE-RTR-1(config)#interface loopback0
PE-RTR-1(config-if)#ip ospf 1 area 0.0.0.0
PE-RTR-1(config-if)#exit
PE-RTR-1(config)#interface g0/0.2
PE-RTR-1(config-subif)#ip ospf 1 area 0.0.0.0
PE-RTR-1(config-if)#exit
PE-RTR-1(config)#

Here I used subinterfaces as I want to play along with the configuration. Do not worry, you can do it without subinterfaces (just configure IP address after issuing the no shut command in the physical interface). Loopback interfaces' purpose is for BGP to set its router ID automatically. Also, passive-interface command disables loopback0 to send OSPF Hello packets.

PE-RTR-2:

PE-RTR-2#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
PE-RTR-2(config)#interface loopback0
PE-RTR-2(config-if)#ip address 1.1.1.12 255.255.255.255
PE-RTR-2(config-if)#exit
PE-RTR-2(config)#interface g0/0
PE-RTR-2(config-if)#no shut
PE-RTR-2(config-if)#interface g0/0.4
PE-RTR-2(config-subif)#encapsulation dot1q 4
PE-RTR-2(config-subif)#ip address 10.0.0.6 255.255.255.252
PE-RTR-2(config-subif)#exit
PE-RTR-2(config-subif)#router ospf 1
PE-RTR-2(config-router)#passive-interface loopback0
PE-RTR-2(config-router)#exit
PE-RTR-2(config)#interface loopback0
PE-RTR-2(config-if)#ip ospf 1 area 0.0.0.0
PE-RTR-2(config-if)#exit
PE-RTR-2(config)#interface g0/0.4
PE-RTR-2(config-subif)#ip ospf 1 area 0.0.0.0
PE-RTR-2(config-if)#exit
PE-RTR-2(config)#

The same configuration setup for PE-RTR-2.

P-RTR-1:

P-RTR-1#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
P-RTR-1(config)#interface loopback0
P-RTR-1(config-if)#ip addr
P-RTR-1(config-if)#ip address 1.1.1.0 255.255.255.255
P-RTR-1(config-if)#exit
P-RTR-1(config)#interface g5/0
P-RTR-1(config-if)#no shut
P-RTR-1(config-if)#exit
P-RTR-1(config)#interface g5/0.2
P-RTR-1(config-subif)#encapsulation dot1q 2
P-RTR-1(config-subif)#ip address 10.0.0.1 255.255.255.252
P-RTR-1(config-subif)#exit
P-RTR-1(config)#interface g4/0
P-RTR-1(config-if)#no shut
P-RTR-1(config-if)#exit
P-RTR-1(config)#interface g4/0.4
P-RTR-1(config-subif)#encapsulation dot1q 4
P-RTR-1(config-subif)#ip address 10.0.0.5 255.255.255.252
P-RTR-1(config-subif)#exit
P-RTR-1(config)#router ospf 1
P-RTR-1(config-router)#passive-interface loopback0
P-RTR-1(config-router)#exit
P-RTR-1(config)#interface loopback0
P-RTR-1(config-if)#ip ospf 1 area 0.0.0.0
P-RTR-1(config-if)#exit
P-RTR-1(config)#interface g5/0.2
P-RTR-1(config-subif)#ip ospf 1 area 0.0.0.0
P-RTR-1(config-subif)#exit
P-RTR-1(config)#interface g4/0.
P-RTR-1(config)#interface g4/0.4
P-RTR-1(config-subif)#ip ospf 1 area 0.0.0.0
P-RTR-1(config-subif)#exit
P-RTR-1(config)#

We can now see that routers PE-RTR-1 and PE-RTR-2 established an OSPF neighborship with P-RTR-1. You can also verify connectivity via ping and show ip route.

Enabling OSPF in loopback interfaces resulted in routers advertising it in the OSPF updates and routers install routes for it. You can see below that P-RTR-1 learns loopback interfaces addresses via OSPF.

Enable Multi-Protocol Label Switching (MPLS) Functionality

Now that routers can reach each other via IP routing, we enable MPLS using mpls ip interface subcommand. The example below is for P-RTR-1. Repeat it in PE routers specifying the right interface.

P-RTR-1#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
P-RTR-1(config)#interface g5/0.2
P-RTR-1(config-subif)#mpls ip
P-RTR-1(config-subif)#exit
P-RTR-1(config)#
P-RTR-1(config)#interface g4/0.4
P-RTR-1(config-subif)#mpls ip
P-RTR-1(config-subif)#
P-RTR-1(config-subif)#exit
P-RTR-1(config)#

In P-RTR-1, notice that there are notification that MPLS neighborship is now activated. This should be the same in PE routers.

MPLS can be verified using show mpls forwarding-table {detail}. You can see that labels are distributed on each interface.

Configuring Customer Virtual Routing and Forwarding (VRF) Instances

This is part starts our MPLS L3 VPN configuration. What we need is to create a VRF instance for our specific customer (A-CUST) in our PE routers. We are going to do it twice as A-CUST has two (2) sites: A-CUST-SITE-1 and A-CUST-SITE-2.

PE-RTR-1 and PE-RTR-2:

# PE-RTR-1 CONFIGURATION
PE-RTR-1(config)#ip vrf A-CUST
PE-RTR-1(config-vrf)#rd 2914:101
PE-RTR-1(config-vrf)#route-target both 2914:101
PE-RTR-1(config-vrf)#exit
PE-RTR-1(config)#

# PE-RTR-2 CONFIGURATION
PE-RTR-2(config)#ip vrf A-CUST
PE-RTR-2(config-vrf)#rd 2914:101
PE-RTR-2(config-vrf)#route-target export 2914:101
PE-RTR-2(config-vrf)#route-target import 2914:101
PE-RTR-2(config-vrf)#exit
PE-RTR-2(config)#

VRF is created for A-CUST in both PEs. The command route-target both AAAA:NNN is both route-target import AAAA:NNN and route-target export AAAA:NNN.

Establishing BGP session between CE and PE routers

We are going to establish a connection through BGP peering. We will use it to advertise routes between customer sites.

PE-RTR-1 and A-CUST-SITE-1:

# PE-RTR-1 CONFIGURATION
PE-RTR-1#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
PE-RTR-1(config)#interface fa6/1
PE-RTR-1(config-if)#no shut
PE-RTR-1(config-if)#exit
PE-RTR-1(config)#interface fa6/1.11
PE-RTR-1(config-subif)#ip vrf forwarding A-CUST //places the interface to the VRF
PE-RTR-1(config-subif)#encapsulation dot1q 11
PE-RTR-1(config-subif)#ip address 172.16.11.1 255.255.255.248
PE-RTR-1(config-subif)#exit
PE-RTR-1(config)#router bgp 2914
PE-RTR-1(config-router)#address-family ipv4 vrf A-CUST //enters the VRF instance under BGP configuration
PE-RTR-1(config-router-af)#neighbor 172.16.11.2 remote-as 65001
PE-RTR-1(config-router-af)#

# A-CUST-SITE-1 CONFIGURATION
A-CUST-SITE-1(config)#interface loopback0
A-CUST-SITE-1(config-if)#ip address 15.15.15.1 255.255.255.255
A-CUST-SITE-1(config-if)#exit
A-CUST-SITE-1(config)#interface fa6/0
A-CUST-SITE-1(config-if)#no shut
A-CUST-SITE-1(config-if)#exit
A-CUST-SITE-1(config)#interface fa6/0.11
A-CUST-SITE-1(config-subif)#encapsulation dot1q 11
A-CUST-SITE-1(config-subif)#ip address 172.16.11.2 255.255.255.248
A-CUST-SITE-1(config-subif)#exit
A-CUST-SITE-1(config)#router bgp 65001
A-CUST-SITE-1(config-router)#neighbor 172.16.11.1 remote-as 2914
A-CUST-SITE-1(config-router)#
*Apr 28 11:59:44.447: %BGP-5-ADJCHANGE: neighbor 172.16.11.1 Up

PE-RTR-2 and A-CUST-SITE-2:

# PE-RTR-2 CONFIGURATION
PE-RTR-2#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
PE-RTR-2(config)#interface fa6/1
PE-RTR-2(config-if)#no shut
PE-RTR-2(config-if)#exit
PE-RTR-2(config)#interface fa6/1.12
PE-RTR-2(config-subif)#ip vrf forwarding A-CUST //places the interface to the VRF
PE-RTR-2(config-subif)#encapsulation dot1q 12
PE-RTR-2(config-subif)#ip address 172.16.12.1 255.255.255.248
PE-RTR-2(config-subif)#exit
PE-RTR-2(config)#router bgp 2914
PE-RTR-2(config-router)#address-family ipv4 vrf A-CUST //enters the VRF instance under BGP configuration
PE-RTR-2(config-router-af)#neighbor 172.16.12.2 remote-as 65002
PE-RTR-2(config-router-af)#

# A-CUST-SITE-2 CONFIGURATION
A-CUST-SITE-2#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
A-CUST-SITE-2(config)#interface loopback0
A-CUST-SITE-2(config-if)#ip address 15.15.15.2 255.255.255.255
A-CUST-SITE-2(config-if)#exit
A-CUST-SITE-2(config)#interface fa6/0
A-CUST-SITE-2(config-if)#no shut
A-CUST-SITE-2(config-if)#exit
A-CUST-SITE-2(config)#interface fa6/0.12
A-CUST-SITE-2(config-subif)#encapsulation dot1q 12
A-CUST-SITE-2(config-subif)#ip address 172.16.12.2 255.255.255.248
A-CUST-SITE-2(config-subif)#exit
A-CUST-SITE-2(config)#router bgp 65002
A-CUST-SITE-2(config-router)#neighbor 172.16.12.1 remote-as 2914
A-CUST-SITE-2(config-router)#
*Apr 28 12:03:57.799: %BGP-5-ADJCHANGE: neighbor 172.16.12.1 Up

Interfaces on PE routers are placed in VRF we created. This means we put interface in our logical router. Using our router instances under BGP configuration neighbor is configured and established.

Using Multi-Protocol BGP (MP-BGP) to share customer routes

# PE-RTR-1 CONFIGURATION
PE-RTR-1#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
PE-RTR-1(config)#router bgp 2914
PE-RTR-1(config-router)#no bgp default ipv4-unicast //can be optional
PE-RTR-1(config-router)#neighbor 1.1.1.12 remote-as 2914
PE-RTR-1(config-router)#neighbor 1.1.1.12 update-source loopback0
PE-RTR-1(config-router)#address-family vpnv4
PE-RTR-1(config-router-af)#neighbor 1.1.1.12 activate
PE-RTR-1(config-router-af)#neighbor 1.1.1.12 send-community both
PE-RTR-1(config-router-af)#

# PE-RTR-2 CONFIGURATION
PE-RTR-2#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
PE-RTR-2(config)#router bgp 2914
PE-RTR-2(config-router)#no bgp default ipv4-unicast //can be optional
PE-RTR-2(config-router)#neighbor 1.1.1.11 remote-as 2914
PE-RTR-2(config-router)#neighbor 1.1.1.11 update-source loopback0
PE-RTR-2(config-router)#address-family vpnv4
PE-RTR-2(config-router-af)#neighbor 1.1.1.11 activate
PE-RTR-2(config-router-af)#neighbor 1.1.1.11
PE-RTR-2(config-router-af)#neighbor 1.1.1.11 send-community both
*Apr 28 12:31:01.491: %BGP-5-ADJCHANGE: neighbor 1.1.1.11 Up

Above configuration established Multi-Protocol BGP (MP-BGP) between PE routers. Below completes it by advertising the routes to the Multi-Protocol BGP (MP-BGP).

# PE-RTR-1 CONFIGURATION
PE-RTR-1#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
PE-RTR-1(config)#router bgp 2914
PE-RTR-1(config-router)#address-family ipv4 vrf A-CUST
PE-RTR-1(config-router-af)#network 172.16.11.0 mask 255.255.255.248
PE-RTR-1(config-router-af)#

# PE-RTR-2 CONFIGURATION
PE-RTR-2#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
PE-RTR-2(config)#router bgp 2914
PE-RTR-2(config-router)#addres-family ipv4 vrf A-CUST
PE-RTR-2(config-router)#address-family ipv4 vrf A-CUST
PE-RTR-2(config-router-af)#network 172.16.12.0 mask 255.255.255.248
PE-RTR-2(config-router-af)#

A-CUST-SITE-1 and A-CUST-SITE-2 can now see each other via BGP with the PE routers as the next hop router.

PE-RTR-1 and PE-RTR-2 has those routes as well

Testing Time!!!

We are now going to test the connectivity between A-CUST-SITE-1 and A-CUST-SITE-2. Let's see what will happen...

Success! Sites can now ping each other through our MPLS network.

In PE routers, we verified that it is using MPLS to deliver traffic between customer sites.

Conclusion

In today's content, we learned some fundamentals on how can we configure an MPLS L3 VPN for sites at different location to connect with each other. Step-by-step we explored how it is done, and at the end the connection is verified through ping and IOS verification commands.

I hope that you learned something from this content as well.

Any questions or suggestions? Comment it and I would be very happy to discuss that!

Did you find this article valuable?

Support Sammyski by becoming a sponsor. Any amount is appreciated!