For those of you who are familiar with my articles, you may be aware that I am expanding my knowledge base in areas that I know little about. My quest has taken me to the field of Multiprotocol Label Switching (or MPLS) and it has been quite insightful.

CCNA Training – Resources (Intense)

In this article, we will look at the basic configuration of MPLS. There is already an article in Intense School that provides a good introduction to MPLS. We will be building on that one from a practical aspect, so I suggest you read that article before continuing here.

How MPLS Works

MPLS changes the way packets are forwarded across a network. In normal IP based networks, packets are forwarded by routers after looking at the destination address and making a decision on where to forward them based on its routing table or other configuration such as policy routing. Every router that receives a packet in a normal IP based network makes this decision based on the destination address.

In MPLS however, decisions are made based on “labels.” These labels are added between the layer 2 and layer 3 of the OSI model, which is why MPLS is sometimes referred to as a “Layer 2.5 protocol.”

The use of labels in MPLS has many benefits, including the fact that the core routers (not the edge routers) in a service provider’s network do not need to run BGP. Before MPLS, all these routers may have been required to run BGP especially if they were carrying all Internet routes. With MPLS, the core routers do not need to be bogged down with the extra requirement of running BGP and they will forward packets just fine using labels.

Generally speaking, a router that is MPLS-enabled is called a Label Switch Router (LSR). Furthermore, LSRs that are at the edge of the MPLS domain are called Edge LSRs. These routers usually connect the customer network to the service provider’s network.

Note: In MPLS VPN terminology, an edge LSR is also called a Provider Equipment (PE) router while a normal LSR is called a Provider (P) router.

We can explain how packets are forwarded using labels in MPLS through the following diagram. The LSRs make up the MPLS domain. LSR1 is the border router between the MPLS network and the IP network (Network A):

It begins when LSR1 assigns a label of L1 for Network A. LSR1 then informs LSR2 that if LSR2 wants to send any packet to Network A through it, LSR2 should label the packet with L1. LSR2 also assigns a label of L2 for Network A and tells LSR3 that to send packets to Network A, it should label them with L2. LSR3 does the same using a label of L3.

Now let’s say LSR4 has IP traffic to send to Network A. LSR4 will label the packet with L3 and send it to LSR3. LSR3 receives the packet with label L3, replaces (swaps) it with L2 and then forwards it to LSR2. LSR2 receives the packet with label L2, replaces it with L1 and sends it to LSR1. LSR1 being the border router between the IP and MPLS domain, removes the label and then forwards it to the right destination.

Let’s see how MPLS is configured and how it works using the network diagram below:

The configuration on the PE routers is as follows:

PE1

hostname PE1
!
ip cef
!
interface Loopback0
 ip address 1.1.1.1 255.255.255.255
!
interface FastEthernet0/0
 ip address 10.0.12.1 255.255.255.0
 mpls ip
!
interface FastEthernet0/1
 ip address 10.0.100.1 255.255.255.0
!
interface Ethernet1/0
 ip address 10.0.13.1 255.255.255.0
 mpls ip
!
router ospf 1
 network 1.1.1.1 0.0.0.0 area 0
 network 10.0.12.0 0.0.0.255 area 0
 network 10.0.13.0 0.0.0.255 area 0
!
router bgp 14
 neighbor 4.4.4.4 remote-as 14
 neighbor 4.4.4.4 update-source Loopback0
 network 10.0.100.0 mask 255.255.255.0
 redistribute static
 no auto-summary
!
ip route 192.168.100.0 255.255.255.0 10.0.100.10
!
mpls ldp router-id Loopback0 force

PE2

hostname PE2
!
ip cef
!
interface Loopback0
 ip address 4.4.4.4 255.255.255.255
!
interface FastEthernet0/0
 ip address 10.0.24.4 255.255.255.0
 mpls ip
!
interface FastEthernet0/1
 ip address 10.0.200.4 255.255.255.0
!
interface Ethernet1/0
 ip address 10.0.34.4 255.255.255.0
 mpls ip
!
!
router ospf 1
 network 4.4.4.4 0.0.0.0 area 0
 network 10.0.24.0 0.0.0.255 area 0
 network 10.0.34.0 0.0.0.255 area 0
!
router bgp 14
 neighbor 1.1.1.1 remote-as 14
 neighbor 1.1.1.1 update-source Loopback0
 network 10.0.200.0 mask 255.255.255.0
 redistribute static
 no auto-summary
!
ip route 192.168.200.0 255.255.255.0 10.0.200.20

The configuration on the P routers is as follows:

P1

hostname P1
!
ip cef
!
interface Loopback0
 ip address 2.2.2.2 255.255.255.255
!
interface FastEthernet0/0
 ip address 10.0.12.2 255.255.255.0
!
interface FastEthernet0/1
 ip address 10.0.24.2 255.255.255.0
!
router ospf 1
 mpls ldp autoconfig
 network 2.2.2.2 0.0.0.0 area 0
 network 10.0.12.0 0.0.0.255 area 0
 network 10.0.24.0 0.0.0.255 area 0

P2

