MPLS
MPLS
LABEL value: this is where you will find the value of the label.
EXP: these are the three experimental bits. These are used for QOS, normally the IP
precedence value of the IP packet will be copied here.
S: this is the “bottom of stack” bit. With the MPLS it’s possible to add more than one
label. You will see why in some of the MPLS VPN lessons. When this bit is set to one, it’s
the last MPLS header. When it’s set to zero then there is one or more MPLS headers left.
TTL: just like in the IP header, this is the time to live field. We can use this for traces in
the MPLS network. Each hop decrements the TTL by one.
The MPLS header is added in between the L2 and L3 header:
That’s why we call it’s a layer 2.5 protocol
MPLS LDP (label distribution protocol)
Previously there was TDP (the Tag Distribution Protocol) is a two-party protocol that
runs over a connection-oriented transport layer with guaranteed sequential delivery.
Tag switching routers use this protocol to communicate tag binding information to their
peers. We do not use TDP. We only use LDP
MPLS doesn’t exchanges label automatically
LDP is a protocol that automatically generates and exchange labels between routers
Each router will logically generate labels for its prefixes and will then advertise the label
values to its neighbors.
It’s a standard based on cisco proprietary TDP (tag Distribution Protocol).
Like many other protocols,
LDP first establish neighbor adjacency before it exchanges label information. It works a
bit different than most protocols though.
First, we send UDP multicast hello packets to discover other neighbors. Once two routers
decide to become neighbors, they build the neighbor adjacency using a tcp connection.
This connection is then used for the exchange of label information. Normally a loopback
interface is used for the neighbor adjacency. Here’s an example
The hello packets are sent to multicast address 224.0.0.2 using source/destination UDP
port 646.
Each router has a unique ID called the LSR (label switch Router) ID.
By default, it will select the highest ip address on a loopback interface. If you don’t have
any loopback interface then we will use the highest ip address on a physical interface.
At the bottom you find the transport address. This is what we use to build the actual TCP
connection. Like the LSR ID,
The router selected the IP address in the loopback interface as the transport address.
Make sure that the IP address that LDP has selected for the transport address is advertised
in your routing protocol.
Otherwise, your routers will be able to hear each other’s hello packets but they can’t form
a neighbor adjancy since the transport addresses are unreachable.
This is different compared to how routing protocols like OSPF or EIGRP form neighbor
adjancies. For example, when your un ospf then your routers will form neighbor adjancies
on all the interfaces that run OSPF.
LDP will only form a single neighbor adjancey no matter how many interfaces you have in
between your routers:
LDP is a bit similar to BGP when you use the loopback interfaces for the neighbor
adjancey. When we use BGP we have to use the update-source command to select the
source, LDP does it automatically.
So once our LDP routers have become neighbors, how we do exchange label information?
With normal routing we use routing protocols like EIGRP, OSPF or BGP to learn prefixes
from other routers. These are all stored in the RIB (routing information base) this is your
routing table.
The information in the RIB used to build the FIB (forwarding information base) which is
what we us for actual forwarding of ip packets. These table are all used for the IP packets
but for MPLS we use something else.
When we use LDP, we locally generate a label for each prefix that we can find in the RIB.
This information is then added to the LIB (label information bases).
The information is the LIB is used to build the LFIB (label forwarding information base).
When the router has to forwards a packet with a MPLS label on it, it will use the LFIB for
forwarding decisions.
Prerequisite for LDP to run.
CEF (cisco express forwarding) & routing should be already done.
Show IP cef to check CEF is running or not.
LDP hello is 5-sec
LDP hold down – 15 secs
Port number – Udp 646
Multicast address 224.0.0.2
The multilayer switch will use the information form tables that are build by the (control
plane) to build hardware tables. It will use the routing table to build the FIB (forwarding
information Base) and the ARP table to build the adjacency table. This is the fastest
switching method because we now have all the layer 2 and 3 information required to
forward IP packets in hardware.
Before we enable MPLS we will configure OSPF/eigrp so that all networks are advertised:
R1,R2,R3
Router ospf 1
Network 0.0.0.0 255.255.255.255 area 0
R1config#mpls label protocol ldp
R1(config)#mpls ldp router-id loopback 0
Now lets enable MPLS on ethernet interfaces
R1(config)#interface ethernet 0/0
R1(config-if)#mpls ip
It’s a standard, based on Cisco’s proprietary TDP (Tag Distribution Protocol). It’s pretty
much the same story as 802.1Q/ISL or PaGP/LACP. Cisco created a protocol and a
standard was created later. Nowadays almost everyone uses LDP instead of TDP.
Like many other protocols, LDP first establishes a neighbor adjacency before it
exchanges label information. It works a bit different than most protocols though…
First, we send UDP multicast hello packets to discover other neighbours. Once two
routers decide to become neighbours, they build the neighbor adjacency using a TCP
connection. This connection is then used for the exchange of label information.
Normally a loopback interface is used for the neighbor adjacency. Here’s an example:
The two routers above will send multicast hello packets on their Fast Ethernet
interfaces. Within this hello packet, they will advertise a transport IP address. This IP
address is then used to establish the TCP connection between the two routers. Here’s
what the hello packet looks like in Wireshark:
In the capture above you can see a couple of interesting things:
Make sure that the IP address that LDP has selected for the transport address is
advertised in your routing protocol. Otherwise, your routers will be able to hear each
other’s hello packets but they can’t form a neighbor adjacency since the transport
address(es) are unreachable.
This is different compared to how routing protocols like OSPF or EIGRP form neighbor
adjacencies. For example, when you run OSPF then your routers will form neighbor
adjacencies on all interfaces that run OSPF:
LDP will only form a single neighbor adjacency, no matter how many interfaces you
have in between your routers:
LDP is a bit similar to BGP when you use the loopback interfaces for the neighbor
adjacency. When we use BGP we have to use the update-source command to select the
source, LDP does it automatically.
So once our LDP routers have become neighbours, how do we exchange label
information? To explain this, let’s do a quick review of how normal routing uses the RIB
and FIB.
With normal routing, we use routing protocols like EIGRP, OSPF or BGP to learn prefixes
from other routers. These are all stored in the RIB (Routing Information Base), this
is your routing table.
The information in the RIB is used to build the FIB (Forwarding Information
Base) which is what we use for actual forwarding of IP packet. These tables are all used
for IP packets but for MPLS we use something else:
When we use LDP on Cisco IOS, we locally generate a label for each prefix that we
can find in the RIB, except for BGP prefixes. This information is then added to
the LIB (Label Information Base).
The information in the LIB is used to build the LFIB (Label Forwarding Information
Base). When the router has to forward a packet with a MPLS label on it, it will use the
LFIB for forwarding decisions.
Above we have 3 routers and each router has 2 loopback interfaces so that we have
plenty of networks to play with. Before we enable MPLS we’ll configure OSPF so that all
networks are advertised:
R1,R2,R3:
(config)#router ospf 1
We’ll do this the easy way and activate OSPF on all interfaces. Now let’s enable MPLS
on the Fast Ethernet interfaces:
R1(config-if)#mpls ip
R2(config-if)#mpls ip
R2(config-if)#exit
R2(config)#interface fastEthernet 0/1
R2(config-if)#mpls ip
R3(config-if)#mpls ip
So far so good, now let’s take a look at the LDP labels that have been generated:
For all networks a label has been generated by LDP. Now let’s configure filtering so that
we only generate labels for the loopback 0 interfaces. This is how you do it: