MPLS Fundamentals: Forwarding Labeled Packets
What You Will Learn
After completing this chapter, you will be able to do the following:
- Explain how labeled packets are forwarded
- Name the reserved MPLS labels and know what they are used for
- Determine the importance of MPLS MTU in MPLS networks
- Explain what happens to labeled packets that have TTL expiring
- Explain what happens with labeled packets that need to be fragmented
Chapter 2, "MPLS Architecture," focused on what an MPLS label is and how it is used. This chapter specifically focuses on how labeled packets are forwarded. Forwarding labeled packets is quite different from forwarding IP packets. Not only is the IP lookup replaced with a lookup of the label in the label forwarding information base (LFIB), but different label operations are also possible. These operations refer to the pop, push, and swap operations of MPLS labels in the label stack.
When reading this chapter, note the existence of the reserved MPLS labels that have a special function. These reserved labels are already introduced here, because they are mentioned throughout the book.
Forwarding of Labeled Packets
This section looks at how labeled packets are forwarded in MPLS networks, how forwarding labeled packets is different from forwarding IP packets, how labeled packets are load-balanced, and what a label switching router (LSR) does with a packet with an unknown label.
Label Operation
The possible label operations are swap, push, and pop. Look at Figure 3-1 to see the possible operations on labels.
Figure 3-1 Operations on Labels
By looking at the top label of the received labeled packet and the corresponding entry in the LFIB, the LSR knows how to forward the packet. The LSR determines what label operation needs to be performed—swap, push, or pop—and what the next hop is to which the packet needs to be forwarded. The swap operation means that the top label in the label stack is replaced with another, and the push operation means that the top label is replaced with another and then one or more additional labels are pushed onto the label stack. The pop operation means that the top label is removed.
IP Lookup Versus Label Lookup
When a router receives an IP packet, the lookup done is an IP lookup. In Cisco IOS, this means that the packet is looked up in the CEF table. When a router receives a labeled packet, the lookup is done in the LFIB of the router. The router knows that it receives a labeled packet or an IP packet by looking at the protocol field in the Layer 2 header. If a packet is forwarded by either Cisco Express Forwarding (CEF) (IP lookup) or by LFIB (label lookup), the packet can leave the router either labeled or unlabeled. Look at Figure 3-2 to see the difference between a lookup in the CEF table and in the LFIB.
Figure 3-2 CEF or LFIB Lookup
If an ingress LSR receives an IP packet and forwards it as labeled, it is called the IP-to-label forwarding case. If an LSR receives a labeled packet, it can strip off the labels and forward it as an IP packet, or it can forward it as a labeled packet. The first case is referred to as the label-to-IP forwarding case; the second is referred to as the label-to-label forwarding case.
Example 3-1 shows an IP-to-label forwarding case—that is, the forwarding of an IP packet by the CEF table.
Example 3-1. Example of an Entry in the CEF table
lactometer#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}
IP packets that enter the LSR destined for 10.200.254.4/32 go out on interface Ethernet0/0/0 after being imposed with the label 18. The next hop of this packet is 10.200.200.2. The IP-to-label forwarding is done at the imposing LSR. 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.
In Example 3-2, you can see an extract from the LFIB, by issuing the command show mpls forwarding-table.
Example 3-2. Extract of the LFIB
lactometer# 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
The local label (or tag) is the label that this LSR assigns and distributes to the other LSRs. As such, this LSR expects labeled packets to come to it with these labels as the top ones in the label stack. If this LSR were to receive a labeled packet with the top label 22, it would swap the label with label 17 and then forward it on the Ethernet0/0/0 interface. This is an example of the label-to-label forwarding case.
If this LSR receives a packet with top label 16, it removes all labels and forwards the packet as an IP packet, because the outgoing label (tag) is Untagged. This is an example of the label-to-IP case. If the LSR receives a packet with top label 18, it removes the top label (pop one label) and forwards the packet as a labeled packet or as an IP packet. You can see in this output some examples of the swap and pop operation. Example 3-3 shows an example of a push operation. The incoming label 23 is swapped with label 20, and label 16 is pushed onto label 20.
Example 3-3. Example of Show MPLS Forwarding-Table (Detail)
lactometer#show mpls forwarding-table 10.200.254.4 Local Outgoing Prefix Bytes tag Outgoing Next Hop tag tag or VC or Tunnel Id switched interface 23 16 [T] 10.200.254.4/32 0 Tu1 point2point [T] Forwarding through a TSP tunnel. View additional tagging info with the 'detail' option lactometer#show mpls forwarding-table 10.200.254.4 detail Local Outgoing Prefix Bytes tag Outgoing Next Hop tag tag or VC or Tunnel Id switched interface 23 16 10.200.254.4/32 0 Tu1 point2point MAC/Encaps=14/22, MRU=1496, Tag Stack{20 16}, via Et0/0/0 00604700881D00024A4008008847 0001400000010000 No output feature configured
To see all the labels that change on an already labeled packet, you must use the show mpls forwarding-table [network {mask | length}] [detail] command. In Example 3-3, you can see the difference between the output of this command with and without the detail keyword. If the detail keyword is specified, you can see all the labels that change in the label stack. From left to right between {}, you see the first label, which is the swapped label (20), and then the pushed label (16) onto the swapped label. Without the detail keyword, you see only the pushed label (16).
The aggregate operation remains. When you perform an aggregation (or summarization) on an LSR, it advertises a specific label for the aggregated prefix, but the outgoing label in the LFIB shows "Aggregate." Because this LSR is aggregating a range of prefixes, it cannot forward an incoming labeled packet by label-swapping the top label. The outgoing label entry showing "Aggregate" means that the aggregating LSR needs to remove the label of the incoming packet and must do an IP lookup to determine the more specific prefix to use for forwarding this IP packet. Example 3-4 shows an entry in the LFIB on an egress PE router in an MPLS VPN network.
The egress LSR receiving a packet with label 23 would remove that label and perform an IP lookup on the destination IP address in the IP header.
Example 3-4. Example of an Entry in the LFIB for an MPLS VPN Prefix
singularity#show mpls forwarding-tablevrf cust-one Local Outgoing Prefix Bytes tag Outgoing Next Hop tag tag or VC or Tunnel Id switched interface 23 Aggregate 10.10.1.0/24[V] 0
You know now how the labeled packet is forwarded to a specific next hop after a label operation. The CEF adjacency table, however, determines the outgoing data link encapsulation. The adjacency table provides the necessary Layer 2 information to forward the packet to the next-hop LSR. This is explained in greater detail in Chapter 6.
Example 3-5 shows an adjacency table on an LSR. The adjacency table holds the Layer 2 information needed to switch out a frame on the outgoing data link.
Example 3-5. Example of an Adjacency Table
lactometer#show adjacency detail Protocol Interface Address IP Ethernet0/0/0 10.200.200.2(13) 0 packets, 0 bytes epoch 0 sourced in sev-epoch 4 Encap length 14 00604700881D00024A4008000800 ARP TAG Ethernet0/0/0 10.200.200.2(9) 231 packets, 22062 bytes epoch 0 sourced in sev-epoch 4 Encap length 14 00604700881D00024A4008008847 ARP IP Serial0/1/0 point2point(10) 258 packets, 35612 bytes epoch 0 sourced in sev-epoch 4 Encap length 4 0F000800 P2P-ADJ TAG Serial0/1/0 point2point(5) 0 packets, 0 bytes epoch 0 sourced in sev-epoch 4 Encap length 4 0F008847 P2P-ADJ
To recap the label operations:
- Pop—The top label is removed. The packet is forwarded with the remaining label stack or as an unlabeled packet.
- Swap—The top label is removed and replaced with a new label.
- 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.
- Untagged/No Label—The stack is removed, and the packet is forwarded unlabeled.
- Aggregate—The label stack is removed, and an IP lookup is done on the IP packet.
Load Balancing Labeled Packets
If multiple equal-cost paths exist for an IPv4 prefix, the Cisco IOS can load-balance labeled packets, as illustrated in the Cisco IOS output of Example 3-6. You can see that the incoming/local labels 17 and 18 have two outgoing interfaces. If labeled packets are load-balanced, they can have the same outgoing labels, but they can also be different. The outgoing labels are the same if the two links are between a pair of routers and both links belong to the platform label space. If multiple next-hop LSRs exist, the outgoing label for each path is usually different, because the next-hop LSRs assign labels independently.
Example 3-6. Example of Load Balancing Labeled Packets
horizon#show mpls forwarding-table Local Outgoing Prefix Bytes tag Outgoing Next Hop tag tag or VC or Tunnel Id switched interface 17 Pop tag 10.200.254.3/32 252 Et1/3 10.200.203.2 Pop tag 10.200.254.3/32 0 Et1/2 10.200.201.2 18 16 10.200.254.4/32 10431273 Et1/2 10.200.201.2 16 10.200.254.4/32 238 Et1/3 10.200.203.2
If a prefix is reachable via a mix of labeled and unlabeled (IP) paths, Cisco IOS does not consider the unlabeled paths for load-balancing labeled packets. That is because in some cases, the traffic going over the unlabeled path does not reach its destination. In the case of plain IPv4-over-MPLS (MPLS running on an IPv4 network), the packets reach the destination even if they become unlabeled. The packets become unlabeled at the link where MPLS is not enabled, and become labeled again at the next link where MPLS is enabled. At the place where the packets become unlabeled, an IP lookup has to occur. Because the network is running IPv4 everywhere, it should be able to deliver the packet to its destination without a label. However, in some scenarios, as with MPLS VPN or Any Transport over MPLS (AToM), a packet that becomes unlabeled in the MPLS network at a certain link does not make it to its final destination.
In the example of MPLS VPN, the MPLS payload is an IPv4 packet, but the P routers do not normally have the VPN routing tables, so they cannot route the packet to its destination. In the case of AToM, the MPLS payload is a Layer 2 frame; therefore, if the packet loses its label stack on a P router, the P router does not have the Layer 2 forwarding tables present to forward the frame further. This is why in an MPLS network labeled packets are not load-balanced over an IP and a labeled path. In general, the intelligence to forward the MPLS payload is on the edge LSRs (or PEs) only. Therefore, a P router cannot—in most cases—forward a packet that becomes unlabeled.
Example 3-7 shows load balancing via two labeled paths. Then Label Distribution Protocol (LDP) is disabled over one of the two outgoing links, and that link is removed as a next hop in the LFIB. The command no mpls ip on an interface disables LDP on that interface.
Example 3-7. Changing One Path to Unlabeled
horizon#show mpls forwarding-table 10.200.254.4 Local Outgoing Prefix Bytes tag Outgoing Next Hop tag tag or VC or Tunnel Id switched interface 18 18 10.200.254.4/32 56818 Et1/2 10.200.201.2 18 10.200.254.4/32 160 Et1/3 10.200.203.2 horizon#conf t Enter configuration commands, one per line. End with CNTL/Z. horizon(config)#interface ethernet 1/3 horizon(config-if)#no mpls ip horizon(config-if)#^Z horizon#horizon#show mpls forwarding-table 10.200.254.4 Local Outgoing Prefix Bytes tag Outgoing Next Hop tag tag or VC or Tunnel Id switched interface 18 18 10.200.254.4/32 57270 Et1/2 10.200.201.2
Unknown Label
In normal operation, an LSR should receive only a labeled packet with a label at the top of the stack that is known to the LSR, because the LSR should have previously advertised that label. However, it is possible for something to go wrong in the MPLS network and the LSR to start receiving 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 packet, or drop the packet. The Cisco LSR drops the packet. This is the right thing to do, because this LSR did not assign the top label, and it does not know what kind of packet is behind the label stack. Is it an IPv4, IPv6 packet, a Layer 2 frame, or something else? The LSR can try to figure that out by performing an inspection of the MPLS payload. But then the same problem as described in the previous section occurs: The LSR on which the packet or frame becomes unlabeled is likely not able to look up the destination of the packet or frame. Even if the LSR tries to forward the packet, it is not guaranteed that the packet will not get dropped at a router downstream. The only right thing to do is to drop an incoming packet with an unknown top label.