Sunday, April 7, 2013

MPLS Overview

MPLS Label Switching.
MPLS forwards packets based on the MPLS labels, instead of using the packet’s destination IP address.
Advantage of using labels and not the destination IP address is that packet forwarding decision can be made on the other factors such as traffic engineering and QoS requirements.
MPLS unicast IP forwarding logic forwards packets based on the labels, however when choosing the exit interfaces, MPLS considers only the routes in the unicast IP routing table. This results in the packet flows over the same path as it would have even if MPLS was not used. Using MPLS labels does not add any benefit by itself, but it essentially enables the MPLS traffic engineering in an MPLS network, and therefore a critical feature of the MPLS.
MPLS still requires the use of control plane protocols such as OSPF and LDP to learn the labels and relate those labels to particular destination prefixes for building correct forwarding tables.
MPLS also requires a fundamental change to the data plane’s core forwarding logic, it defines a completely different packet-forwarding logic.
In an MPLS network, the hosts should not send and receive labeled packets. All labeled packets are only for the routing and only routers should be sending and receiving the labeled packets in an MPLS network.
Injecting an MPLS label into an IP packet is called as  PUSH.
Removing an MPLS label from an IP packet is called as POP.
Both push and pop operations on the IP packets are performed by MPLS routers , and a labeled packet is never forwarded to an end host.
MPLS Label Header
The label is a 20-bit field which identifies the Prefix.
EXP is a 3-bit field which is used for implementing QoS
S- “Bottom of stack indicator” used to identify the bottom of stack. An MPLS LSR Router can impose multiple labels and the bottom-of-stack indicator identifies if the label that has been encountered is the bottom label of the label stack. If the value of S is zero then router know that the label stack implementation is in use and the LSR will only swap the top most label in the stack. However on an egress edge LSR, the router will continue to pop all the labels until the value of S becomes 1, which means there are no more labels and the packet can be forwarded as an IP packet. Label stacks are normally implemented  by ingress Edge LSR when the MPLS VPN and traffic engineering is used.
MPLS Label Stack 
Cisco routers implementing MPLS rely on the Cisco Express Forwarding logic (CEF). IP CEF has to enabled for configuring MPLS.
CEF:
Routing Protocols, Static and Connected Routes create the Routing Information Base (RIB), and CEF creates another CEF Forwarding Information Base (FIB). FIB contains an entry for each destination IP Prefix in the routing table, and it details the information needed for the packet forwarding, like next-hop router and outgoing interface. Also, CEF adjacency tables list the data-link header that the router will need to forward the packet to next-hop.
CEF enabled router compares the packet’s destination IP address to the CEF FIB, ignoring the IP routing table, since the FIB has entries to which next hop the packet should be forwarded and it also has the data-link header to be used for forwarding, CEF essentially optimizes the routing as router will spend less time in looking for this information and the forwarding delay is reduced. For each packet the router finds the matching FIB entry and then finds the data-link header in adjacency table which is referenced by the FIB entry.

MPLS unicast forwarding.