hostname P2
!
ip cef
!
interface Loopback0
 ip address 3.3.3.3 255.255.255.255
!
interface Ethernet1/0
 ip address 10.0.13.3 255.255.255.0
 mpls ip
!
interface Ethernet1/1
 ip address 10.0.34.3 255.255.255.0
 mpls ip
!
router ospf 1
 network 3.3.3.3 0.0.0.0 area 0
 network 10.0.13.0 0.0.0.255 area 0
 network 10.0.34.0 0.0.0.255 area 0

Finally, the configuration on the CE routers is as follows:

CE1

hostname CE1
!
interface Loopback0
 ip address 192.168.100.1 255.255.255.0
!
interface FastEthernet0/0
 ip address 10.0.100.10 255.255.255.0
!
ip route 0.0.0.0 0.0.0.0 10.0.100.1
!

CE2

hostname CE2
!
interface Loopback0
 ip address 192.168.200.1 255.255.255.0
!
interface FastEthernet0/0
 ip address 10.0.200.20 255.255.255.0
!
ip route 0.0.0.0 0.0.0.0 10.0.200.4
!

As you can see, there is minimal configuration on the CE routers. They have a default route to their respective PE routers and I used the Loopback interfaces to simulate the network connected to the CE routers.

I will now try to ping from CE1’s lo0 interface to CE2’s lo0 interface.

Before we talk about how this connection was possible, let’s first take a dive into the world of MPLS; therefore, we will focus on the devices in the service provider’s networks: PE1, P1, P2, and PE2. The configuration on these devices may seem overwhelming because I have pasted it all at once but you will see that there isn’t much to it at all when we break it down.

Step 1: Enable CEF

First thing you will notice is the ip cef command which enables Cisco Express Forwarding (CEF) globally on the router. Cisco’s implementation of MPLS requires that CEF is also enabled on the router because it is the only switching technology that implements the Forwarding Information Base (FIB). The FIB is important in MPLS as we will discuss in the next article. Recent IOS versions have CEF enabled by default. It must also be enabled on the MPLS forwarding interface (if it was disabled) using the ip route-cache cef command.

Step 2: Configure IGP e.g. OSPF or ISIS

Next, you need to configure routing between the LSRs. Commonly used IGPs are OSPF and IS-IS.

Step 3: Enable MPLS forwarding

Enabling MPLS on an interface is actually very simple: you use the command mpls ip under the interface configuration. This command in effect enables LDP on that interface. LSRs usually distribute label information using the Label Distribution Protocol (LDP) although other protocols like Tag Distribution Protocol (TDP) and Resource Reservation Protocol (RSVP) can also be used.

Another way to enable LDP on interfaces is to enable LDP autoconfiguration under the IGP. This will automatically enable LDP on the interfaces that are configured to run the routing protocol. In Cisco, you can enable LDP autoconfiguration only under OSPF or IS-IS. You will notice that I didn’t explicitly enable MPLS on the interfaces of P1 but I specified the command mpls ldp autoconfig under the OSPF process.

Another thing I want you to notice is that I have not enabled MPLS on the PE routers’ interfaces that connect to the CE routers. As I said above, the customer does not need to run MPLS on its equipment.

(Optional) Step 4: Configure LDP router-ID

By default, LDP will choose the highest IP address on a loopback interface as the LDP router ID. In case there are no loopback interfaces configured with IP addresses, it will pick the highest IP address configured on the router. However, you can explicitly configure LDP to use a particular router ID using the mpls ldp router-id <interface> [force] command. The force keyword instructs LDP to immediately use the IP address on the configured interface as the router ID instead of waiting until LDP restarts.

I used this command on PE1 so that it will use its Lo0 interface IP address as the LDP router ID although all other routers will also use their loopback address as the LDP router ID.

Note: There is also BGP configurations on both PE routers. It relates to how the customer network routes are carried and we will talk about it later.

Verifying MPLS

That’s all we need to do to enable MPLS. Simple enough right? J Let’s look at a few show commands. The first one we will use is the show mpls interfaces command.

We can see that LDP is enabled on the Fa0/0 and E1/0 interfaces. The Tunnel column shows information specific to Traffic Engineering. The Operational column lets us know that packets are being labeled on that interface.

Another useful command which gives information about LDP neighbors is the show mpls ldp neighbor command.

As shown above, PE1 has discovered two LDP neighbors: 2.2.2.2 (P1) and 3.3.3.3 (P3). In the next article, we will see how LDP sessions are formed and also talk about the Label Information Base (LIB) and Label Forwarding Information Base (LFIB) data structures.

Summary

Although there may be a lot of theory behind MPLS (mostly because it is a change from normal IP routing), the basic configuration of MPLS is very simple. Enabling MPLS on an interface only requires adding the mpls ip command and everything from then is ‘automagic’. Of course there are more complex configurations for other MPLS uses like MPLS VPN.

In the next article, we will look deeper into LDP. Then, we will discuss the functions of LIB and LFIB in MPLS. I hope you have found this article helpful.

References and further reading

  1. MPLS Configuration on Cisco IOS Software by Lancy Lobo
  2. MPLS Fundamentals by Luc De Ghein