MPLS Layer 3 VPN Configuration
MPLS Layer 3 VPN Configuration
com
Search...
Table of Contents
MPLS
Unit 1: Introduction
https://networklessons.com/mpls/mpls-layer-3-vpn-configuration 1/19
4/29/2019 MPLS Layer 3 VPN Configuration | NetworkLessons.com
Above we have ve routers where AS 234 is the service provider. There’s one customer with two sites, AS 1 and AS 5. Our customer wants to
exchange 1.1.1.1 /32 and 5.5.5.5 /32 between its sites using BGP. To achieve this, we’ll have to do a couple of things:
Con gure IGP and LDP within the service provider network.
Con gure VRFs on the PE routers.
Con gure IBGP between the PE routers.
Con gure BGP between the PE and CE routers.
There are a lot of di erence pieces in the MPLS puzzle to make this work. Instead of con guring everything at once and praying that it will
work, we’ll build this network step-by-step. At each step, I’ll show you how to verify that it’s working before we continue with the next step.
Configuration
IGP and LDP
First we will con gure the service provider network. On the PE1, P and PE2 routers we will create a loopback interface that will be advertised in
OSPF. LDP will then uses the addresses as the transport address for the TCP connection. Let’s add those interfaces and enable OSPF:
PE1(config)#interface loopback 0
PE1(config-if)#ip address 2.2.2.2 255.255.255.255
P(config)#interface loopback 0
P(config-if)#ip address 3.3.3.3 255.255.255.255
https://networklessons.com/mpls/mpls-layer-3-vpn-configuration 2/19
4/29/2019 MPLS Layer 3 VPN Configuration | NetworkLessons.com
PE2(config)#interface loopback 0
PE2(config-if)#ip address 4.4.4.4 255.255.255.255
Now we will con gure OSPF to advertise all interfaces in the service provider network:
PE1(config)#router ospf 1
PE1(config-router)#network 192.168.23.0 0.0.0.255 area 0
PE1(config-router)#network 2.2.2.2 0.0.0.0 area 0
P(config)#router ospf 1
P(config-router)#network 192.168.23.0 0.0.0.255 area 0
P(config-router)#network 192.168.34.0 0.0.0.255 area 0
P(config-router)#network 3.3.3.3 0.0.0.0 area 0
PE2(config)#router ospf 1
PE2(config-router)#network 192.168.34.0 0.0.0.255 area 0
PE2(config-router)#network 4.4.4.4 0.0.0.0 area 0
https://networklessons.com/mpls/mpls-layer-3-vpn-configuration 3/19
4/29/2019 MPLS Layer 3 VPN Configuration | NetworkLessons.com
Our P router in the middle has two neighbors so we know that LDP is working. Just to be sure, let’s check if we have connectivity between PE1
and PE2:
A quick ping tells us that it’s working. Are we switching based on labels though? Let’s do a trace to nd out:
Above you can see that we are using a label for the packet from PE1 to PE2. The P router is popping the label (penultimate hop popping) so PE1
receives a normal IP packet. So far, this is looking good.
First I will create a VRF called CUSTOMER. The next step will be con guring a RD (Route Distinguisher):
PE1(config-vrf)#rd ?
ASN:nn or IP-address:nn VPN Route Distinguisher
The RD is to make sure that all pre xes are unique. The customer pre x + RD together are a VPNv4 route. I’ll pick something simple:
PE1(config-vrf)#rd 1:1
https://networklessons.com/mpls/mpls-layer-3-vpn-configuration 4/19
4/29/2019 MPLS Layer 3 VPN Configuration | NetworkLessons.com
Our RD will be 1:1. The next item to con gure is the RT (Route Target). This de nes where we will import and export our VPNv4 routes. I want
to make sure that all routes from CE1 and CE2 will be exchanged:
I will use RT value 1:1 and use parameter both. This means that all routes of this VRF will be imported and exported.
I used the same value (1:1) for the RD and RT, keep in mind that these are two di erent things…don’t mix them up!
After creating the VRF globally, we have to assign the interface that is facing the customer to the VRF:
Once you add an interface to a VRF, Cisco IOS will remove its IP address. Let’s add it again:
The VRF con guration of PE1 is now complete. We’ll con gure the exact same thing on PE2:
The VRFs are now con gured. If you want to reach the CE1 or CE2 routers then you’ll have to use the VRFs from now on:
https://networklessons.com/mpls/mpls-layer-3-vpn-configuration 5/19
4/29/2019 MPLS Layer 3 VPN Configuration | NetworkLessons.com
In the con guration above I’m sourcing the iBGP updates from the loopback interface. We also enabled the VPNv4 address-family, this will
allow the router to exchange those VPNv4 routes. When you activate the VPNv4 address-family, the router will do one more thing for you:
Above you can see that the router automatically added the send-community extended command. This command is required and should
never be removed since we use a community to advertise the route-target.
The con guration of PE1 is complete, let’s con gure the same thing on PE2:
The iBGP con guration of the PE routers is now complete. There’s one more thing we could do…
Right now our routers will be able to exchange IPv4 unicast pre xes and VPNv4 routes. In our example however, the PE routers will only be
used to exchange VPNv4 routes so we can disable the address-family for IPv4 unicast. Here’s how you can do this:
This will disable the IPv4 unicast address-family. Let me show you the complete BGP con guration one more time:
https://networklessons.com/mpls/mpls-layer-3-vpn-configuration 6/19
4/29/2019 MPLS Layer 3 VPN Configuration | NetworkLessons.com
With this BGP con guration, we will use IPv4 to establish the neighbor adjacency but we won’t exchange IPv4 pre xes. The only thing we will
exchange are VPNv4 routes.
Before we continue we should check if IBGP is working or not. You’ll need to use some di erent commands however, here’s why:
The show ip bgp summary command won’t work since it is used to check IPv4 unicast pre xes. Here’s the command you need to use:
You need to use the show bgp vpnv4 command to look at anything that is related to the VPNv4 address-family. Above you can see that PE1
and PE2 have become neighbors, nothing has been exchanged yet since we don’t have any VPNv4 routes right now.
EBGP on PE and CE
The last piece of the puzzle is exchanging routes between the PE and CE routers. In this example, we’ll use EBGP. Let’s start with the CE routers:
CE1(config)#interface loopback 0
CE1(config-if)#ip address 1.1.1.1 255.255.255.255
CE1(config)#router bgp 1
CE1(config-router)#neighbor 192.168.12.2 remote-as 234
CE1(config-router)#network 1.1.1.1 mask 255.255.255.255
https://networklessons.com/mpls/mpls-layer-3-vpn-configuration 7/19
4/29/2019 MPLS Layer 3 VPN Configuration | NetworkLessons.com
CE2(config)#interface loopback 0
CE2(config-if)#ip address 5.5.5.5 255.255.255.255
CE2(config)#router bgp 5
CE2(config-router)#neighbor 192.168.45.4 remote-as 234
CE2(config-router)#network 5.5.5.5 mask 255.255.255.255
The con guration of the CE routers is straight forward, this is plain and simple eBGP. Let’s con gure the PE routers:
The interface that connects to the CE1 router is assigned to the VRF. This means we’ll have to create an address-family in BGP for this VRF:
Let’s nd out if we have established a BPG neighbor adjacency with the CE1 router:
Great, we have become neighbors and we received one pre x. Let’s take a closer look to see what we have learned:
Above you can see that we have learned pre x 1.1.1.1 /32 and we will use RD 1:1. These two values together are our VPNv4 route.
https://networklessons.com/mpls/mpls-layer-3-vpn-configuration 8/19
4/29/2019 MPLS Layer 3 VPN Configuration | NetworkLessons.com
Great, PE2 and CE2 are now neighbors. Did we learn anything?
Interesting…above you see two pre xes. The rst entry was learned through iBGP from the PE1 router. Take a close look at the next hop
address which is 2.2.2.2.
Normally when you use iBGP between two routers, the next hop address does not change automatically. That’s why we use BGP next hop self
sometimes to x reachability issues. For VPNv4 routes however the next hop address is changed automatically because the loopback address
of the other PE router will be the endpoint of the tunnel.
Everything is now in place, the only thing left to do is to verify our work.
Verification
I already showed you how to verify some of the things that we con gured but there is still a couple of things to check. We need to make sure
that there is connectivity between the CE routers and I will also show you how to check the transport and VPN labels that are used by the
routers.
First we will check if our CE routers have learned anything through BGP:
CE1#show ip bgp
BGP table version is 3, local router ID is 1.1.1.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale, m multipath, b backup-path, x best-external, f RT-Filter
Origin codes: i - IGP, e - EGP, ? - incomplete
https://networklessons.com/mpls/mpls-layer-3-vpn-configuration 9/19
4/29/2019 MPLS Layer 3 VPN Configuration | NetworkLessons.com
CE2#show ip bgp
BGP table version is 3, local router ID is 5.5.5.5
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale, m multipath, b backup-path, x best-external, f RT-Filter
Origin codes: i - IGP, e - EGP, ? - incomplete
CE1 and CE2 have learned about each others networks. Let’s try a quick ping, just to check if things are working or note:
Great, our ping is working! A trace is more interesting to look at however, it will show the transport and VPN label that we use:
Above you can see how the packet travels from CE1 to CE2:
Let’s take a closer look at the labels that we use. Here’s how you can nd the VPN label that the PE1 router will use for 5.5.5.5 /32:
The output above is interesting to look at. PE1 tells us that it has learned about 5.5.5.5 /32 in VRF CUSTOMER. The next hop address is 4.4.4.4
and the VPN label will be 19.
https://networklessons.com/mpls/mpls-layer-3-vpn-configuration 10/19
4/29/2019 MPLS Layer 3 VPN Configuration | NetworkLessons.com
The funny thing though is that the next hop is unreachable in the VRF because it’s in the global routing table:
This is an exception for VPNv4, based on the transport label the router knows to use the global routing table to gure out where 4.4.4.4/32 is.
Here’s a good way to see both labels and the logic of the PE1 router how it will reach the next hop:
Our PE1 router knows that in order to reach 5.5.5.5, it has to use 192.168.23.3 as the next hop (P router). In order to get there, we will use
transport label value 17. This packet will be forwarded to the P router which checks its own forwarding table to gure out what to do with it:
When the P router receives something with label 17, it will pop the label and forwards it to 4.4.4.4 (PE2 router). Once PE2 receives it, it will
check its forwarding table and nds this:
Anything that PE2 receives with label value 19 should have all its labels removed. This makes sense since CE2 doesn’t use MPLS, it uses regular
IP forwarding. You can also see that 5.5.5.5 /32 is a VPN route. Once PE2 has removed all the labels, it forwards the IP packet to CE2 and that’s
it.
Wireshark Captures
I gured it might be interesting to show you some wireshark captures of the things we discussed above. The rst example is a BGP update
where PE2 advertises the VPNv4 route for 5.5.5.5 /32 to PE1:
https://networklessons.com/mpls/mpls-layer-3-vpn-configuration 11/19
4/29/2019 MPLS Layer 3 VPN Configuration | NetworkLessons.com
The second capture will show you what the packet from 1.1.1.1 to 5.5.5.5 looks like when we receive it on the P router:
Above you see the ICMP request from CE1 to CE2, the rst label is the transport label (17) and the second label is the VPN label which has the
bottom of label stack bit set.
If you want to take a look for yourself, here are the links:
Conclusion
https://networklessons.com/mpls/mpls-layer-3-vpn-configuration 12/19
4/29/2019 MPLS Layer 3 VPN Configuration | NetworkLessons.com
That’s the end of this MPLS layer 3 VPN PE-CE con guration, if you understood everything and are able to con gure this on your own then any
of the other PE-CE scenarios will be no problem for you. In the next lessons I will show you how to con gure PE-CE with OSPF and EIGRP.
Configurations
Want to take a look for yourself? Here are the nal con gurations of all devices.
CE1
hostname CE1
!
ip cef
!
interface Loopback0
ip address 1.1.1.1 255.255.255.255
!
interface FastEthernet0/0
ip address 192.168.12.1 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet0/1
no ip address
shutdown
duplex auto
speed auto
!
router bgp 1
bgp log-neighbor-changes
network 1.1.1.1 mask 255.255.255.255
neighbor 192.168.12.2 remote-as 234
!
end
PE1
https://networklessons.com/mpls/mpls-layer-3-vpn-configuration 13/19
4/29/2019 MPLS Layer 3 VPN Configuration | NetworkLessons.com
hostname PE1
!
ip cef
!
ip vrf CUSTOMER
rd 1:1
route-target export 1:1
route-target import 1:1
!
interface Loopback0
ip address 2.2.2.2 255.255.255.255
!
interface FastEthernet0/0
ip vrf forwarding CUSTOMER
ip address 192.168.12.2 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet0/1
ip address 192.168.23.2 255.255.255.0
duplex auto
speed auto
mpls ip
!
router ospf 1
network 2.2.2.2 0.0.0.0 area 0
network 192.168.23.0 0.0.0.255 area 0
!
router bgp 234
bgp log-neighbor-changes
neighbor 4.4.4.4 remote-as 234
neighbor 4.4.4.4 update-source Loopback0
!
address-family ipv4
no neighbor 4.4.4.4 activate
exit-address-family
!
address-family vpnv4
neighbor 4.4.4.4 activate
neighbor 4.4.4.4 send-community extended
exit-address-family
!
address-family ipv4 vrf CUSTOMER
neighbor 192.168.12.1 remote-as 1
neighbor 192.168.12.1 activate
exit-address-family
!
end
https://networklessons.com/mpls/mpls-layer-3-vpn-configuration 14/19
4/29/2019 MPLS Layer 3 VPN Configuration | NetworkLessons.com
hostname P
!
ip cef
!
interface Loopback0
ip address 3.3.3.3 255.255.255.255
!
interface FastEthernet0/0
ip address 192.168.23.3 255.255.255.0
duplex auto
speed auto
mpls ip
!
interface FastEthernet0/1
ip address 192.168.34.3 255.255.255.0
duplex auto
speed auto
mpls ip
!
router ospf 1
network 3.3.3.3 0.0.0.0 area 0
network 192.168.23.0 0.0.0.255 area 0
network 192.168.34.0 0.0.0.255 area 0
!
ip forward-protocol nd
no ip http server
no ip http secure-server
!
end
PE2
https://networklessons.com/mpls/mpls-layer-3-vpn-configuration 15/19
4/29/2019 MPLS Layer 3 VPN Configuration | NetworkLessons.com
hostname PE2
!
ip vrf CUSTOMER
rd 1:1
route-target export 1:1
route-target import 1:1
!
ip cef
!
interface Loopback0
ip address 4.4.4.4 255.255.255.255
!
interface FastEthernet0/0
ip address 192.168.34.4 255.255.255.0
duplex auto
speed auto
mpls ip
!
interface FastEthernet0/1
ip vrf forwarding CUSTOMER
ip address 192.168.45.4 255.255.255.0
duplex auto
speed auto
!
router ospf 1
network 4.4.4.4 0.0.0.0 area 0
network 192.168.34.0 0.0.0.255 area 0
!
router bgp 234
bgp log-neighbor-changes
neighbor 2.2.2.2 remote-as 234
neighbor 2.2.2.2 update-source Loopback0
!
address-family ipv4
no neighbor 2.2.2.2 activate
exit-address-family
!
address-family vpnv4
neighbor 2.2.2.2 activate
neighbor 2.2.2.2 send-community extended
exit-address-family
!
address-family ipv4 vrf CUSTOMER
neighbor 192.168.45.5 remote-as 5
neighbor 192.168.45.5 activate
exit-address-family
!
end
CE2
https://networklessons.com/mpls/mpls-layer-3-vpn-configuration 16/19
4/29/2019 MPLS Layer 3 VPN Configuration | NetworkLessons.com
hostname CE2
!
ip cef
!
interface Loopback0
ip address 5.5.5.5 255.255.255.255
!
interface FastEthernet0/0
ip address 192.168.45.5 255.255.255.0
duplex auto
speed auto
!
router bgp 5
bgp log-neighbor-changes
network 5.5.5.5 mask 255.255.255.255
neighbor 192.168.45.4 remote-as 234
!
end
« Previous Lesson
MPLS L3 VPN Explained
Next Lesson
MPLS L3 VPN BGP Allow AS
in
»
Tags: PE-CE, VRF
Forum Replies
milan9
Great as always. Just one minor issue. On the rst topology picture, shouldnt the provider AS number be 123 as you stated in text instead of AS 234 or vice versa?
ReneMolenaar
@Zaman.rubd @lagapides
The output is correct, keep in mind that MPLS traceroute works a bit di erent than regular IP traceroute:
https://www.cisco.com/c/en/us/support/docs/multiprotocol-label-switching-mpls/mpls/26585-mpls-traceroute.html
I think they show the IP address of the remote PE router in the VRF on purpose, instead of the interface that connects to the P router. The IP address of the PE
router in the VRF is reachable from the CE1 router, making it useful for troubleshooting.
van.de.bergz
Hi. Thanks for the lesson. It helped me learn something about MPLS.
One question though. What if I want to connect another 2 CE routers, and wants to add more VRF? I’ve tried adding new address-family ipv4 vrf to existing BGP
process in PE1 and PE2, and redistribute the new routing protocol by adding it to address-family ipv4 vrf and all just like in the lesson, but to no success. The new
router still can’t ping successfully.
https://networklessons.com/mpls/mpls-layer-3-vpn-configuration 17/19
4/29/2019 MPLS Layer 3 VPN Configuration | NetworkLessons.com
What’s needed to add new networks to the MPLS VPN? I maybe haven’t understood it all completely.
ReneMolenaar
Hello Ivan,
https://networklessons.com/bgp/bgp-pic-pre x-independent-convergence-core-edge/
In that example, I have redundant P and PE routers but I didn’t use MPLS there. What you need for MPLS VPN is:
The P routers only run an IGP and MPLS on the interfaces so that’s straight-forward.
The PE routers require a full mesh of iBGP for the VPN routes but you could also use a route-re ector instead. Both interfaces that connect to the customer
are in the same VRF.
If you can con gure a MPLS VPN topology without redundancy t
lagapides
Hello Ivan.
According to Cisco:
VRRP is supported on Ethernet, Fast Ethernet, Bridge Group Virtual Interface (BVI), and Gigabit Ethernet interfaces, and on Multiprotocol Label Switching (MPLS)
Virtual Private Networks (VPNs), VRF-aware MPLS VPNs, and VLANs.
link
HSRP, FRRP and GLBP are all protocols that fall into the category of First Hop Redundancy Protocols (FHRP).
Laz
77 more replies! Ask a question or join the discussion by visiting our Community Forum
Hello There!
I am René Molenaar (CCIE
#41726), Your main Instructor.
My goal is to teach you
everything about Cisco,
Wireless and Security. I am
here to Help You Master Networking!
Read my story
Social Fans
https://networklessons.com/mpls/mpls-layer-3-vpn-configuration 18/19
4/29/2019 MPLS Layer 3 VPN Configuration | NetworkLessons.com
14,319 9,788
FANS FOLLOWERS
658 14,352
FOLLOWERS SUBSCRIBERS
New Lessons
Device Programmability
Data Models and Structures
Network Automation and Orchestration
Cloud Connectivity
Virtualization Functions (NFVI, VNF)
Tag Cloud
802.1Q 802.1X ACL ARP Authentication
Certi cate Cloud Design DMVPN DHCP
Filtering GRE IGMP IKE IOS
IP Routing IPSec LDP Linux
Load Balancing LSA NAT Network Management
Disclaimer
Privacy Policy
Support
© 2013 - 2019 NetworkLessons.com 21871
https://networklessons.com/mpls/mpls-layer-3-vpn-configuration 19/19