Saturday, April 1, 2017

Quick Notes: MPLS

Introduction


  • MPLS labels are advertised between routers.
  • Routers build label-to-label mappings.
  • The labels are attached to the IP packets (between Layer 2 and Layer 3 headers).
  • Routers forward packets by looking at the label and not the destination IP address.
  • Faster switching is often mistakenly mentioned as a reason to implelemt MPLS - it is not. The switching of the packets—or the forwarding plane—these days is done on specifically built hardware, or application-specific integrated circuits (ASIC). The use of ASICs in the forwarding plane of a router has led to IP packets being switched as fast as labeled packets. 
  • In Cisco IOS, CEF switching is the only IP switching mode that you can use to label packets. Other IP switching modes, such as fast switching, cannot be used, because the fast switching cache does not hold information on labels. Because CEF switching is the only IP switching mode that is supported in conjunction with MPLS, you must turn on CEF when you enable MPLS on the router.


MPLS Labels


++++++++++++++++++++++++++++++++++++++++++++++++
|        Label        |  EXP  | BoS |    TTL   |
++++++++++++++++++++++++++++++++++++++++++++++++

  • Label (first 20 bits): first 16 values are exempted from normal use, and they have a special meaning.
  • EXP (bits 20 to 22): used for QoS.
  • BoS (bit 23): indicates if the label is the bottom of stack (1) or not (0). Limitless stack space but usually no more than four labels are used.
  • TTL (bits 24 to 31): same function as the TTL in the IP header.
  • Labels 0 through 15 are reserved labels. An LSR cannot use them in the normal case for forwarding packets. 
  • Label 0 is the explicit NULL label, whereas label 3 is the implicit NULL label. 
  • Label 1 is the router alert label, whereas label 14 is the OAM alert label. 
  • The other reserved labels between 0 and 15 have not been assigned yet.
  • Except for the reserved labels of 0 through 15, you can use all the label values for normal packet forwarding. 
  • Because the label value has 20 bits, the labels from 16 through 1,048,575 (220 – 1) are used for normal packet forwarding. 
  • In Cisco IOS, the default range is 16 through 100,000.


Implicit NULL Label 


  • Has a value of 3. 
  • An egress LSR advertises the implicit NULL label when it wants the upstream LSR to perform a pop operation.
  • The egress LSR assings the implicit NULL label to its connected and summarized prefixes.
  • Without the implicit NULL label, the router would have to do two lookups, First, it would have to look up the label in the LFIB, just to figure out the label needs to be removed. Second, it would have to perform an IP lookup. 
  • To remove the double lookup, the router signals the last but one (penultimate) LSR to send packets without a label by advertising the implicit NULL label instead of a regular MPLS label. 
  • The use of the implicit NULL label at the end of a label switched path (LSP) is called penultimate hop popping (PHP).
  • The use of the implicit NULL label does not mean that all labels of the label stack must be removed. Only one label is popped off.
  • In any case, the use of the implicit NULL label removes an extra lookup and increases performance.


Explicit NULL Label


  • Has a value of 0.
  • Besides the label value itself, the MPLS label also holds the Experimental (EXP) bits. 
  • When a label is removed, the EXP bits are also removed. Because the EXP bits are exclusively used for quality of service (QoS), the QoS part of the packet is lost when the top label is removed.
  • In some cases, you might want to keep this QoS information and have it delivered to the egress LSR. Implicit NULL cannot be used in that case. The explicit NULL label must be used instead.
  • The egrees LSR just removes the explicit NULL label but it can derive the QoS information of the received packet by looking at the EXP bits.
  • The EXP bits value can be copied to the precedence or DiffServ bits when performing PHP, or, if the label stack has multiple labels and the top label is popped off, the EXP bits value can be copied to the EXP field of the new top label.
  • The explicit NULL label for IPv6 has the value 2.


Router Alert Label


  • Has a value of 1.
  • This label can be present anywhere in the label stack except at the bottom. 
  • When the Router Alert label is the top label, it alerts the LSR that the packet needs to be punted to the software process for a closer look. 


OAM Alert Label


  • Has a value of 14.
  • Basically used for failure detection, localization, and performance monitoring. This label differentiates OAM packets from normal user data packets. 
  • Cisco IOS does not use label 14. It does perform MPLS OAM, but not by using label 14.


