If you are looking for an MPLS Tutorial or step by step mpls configuration examples, this basic MPLS configuration example will guide you from configuring the first router to 3 router MPLS core with 2 external sites.
Building the simple MPLS topology below this will consist of a 3 router MPLS core and two remote sites in the same VRF running OSPF as the PE-CE routing protocol. This will be quite a long post as I will be taking you through every single verification along the way to ensure you understand how each section works.
I will be using GNS3 and configuring the routers as we go so you can follow along.
Cisco MPLS Tutorial Topology
Step 1 – IP addressing of MPLS Core and OSPF
First bring 3 routers into your topology R1, R2, R3 position them as below. We are going to address the routers and configure ospf to ensure loopback to loopback connectivity between R1 and R3
You should now have full ip connectivity between R1, R2, R3 to verify this we need to see if we can ping between the loopbacks of R1 and R3
You could show the routing table here, but the fact that you can ping between the loopbacks is verification enough and it is safe to move on.
Step 2 – Configure LDP on all the interfaces in the MPLS Core
In order to run MPLS you need to enable it, there are two ways to do this.
- At each interface enter the mpls ip command
- Under the ospf process use the mpls ldp autoconfig command
For this tutorial we will be using the second option, so go int the ospf process and enter mpls ldp autoconfig – this will enable mpls label distribution protocol on every interface running ospf under that specific process.
You should see log messages coming up showing the LDP neighbors are up.
To verify the mpls interfaces the command is very simple – sh mpls interface
This is done on R2 and you can see that both interfaces are running mpls and using LDP
You can also verify the LDP neighbors with the sh mpls ldp neighbors command.
One more verification to confirm LDP is running ok is to do a trace between R1 and R3 and verify if you get MPLS Labels show up in the trace.
As you can see the trace to R2 used an MPLS Label in the path, as this is a very small MPLS core only one label was used as R3 was the final hop.
So to review we have now configured IP addresses on the MPLS core, enabled OSPF and full IP connectivity between all routers and finally enabled mpls on all the interfaces in the core and have established ldp neighbors between all routers.
The next step is to configure MP-BGP between R1 and R3
Step 3 – MPLS BGP Configuration between R1 and R3
We need to establish a Multi Protocol BGP session between R1 and R3 this is done by configuring the vpnv4 address family as below
You should see log messages showing the BGP sessions coming up.
To verify the BGP session between R1 and R3 issue the command sh bgp vpnv4 unicast all summary
You can see here that we do have a bgp vpnv4 peering to R3 – looking at the PfxRcd you can see it says 0 this is because we have not got any routes in BGP. We are now going to add two more routers to the topology. These will be the customer sites connected to R1 and R3. We will then create a VRF on each router and put the interfaces connected to each site router into that VRF.
Step 4 – Add two more routers, create VRFs
We will add two more routers into the topology so it now looks like the final topology
Router 4 will peer OSPF using process number 2 to a VRF configured on R1. It will use the local site addressing of 192.168.1.0/24.
Now at this point we have R4 peering to R1 but in the global routing table of R1 which is not what we want.
We are now going to start using VRF’s
What is a VRF in networking?
Virtual routing and forwarding (VRF) is a technology included in IP (Internet Protocol) that allows multiple instances of a routing table to co-exist in a router and work together but not interfere with each other.. This increases functionality by allowing network paths to be segmented without using multiple devices.
As an example if R1 was a PE Provider Edge router of an ISP and it had two customers that were both addressed locally with the 192.168.1.0/24 address space it could accommodate both their routing tables in different VRFs – it distinguishes between the two of them using a Route Distinguisher
So back to the topology – we now need to create a VRF on R1
For this mpls tutorial I will be using VRF RED
The RD and route-target do not need to be the same – and for a full explanation please read this post on Route Distinguishers
Route Distinguisher vs Route Target before proceeding.
So now we have configured the VRF on R1 we need to move the interface F0/1 into that VRF
Now notice what happens when you do that – the IP address is removed
You just need to re-apply it
Now if we view the config on R1 int f0/1 you can see the VRF configured.
Now we can start to look int VRF’s and how they operate – you need to understand now that there are 2 routing tables within R1
- The Global Routing Table
- The Routing Table for VRF RED
If you issue the command sh ip route this shows the routes in the global table and you will notice that you do not see 192.168.1.0/24
If you now issue the command sh ip route vrf red – this will show the routes in the routing table for VRF RED
NOTE: The VRF name is case sensitive!
We just need to enable OSPF on this interface and get the loopback address for R4 in the VRF RED routing table before proceeding.
You should see a log message showing the OSPF neighbor come up
If we now check the routes in the VRF RED routing table you should see 22.214.171.124 in there as well.
We now need to repeat this process for R3 & R6
Router 6 will peer OSPF using process number 2 to a VRF configured on R3. It will use the local site addressing of 192.168.2.0/24.
We also need to configure a VRF onto R3 as well.
So now we have configured the VRF on R3 we need to move the interface F0/1 into that VRF
Now notice what happens when you do that – the IP address is removed
You just need to re-apply it
ip address 192.168.2.1 255.255.255.0
Now if we view the config on R3 int f0/1 you can see the VRF configured.
Finally we just need to enable OSPF on that interface and verify the routes are in the RED routing table.
Check the routes in vrf RED
Ok so we have come a long way now let’s review the current situation. We now have this setup
R1,R2,R3 form the MPLS Core and are running OSPF with all loopbacks running a /32 address and all have full connectivity. R1 and R3 are peering with MP-BGP. LDP is enabled on all the internal interfaces. The external interfaces of the MPLS core have been placed into a VRF called RED and then a site router has been joined to that VRF on each side of the MPLS core – (These represent a small office)
The final step to get full connectivity across the MPLS core is to redistribute the routes in OSPF on R1 and R3 into MP-BGP and MP-BGP into OSPF, this is what we are going to do now.
We need to redistribute the OSPF routes from R4 into BGP in the VRF on R1, the OSPF routes from R6 into MP-BGP in the VRF on R3 and then the routes in MP-BGP in R1 and R3 back out to OSPF
Before we start lets do some verifications
Check the routes on R4
As expected we have the local interface and the loopback address.
When we are done we want to see 126.96.36.199 in there so we can ping across the MPLS
Check the routes on R1
Remember we have a VRF configured on this router so this command will show routes in the global routing table (the MPLS Core) and it will not show the 192.168.1.0/24 route as that is in VRF RED – to see that we run the following command
Here you can see Routing Table: RED is shown and the routes to R4 are now visible with 188.8.131.52 being in OSPF.
So we need to do the following;
- Redistribute OSPF into MP-BGP on R1
- Redistribute MP-BGP into OSPF on R1
- Redistribute OSPF into MP-BGP on R3
- Redistribute MP-BGP into OSPF on R3
Redistribute OSPF into MP-BGP on R1
Redistribute OSPF into MP-BGP on R3
This has enabled redistribution of the OSPF routes into BGP. We can check the routes from R4 and R6 are now showing in the BGP table for their VRF with this command
sh ip bgp vpnv4 vrf RED
Here we can see that 184.108.40.206 is now in the BGP table in VRF RED on R1 with a next hop of 192.168.1.4 (R4) and also 220.127.116.11 is in there as well with a next hop of 18.104.22.168 (which is the loopback of R3 – showing that it is going over the MPLS and R1 is not in the picture)
The same should be true on R3
Which it is! 22.214.171.124 is now in the BGP table in VRF RED on R3 with a next hop of 192.168.2.6 (R6) and also 4.4.4 is in there as well with a next hop of 126.96.36.199 (which is the loopback of R1 – showing that it is going over the MPLS and R1 is not in the picture)
The final step is to get the routes that have come across the MPLS back into OSPF and then we can get end to end connectivity
If all has worked we should be now able to ping 188.8.131.52 from R4
Before we do let’s see what the routing table looks like on R4
Great we have 184.108.40.206 in there
Also check the routing table on R6
Brilliant we have 220.127.116.11 in there so we should be able to ping across the MPLS
Which we can – to prove this is going over the MPLS and be label switched and not routed, lets do a trace
In the next MPLS Tutorial I will add a second customer site into the mix and also go through some MPLS Troubleshooting where I will go through turning off different features and trying to break the MPLS and show you the logical steps to troubleshoot it.
If you have enjoyed this tutorial, please take a minute to enter your name and email below to be kept up to date on new articles and upcoming training courses.
Also if you are interested in Network Automation – Check out my Ansible Tutorial