Introduction To MPLS

 What is MPLS?

Multi Protocol Label Switching :
  • Multiprotocol: supports any network layer protocol, i.e. IPv4, IPv6, IPX, CLNP, etc.
  • Label: a short label of fixed length is used to encapsulate packets.
  • Switching: packets are forwarded by LABEL switching instead of by IP switching.
The initial Motivation of MPLS was in mid 90s, IP address lookup was considered more complex and taking long time to process.

=> A label-swapping protocol was the need for speed.

MPLS can allow core routers to switch packets based on some simplified header. But, hardware of routers became better and looking up longest best match was no longer an issue. More importantly, MPLS de-couples forwarding from routing, and support multiple service models.

What mpls does offer  in traffic processing in the simplest version IP the Traffic Engineering was processed by calculating the shortest path but in MPLS the Traffic Engineering was Dtermined from the source (Sending) based on additional parameter (available resources and constraints, etc.).

MPLS Architecture

In this diagram (Fig: MPLS Architecture), the blue color represents the traditional IP-based architecture, while the orange color represents the additional labeling layer introduced by MPLS.

Before we begin, it is important to know that in this type of architecture (as shown in the previous figure), there are two types of routers:

  • Label Edge Routers (LERs): located at the edge of the network and connected to the hosts.

  • Label Switching Routers (LSRs): located in the core of the network, between the LERs, as shown in the center of the diagram.

MPLS Architecture

First, an incoming IP packet is handled by an LER, which adds a label (label pushing) to the packet based on the Forwarding Information Base (FIB).
(The FIB is the IP routing table, but in MPLS each router also assigns its own local label.)

After the label is added, the packet is forwarded into the MPLS network. The labeled packet is then handled by LSR devices, which forward it based on the Label Forwarding Information Base (LFIB).

Finally, the LSR just before the destination LER checks its LFIB and notices that the destination label has a special meaning (for example, implicit or explicit null). As a result, it removes the label (label popping) and forwards the packet as a regular IP packet to the last LER, which then routes it to the destination using normal IP forwarding.

This behavior reduces processing on the final router and improves performance, a concept that will be explained in more detail later.

LSR Architecture

we see on this diagram the different layer on LSR type device and how it can handle normal IP packet or Labeled Packet based on their configuration.



MPLS Label 

As we see here the encapsulation of the label between "MAC add and IP" and the length of the label (20bits). 

LSP Setup Overview

Before forwarding packets, labels must be allocated to establish an LSP (Label Switched Path). LSP is the path through the MPLS network or a part of it that packets take. Protocols for label distribution: LDP, RSVP-TE, MP-BGP, OSPF, IS-IS. (Labels are allocated from downstream LSRs to upstream LSRs.

Basic Concepts of MPLS Forwarding

  • FEC: 
    • Forwarding Equivalence Class, is a group or flow of packets that are forwarded along the same path and are treated the same with regard to the forwarding treatment.
    • For example, packets with Layer 3 destination IP address matching a certain prefix.
  • Push:
    • A new labels is added to the packet between the Layer 2 header and the IP header or to the top of the label stack.
  • Swap:
    • The top label is removed and replaced with a new label.
  • Pop:
    • The top label is removed. The packet is forwarded with the remaining label stack or as an unlabeled packet.
This picture show the show the Forwarding Operations taking by MPLS:


So we see the R4 doing more extra work (Penultimate Hop Popping) 


So by removing this annoying procedure


MPLS TTL Processing

As we seen previously on the added Label field to the IP packet has TTL that is for the Labeled Packet and it's a copy of TTL of the IP packet but when we are moving on the LSP we decrement the TTL of MPLS each time we moving across and LSRs.

MPLS processes the TTL to prevent loops and implement traceroute. By default, TTL propagation is enabled as above.

TTL propagation can be disabled to hide the MPLS network topology. Disabling TTL propagation makes routers set the value 255 into the TTL field of the label when an IP packet is labeled.

MPLS MTU

IP MTU (Maximum Transmission Unit) indicate the maximum size of the IP packet that can still be sent on a data link, without fragmenting the packet.
In MPLS L3VPN network, 2 label are added into the packet, the labeled packets are slightly bigger than the IP packets. This would lead to the need to fragment the packet. As Solution to optimize solution there is tow solutions 1. Change MPLS MTU size (for all links in the path) 2. Change the TCP MSS to be smaller.

MPLS Builders

Now we can ask the question which protocols can set up Label Switched Path?
There is tow categories that can help us for determining the answer:
  • Pure Signaling MPLS Protocols: include LDP (we will focus on it) and RSVP-TE
  • Routing Protocols with Extensions: include BGP and IGP

Advantages of LDP 

  • Reliability: LDP uses reliable TCP as the transport protocol for all but the discovery messages.
  • Auto provision: Abilities to set up LSPs dynamically based on routing information
  • Plug-and-play: Simple deployment and configuration
  • Support for a large number of LSPs

LDP Identifier

An LDP Identifier is a six octet quantity used to identify an LSR label space (Label Space id = 0 => Label space is per platform | LS_id != 0 -> LS  is per interface).

Label Space - Per Platform: One single label is assigned to a destination network and announced to all neighbors. The label must be locally unique and valid on all incoming interfaces.
Label Space - Per Interface: local labels are assigned to IP destination prefixes on a per-interface basis. This labels must be unique on a per-interface basis.

LDP Operations

We find 3 steps for LDP Protocol:
  1. Neighbor Discovery: 
    • Basic Discovery - Directly connected peer :
      • LDP Hello messages are UDP messages that are sent on the links to the "all routers on this subnet" multicast IP address - 224.0.0.2. The UDP port used for LDP is 646.
    • Extended Discovery - Non-directly connected peer :
      • LDP sessions between non-directly connected LSRs are supported by LDP Extended Discovery. 
  2. Session Establishment: After neighbor discovery, 2 neighbors start to establish session (Establish, maintain, and terminate):
    • there is tow Message changed between 2 neighbors which is Initialization and Keep-alive. 
    • Label Distribution: After LDP sessions are established, labels will be distributed between LDP peers (Create, change, and delete label mappings for FECs).

    Label Distribution and Management

    After LDP sessions are established, labels will be distributed between LDP peers. The label distribution mode used depends on the interface and the implementation.

    1- Label Distribution Control Mode

        - Ordered

    In Ordered control mode, an LSR would only assign a local label for the IGP prefixes that are marked as directly connected in its routing table or also for the IGP prefixes for which it has already received a label from the nexthop router.

        - Independent

    In the independent mode, each LSR creates a local binding for a particular FEC as soon as it recognizes the FEC. Usually, this means that the prefix for the FEC is in its routing table.

    2- Label Advertisement Mode 

        - Downstream on Demand 

    In the DoD  mode, an LSR distributes labels to a specified FEC only after receiving Label Request messages from its upstream LSR.

        - Downstream Unsolicited 

    In the DU mode, each LSR distributes a label to its upstream LSRs, without those LSRs requesting a label.

    3- Label Retention Mode 

        - Liberal  

    In the liberal mode, an LSR keeps all received remote labels in the LIB, but not all are used to forward packets. 

        - Conservative  

    An LSR that is running this mode does not store all remote labels in the LIB, but it stores only the remote label that is associated with the next-hop LSR for a particular FEC. 

    LSP Session Protection 

    Without LDP session protection, if the link between R1 and R2 fails, the LDP direct link adjacency fails.
    MPLS LDP Session Protection uses LDP Targeted Hellos to protect LDP sessions.





    Comments