MPLS Operations


  • A label switch router (LSR) is a router that supports MPLS. It is capable of understanding MPLS labels and of receiving and transmitting a labeled packet on a data link.
  • An LSR can do these three operations: pop, push, or swap.
    • Pop: The top label is removed. The packet is forwarded with the remaining label stack or as an unlabeled packet.
    • Push: The top label is replaced with a new label (swapped), and one or more labels are added (pushed) on top of the swapped label.
    • Swap: The top label is removed and replaced with a new label.
  • An LSR that pushes labels onto a packet that was not labeled yet is called an imposing LSR because it is the first LSR to impose one or more labels onto the packet. One that is doing imposition is an ingress LSR. 
  • An LSR that removes all labels from the labeled packet before switching out the packet is a disposing LSR. One that does disposition is an egress LSR.
  • In the case of MPLS VPN, the ingress and egress LSRs are referred to as provider edge (PE) routers. Intermediate LSRs are referred to as provider (P) routers. The terms PE and Prouters have become so popular that they are also used when the MPLS network does not run MPLS VPN. 
  • The ingress LSR classifies and labels the packets. 
  • All that changes is that the top label in the label stack is swapped at each hop.  
  • The intermediate LSRs swap the top label (the incoming label) of the received labeled packet with another label (the outgoing label) and transmit the packet on the outgoing link.


Label Distribution 


  • Each intermediate LSR must be able to figure out with which outgoing label the incoming label should be swapped. 
  • This means that you need a mechanism to tell the routers which labels to use when forwarding a packet. A label distribution protocol is needed.
  • You can distribute labels in two ways:
    • Piggyback the labels on an existing IP routing protocol.
    • Have a separate protocol distribute labels.
  • The first method has the advantage that a new protocol is not needed to run on the LSRs and routing/label distribution would always be in sync, but every existing IP routing protocol would need to be extended to carry the labels. This is not an easy thing to do, which is why none of the IGPs have been changed to deploy the first method.
  • The second method -  running a separate protocol for label distribution - has been adopted by all router vendors. This is the Label Distribution Protocol (LDP). However, LDP is not the only protocol that can distribute MPLS labels - others are Tag Distribution Protocol (TDP), which is now obsolete, and Resource Reservation Protocol (RSVP), which is used for MPLS TE only.
  • For every IGP IP prefix in its IP routing table, each LSR creates a local binding—that is, it binds a label to the IPv4 prefix. 
  • The LSR then distributes this binding to all its LDP neighbors.
  • The neighbors then store remote (received) and local bindings in a special table, the label information base (LIB). 
  • Each LSR has only one local binding per prefix when the label space is per platform.
  • If the label space is per interface, one local label binding can exist per prefix per interface.


MPLS Forwarding


  • When a router receives an IP packet, the lookup is done in the CEF table.

Router#show ip cef 10.200.254.4
10.200.254.4/32, version 44, epoch 0, cached adjacency 10.200.200.2
0 packets, 0 bytes
  tag information set, all rewrites owned
    local tag: 20
    fast tag rewrite with Et0/0/0, 10.200.200.2, tags imposed {18}
  via 10.200.200.2, Ethernet0/0/0, 0 dependencies
    next hop 10.200.200.2, Ethernet0/0/0
    valid cached adjacency
    tag rewrite with Et0/0/0, 10.200.200.2, tags imposed {18}


  • When a router receives a labeled packet, the lookup is done in the LFIB. 
  • The LSR sees the 20-bit field in the top label, looks up this value in the LFIB, and tries to match it with a local label value, and perform the listed operation.

Router# show mpls forwarding-table
Local  Outgoing     Prefix            Bytes tag  Outgoing    Next Hop
tag    tag or VC    or Tunnel Id      switched   interface
16     Untagged     10.1.1.0/24       0          Et0/0/0     10.200.200.2
17     16           10.200.202.0/24   0          Et0/0/0     10.200.200.2
18     Pop tag      10.200.203.0/24   0          Et0/0/0     10.200.200.2
19     Pop tag      10.200.201.0/24   0          Et0/0/0     10.200.200.2
20     18           10.200.254.4/32   0          Et0/0/0     10.200.200.2
21     Pop tag      10.200.254.2/32   0          Et0/0/0     10.200.200.2
22     17           10.200.254.3/32   0          Et0/0/0     10.200.200.2
24     Untagged     l2ckt(100)        4771050    Fa9/0/0     point2point


  • If the router receives labeled packets with a top label that the LSR does not find in its LFIB, the LSR can theoretically try two things: strip off the labels and try to forward the IP packet, or drop the packet. The Cisco LSR drops the packet.


References

MPLS Fundamentals

No comments:

Post a Comment