Hosts generate the packet without an MPLS label. An MPLS router injects a label  in the packet and forwards the packet to other routers in the MPLS network, the other routers make forwarding decision based on the MPLS label and forward the packet accordingly,  and at the end the final MPLS router removes the label before forwarding the packet to the destination host.
MPLS Terms
Label Switch Router (LSR)
LSR is a router that pushes or pops labels on the packets, or just forwards labeled packets.
Edge-LSR (E-LSR)
Edge LSR is a router at the edge of the MPLS network, and processes both labeled and unlabeled packets.
Ingress E-LSR
Is an MPLS router that inserts an label stack in a packet.
Egress E-LSR
Is an MPLS router that removes the MPLS labels from a packet.
LSRs use both the CEF FIB and the MPLS LFIB to forward the packets. Both of these FIB and LFIB have necessary information like labels information, outgoing interface and the next hop information to allow the forwarding of the packets.
FIB is used for processing the incoming unlabeled packets.
LFIB is used for processing the incoming labeled packets.
Router R1 receives an unlabeled packet and it uses the CEF FIB  which has an entry for 192.168.1.1 pointing to push a label with value 20 and outgoing interface as Fa0/0  which directs the packet towards Router R2.
R2 now receives a labeled packet and it will not consult the CEF FIB, since its a labeled packet R2 will use the LFIB which has an entry directing the router to swap the label with a value of 30 and forward it out of interface Fa0/1 towards Router R3.
R3 receives the labeled packet with a label value of 30, it does not consult the CEF FIB, but just looks up into the LFIB which directs the router to pop the label and forward the packet out of interface Se0/0.
MPLS Upstream and Downstream Routers concepts:
Both downstream and upstream are defined in the context to the destination network.
Data intended for a particular destination network always flows downstream to downstream routers.
Updates for particular destination prefixes always flow upstream to upstream routers.
LSR-Router(A) —— ( LDP, Update or Announcing NLRI) ———> Upstream LSR Router(B)
LSR-Router(B)——-(Forwarding packet to the Destination)———-> Downstream LSR Router(A)
Label Distribution Protocol (LDP)
1. LDP uses TCP Port 646.
2. LDP Session is initiated by the LSR with higher LDP router ID.
3. LDP messages are UDP multicast on 224.0.0.2 on MPLS enabled interfaces.
4. LDP Sessions are made only between directly connected LSRs
5. LSR with Higher LDP router ID is the active LSR and attempts connection with directly connected passive LSR (which is lower LDP router ID)
6. Active LSR sends keepalives to the passive LSR and LDP session comes up.
7. After the LDP session is up, the label-FEC mappings are exchanged.
A label is assigned to the destination prefix which is found in the FIB and is distributed to the upstream routers. The labels that are of local significance are exchanged with the adjacent neighbor LSRs.  The label bindings are then stored in the LFIB.  Label bindings are the local labels and the next-hop label (received from downstream LSR) to a destination prefix.
Label Distribution Methods:
Downstream on Demand: Allows an LSR to explicitly request a label from its downstream next-hop router for a particular destination prefix.
Unsolicited Downstream: Allows an LSR to distribute bindings to upstream LSRs.
Label Retention Methods:
Liberal label Retention mode: maintains the label bindings from the downstream LSRs which might not be the next-hop for the destination prefix. useful when a link goes down and converges back, then the alternative path label does not have to be relearned.
Conservative label retention mode: Does not maintain the label bindings from the downstream LSRs which might not be the next-hop for the destination prefix. Useful when there are a lot of labels to be maintained so memory consumption is in control.
Special Outgoing label types
Untagged: ( MPLS to IP Domain transition)
The incoming MPLS packet is converted to an IP packet and forwarded to the destination
Implicit-null or POP label:
This label is assigned when the top label of  incoming MPLS packet s removed and the packet is forwarded to next hop downstream router. It is used in MPLS networks that implement penultimate hop popping.
Explicit-null label: 
This label is assigned to preserve the EXP value of the top label of an incoming packet. The top label is swapped with a label value of 0 and forwarded as an MPLS packet to next downstream router. It is used for QoS implementation.
Aggregate:
The incoming MPLS packet is converted to an IP packet by removing all labels, and an FIB lookup is performed to identify the outgoing interface to destination.
Penultimate Hop Popping
Is the process where an LSR removes the top label in the label stack and forwards the packet to the Edge LSR. This process is signaled by the downstream Edge LSR to its upstream LSR router using LDP.
The downstream edge LSR distributes the implicit-null (POP) label to the upstream router which signals it to pop the top label out of the label stack and forward the resulting labeled or IP packet.  When the packet is received by the edge LSR, it does not look into the LIB if the incoming packet is an IP packet resulting in a saving the router from the single lookup in the LIB.
Frame Mode MPLS
In Frame mode mpls the routers exchange both the labeled IP packets  and the unlabeled IP packets in MPLS domain. Data link connectivity in Frame mode MPLS  is established using Ethernet, Frame-relay or Serial. ATM can operate either in frame mode or on cell mode MPLS.
Routers receiving the frame look into the ‘ethernet-type’ field of the frame and can identify if its a MPLS or IP packet. If the Ethernet-type field has value of 0×800 then they know its an IP payload and if the value is 0×8847 then know that its an MPLS unicast payload.
Loop Prevention:
MPLS relies on the IGP for Loop Prevention in frame mode, however to avoid infinite looping of an IP packet the TTL field in the label header is used. The functionality of TTL field in the MPLS header is the same as the IP packet TTL field and when the TTL value becomes 0 then the packet is discarded and ICMP TTL expired is sent to the source by the router. TTL can have a value between 0-255 and decrements by 1 at every router hop.
When an IP packet enters an MPLS domain, the edge LSR copies the TTL value of the IP packet header into the MPLS TTL header. at every LSR hop the TTL value is decremented by 1 and at the edge LSR where the label is popped and IP packet is forwarded towards the destination, the TTL value is copied back to the IP TTL header. This entire process is called as IP to Label TTL propagation.IP to TTL propagation is enabled by default in Cisco routers.
IP to Label propagation can be disabled, when  disabled the IP TTL is not copied to the MPLS Label TTL, instead a value of 255 is assigned to the MPLS Label TTL.
And when exiting the MPLS domain the IP TTL value of the packet remains same as it was when it entered the MPLS domain making the MPLS domain transparent to the customer performing traceroute.
Command to disable the IP to TTL propagation at the edge LSR is
# no mpls ip propogate-ttl [forwarded | local]
Note: By only using the “no mpls ip propogate-ttl forwarded”  command the  traffic generated locally by the loopback interface on edge LSR, the IP to Label TTL will occur and therefore the provider can perform troubleshooting using traceroute commands in the MPLS domain. If no options are specified with the command and used as  “no mpls ip propogate-ttl” then both local and forwarded traffic will be disabled for IP to Label TTL propagation.
Related Posts Plugin for WordPress, Blogger...