What is MPLS?
MPLS stands for Multi-protocol Label Switching. MPLS is a packet forwarding technology that is capable of carrying any L3 protocol and here comes the word multi-protocol. MPLS is capable of tunneling L3 packets inside the MPLS network using MPLS labels. The MPLS label is pushed into the packet between the layer two headers and the layer three header of the packet at the ingress router and is used to switch the packets across the network to its destination.
What is the MPLS Label and How is it used?
The MPLS label is a fixed 4 byte identifier added to the packet by the ingress router between the data-link layer (Layer2) and the network layer (Layer3) and is used by all middle routers to switch the packet to its destination without the need for any routing table (Layer3) look-ups. MPLS is considered a layer 2.5 technology and the MPLS header is called the shim header.
The diagram below illustrates the structure of the label. One or more labels are pushed on the packet at the ingress router forming a label stack. The first label is called the top label or the transport label, other labels are used by different MPLS applications if needed.
MPLS Label Structure
- Label: label value, 20 bits.
- EXP: Experimental bits, Name is currently changed to Traffic class, 3 bits.
- S: bottom of stack, 1 bit.
- TTL: Time to live, 8 bits.
A couple of definitions are important before moving to MPLS operation:
- Downstream router: This is the router which advertises the prefix. In other words the router that is the next hop to a specific prefix is the downstream.
- Upstream router: This router receives the routing information from its downstream router.
- Label Edge Router (LER): Operates at the edge of the MPLS network (ingress/egress) and make forwarding decisions based on the IP header information of the packet.
- Label Switch router (LSR): the routers in the middle of the MPLS network which forwards MPLS packets based on label information.
Routing information flows from downstream routers to upstream router.
while data flows from upstream routers to down stream routers.
How MPLS works?
MPLS uses the concept of Forwarding Equivalence Class (FEC). The FEC is of a set of packets forwarded in the same manner by the label switching routers (LSR). Each router assigns a label to a FEC and distributes this label to other routers using label distribution protocols forming label switched paths or LSPs.
When a packet is received by the ingress router it dvcermines the next hop and inserts one or more labels to the packet . Then the labeled packets are passed to the next-hop router (downstream). When the packets reach the downstream router, the top most label is examined and used as a unique identifier to look into the label forwarding table to dvcermine the next hop and label operation to be performed on each MPLS packet.
Finally the packet reaches the egress router, the label is removed and the packet is forwarded using an IP lookup or another label based on the MPLS application used.
As you can see the provider routers do not need to examine layer 3 information of the traversed packets, allowing for protocol independent packet forwarding.
- R1 advertises prefix 10.10.10.0/24 to the network using any IGP.
- Routing information about the subnet flows away from R1.
- An IP packet enters R4 (LER) with a destination of 10.10.10.0/24.
- R4 looks in its label forwarding information base, dvcermines the next hop (R3) and pushes the label assigned by R3 (L4) for this FEC.
- R3 receives labeled packet from R4 with a label L4. R3 examines the LFIB and swaps L3 label to L2.
- R2 receives the MPLS packet, looks up the LFIB and pops the label (penultimate hop popping) before sending the packet to R1 as an IP packet.
- R1 forward the packet to its destination based on IP header information.
Please refer to MPLS label operations post for a description of different label operations.
MPLS network requirements
The following elements must exist in the network to be able to run MPLS
- A layer 3 routing protocol (IS-IS, OSPF, EIGRP or RIP); preferably IS-IS or OSPF for Traffic engineering.
- Label distribution protocol (RSVP, LDP or BGP).
- Network capable of handling MPLS traffic.
- BGP free core in the service provider.
- MPLS Applications like MPLS VPN and Traffic Engineering.
- Having unified network in the service provider as you can provide IP, L3 VPN or L2 VPN over the same network.
I hope I have been able to clearly and simply answer this question, please do not hesitate to post any comments, corrections or request.