Table of Contents
Preface
In the previous articles, we covered the concepts of MPLS, IP Routing tables & various IP forwarding mechanisms, and Label Distribution Protocol (LDP). Now is the time to talk about MPLS-related tables Label Information Base (LIB) and Label Forwarding Information Base (LFIB) using which the MPLS forwarding takes place. I would recommend going through the related linked posts first before diving into this article.
A Quick Recap of MPLS, LDP, and the IP Routing Tables
The following is a brief summary of what we have learned from the MPLS and IP forwarding perspective until now.
- The IP packet routing and forwarding make use of two routing tables: Routing Information Base (RIB) and Forwarding Information Base (FIB). These are the basic and the core routing tables.
- Cisco Express Forwarding (CEF) is the current most used and efficient IP forwarding mechanism for Cisco devices. But, the other vendors may have their own forwarding mechanisms.
- CEF creates two tables: Formation Information base (FIB) and Adjacency Table which store the forwarding information.
- The information from CEF is used for MPLS forwarding. Thus, CEF should be enabled for MPLS functionality to work.
- MPLS works on the idea of assigning labels to the IP packets. These labels can be swapped, popped, or stacked based on the operations required.
- MPLS forwarding is more efficient than time-consuming IP Forwarding mechanisms (including CEF).
- In MPLS, only labels are referenced from packets. The packets are then forwarded based on the mapping of labels with IP prefix mapping, next-hop IP address, and the exit interface.
- The labels are generated and distributed in the MPLS network using the Label Distribution Protocol. Though there are other protocols too, but LDP is commonly used.
- Label Distribution Protocol (LDP) session is formed between the peer routers in a subnet. As a result, after the LDP adjacency is in place, the label information is advertised between the routers. And, the two tables namely Label Information Base (LIB) and Label Forwarding Information Base (LFIB) are created that are used to forward MPLS packets.
Label Information Base (LIB) & Label Forwarding Information Base (LFIB)
Introduction
Label Information Base or LIB is a routing table on a router where all the label bindings exchanged between that router and its LDP peers are stored. Like RIB, LIB is a Control-Plane MPLS table and is not used for the actual forwarding of the MPLS packets.
Label Forwarding Information Base or LFIB, like FIB, is a Data-Plane MPLS forwarding table. LFIB is used to forward the MPLS packets. LIB aids in creating the LFIB table with the help of the IP Routing table.
Image 1 – Relationship between Routing tables (RIB, FIB, LFIB, and LIB)
The above image shows the relationship between Data-Plane and Control-Plane tables (LIB, FIB, RIB, and LFIB). Based on this relationship, you would be able to derive how different tables are associated with each other. The relationships are defined across this article.
Creating Label Information Base and Label Forwarding Information Base
When LDP is enabled, the first thing that happens is that the routers in the MPLS network create locally unique labels for all the destination prefixes in their IP routing tables.
Once the label information is created, it is stored in LIB. It is then advertised to the LDP peers with the destination route. As soon as a router gets peer information, it stores the data in the LIB table.
Consider Image 2 where we have a destination network DN.
Image 2 – Sample MPLS Network with FIB tables
Example
The image shows the destination network DN and four Label Switch Routers i.e. A, B, C, and D part of an MPLS network. When IGP would have been enabled on the LSRs, each router would have generated its IP Routing Table and also FIB & Adjacency table via CEF. When LDP is configured and is enabled on the LSRs, all the steps relating to LDP Adjacency are performed after which Routers are ready to advertise their label information to their peers.
In Image 2, the FIB tables for LSR A, B, and C is shown (FIB for D is not shown for clarity). Also, to be specific, here we have combined the output of FIB and a part of the Adjacency table that would have been built using CEF. The entries in these tables are for the best routes to the destination DN.
Consider the Label Information Base (LIB B) and Label Forwarding Information Base (LFIB B) on LSR B empty for now.
The FIB (FIB A) of LSR A contains the Next Hop IP (B Intf IP) for destination DN which is the IP address of the interface on LSR B (B Intf) that connects with Exit interface (A Intf). So, if an MPLS packet arrives on LSR A for destination DN, the label switching will happen and the packet would be forwarded towards B Intf on LSR B via A Intf on LSR A.
Label Distribution
Let us suppose that Downstream-Unsolicited (DU) label distribution mechanism is used in our network. So, using this method, the locally unique labels are generated by each router. This is done forl all the destination prefixes and labels are advertised to all the LDP peers. Image 2 shows this using the example. The LSR B has generated local label binding of value 20 for the Destination DN and has advertised it to all the LDP Peers (LSR A and LSR C).
Before advertising the label, LSR B stores the data in its LIB i.e. LIB B (see Image 2). Using the information in the LIB and IP Routing Table, the Label Forwarding Information Base – LFIB B is generated. Let us consider that no label bindings are available as of now from the downstream LSR C. If the best path is known with Next Hop IP and Outgoing Interface, LFIB B will contain:
- Destination Network value DN.
- Local Label / In Label as 20.
- Next Hop IP as C Intf IP (Interface on Router C connected to BC interface on LSR B).
- Outgoing Interface as BC Intf (Interface on LSR B and connecting Router C).
- The Outgoing Label is marked as Pop (it means that label should be popped/removed before forwarding) as no label value is yet received from downstream LSR C for destination DN.
Command to show LDP Bindings
The label bindings are advertised inclusive of the destination route and LDP ID (Router ID:Label Space ID).
Let us consider destination DN to be 10.3.3.0/24. Following is the command output to see the LDP bindings (LIB) on Cisco. For demo purposes, we have taken CLI outputs of LSR A (Router ID = 1.1.1.1) and LSR B (Router ID = 2.2.2.2) as in Image 2. The output contains local label binding and peers label bindings for DN.
LSR B# show mpls ldp bindings
10.3.3.0/24 , rev 12
local binding: label:20
remote bindings :
lsr:1.1.1.1:0, label:10 -> LDP ID of LSR A and Label received from LSR A
lsr:3.3.3.3:0, label:30 -> LDP ID of LSR C and Label received from LSR C
LSR A# show mpls ldp bindings
10.3.3.0/24, rev 10
local binding: label:10
remote bindings :
lsr:2.2.2.2:0, label:20
lsr:3.3.3.3:0, label:30
Advertised label information and augmenting Label Information Base and Label Forwarding Information Base
Refer to Image 3 for this section.
Image 3 – Label Information Base and Label Forwarding Information Base Example
In the above image, we are considering that all the LDP advertisements have happened between the network routers. Also, the Label Information Base for all the routers has been constructed. We have removed the Outgoing Interface column from the FIB tables in Image 3 for clarity purposes. Let us discuss in brief what will happen when LDP Adjacency is established between the LSR A, B, and C.
Example
LSR A
LSR A will create a local label 10 against destination DN, add in its LIB, and create an initial Label Forwarding Information Base (If the peer labels are not available, Pop value will be used for the Outgoing label). As a result, it advertises the label binding to LSR B. Label Switch Router A will also receive label 20 from LSR B and label 30 from LSR C (via LSR B) for the destination DN.
With all the information in place and using the data from the Routing Table, the correct outgoing label will be chosen. The LFIB A will be updated replacing the Pop value. Similarly, the chosen label value will also be added to the FIB against the DN. FIB with label entry helps if any unlabeled packet needs to be forwarded into the MPLS network (as router checks FIB for forwarding of unlabeled packets).
Consider LFIB A in Image 3. For destination DN, the local label is 10. Also, as per the Routing table, the best route to DN is via LSR B (Check Next Hop IP column in FIB A in Image 3). The Next Hop IP and Exit/Outgoing interface are derived from the IP Routing table entry for the Destination DN via LSR B. The Outgoing Label is set to 20 as received from LSR B. For more details, refer to the next section below.
LSR B
Similarly, LSR B will create a local label value of 20 for destination DN, store in its LIB, and advertise it to LSR A and LSR C. It will also receive label 30 from LSR C and label 10 from LSR A for DN. Based on the values from LIB B and the Routing Table, LFIB B will be built and updated with the Outgoing label as 30 (Pop value updated) which it received from LSR C. Remember, in the last section, we had stated that the Outgoing label value was set as Pop for LSR B as no label bindings were received.
LSR C
LSR C will create a local label value of 30 for destination DN. As a result, it will store the same in its LIB. Later, LSR C will advertise the label to LSR B using which it will also be advertised to LSR A. It will also receive label 20 from LSR B and label 10 from LSR A (via Router B) for DN. Based on the values from LIB C and the Routing Table, LFIB C will also be built.
Note: The label value for the destination DN will also be added to the related entry in the FIB table of every router (as shown in Image 3.)
How Label Forwarding Information Base gets the values using LIB and Routing Table?
Example
Consider Image 4 as an example.
Image 4 – Example for LFIB values updates via Routing table and LIB
Suppose, we have a Destination Route 4.4.4.0/24. It is advertised using IGP and is captured by LSR A, LSR B, and LER A.
Let us look at the routing table for LER A for route 4.4.4.0/24.
LER A# show ip route 4.4.4.0
Routing entry for 4.4.4.0/24
Known via “ospf 100”, distance 110, metric 7
Last update from 10.1.0.2 on FastEthernet0/0 0:00:58 ago
Routing Descriptor Blocks:
* 10.1.0.2, from 4.4.4.0, 0:00:58 ago, via FastEthernet0/0
Route metric is 7, traffic share count is 1
Also, LER A will receive label bindings for 4.4.4.0/24. Let us see the command output for LDP bindings or LIB entries.
LER A# show mpls ldp bindings 4.4.4.0 24
lib entry: 4.4.4.0/24, rev 12
local binding: label: 40
remote binding : lsr:1.1.1.1:0, label:10
remote binding : lsr:2.2.2.2:0, label:20
The above output shows that LER A has received label bindings 10 and 20 from LSR A & LSR B respectively for 4.4.4.0/24. LER A has also created a local binding 40 for the route.
As also highlighted in the previous section, LFIB for LER A may have been created with the Outgoing label as Pop (if no label values would have been available from LDP peers.)
Working
LER A needs to decide which route should a packet take for the destination DN when it receives it. Here we have two label bindings each from LSR A and LSR B (see LDP bindings command above). But, only a particular label binding should be selected. We need to choose the best path for route 4.4.4.0/24 from the LER A and then fetch the corresponding label value. From the routing table (see show ip route command above), we can see that the best path is via FastEthernet0/0 on LER A and Next Hop as 10.1.0.2 which is the IP Address on LSR B.
The LIB of LER A has no entry related to 10.1.0.2 as of now. So, how the LFIB outgoing label value is derived? The answer is, that during the LDP session setup, the LDP Peers also inform each other about the connected interfaces between them. So, LER A will know that 10.1.0.2 is the IP address of an interface on LSR B. And thus, label entry for LSR B will be selected. The LFIB for LER A will be created using the label binding from LSR B (lsr:2.2.2.2:0) i.e. LER will have outgoing label value 20 for 4.4.4.0/24.
Following is what the Label Forwarding Information Base output would look like using CLI on LER A.
LER A# show mpls forwarding 4.4.4.0
Local Label | Outgoing Label | Prefix | Outgoing Interface | Next Hop | Bytes Switched |
40 | 20 | 4.4.4.0/24 | Fa0/0 | 10.1.0.2 | 13912344 |
The label 20 will also be attached to the FIB (CEF entry) against the destination 4.4.4.4/24.
*Note: All the values depicted above are for demo purposes.
Additional Information
There are 2 special labels “implicit-null” and “explicit-null”. Both of these are sent by the edge or last-hop router to the upstream router.
Implicit-null sent to the penultimate hop router by the last hop router asks the penultimate router to Pop the MPLS label and send only the IP packet to it. This is done to reduce the load on the edge router that otherwise would have to perform 2 lookups (MPLS label and IP lookup) to send the packet to the destination. This mechanism of popping the label on the penultimate hop router is called Penultimate Hop Popping (PHP.)
Explicit-null sent to the penultimate hop router by the last hop router asks the penultimate router to keep the QoS information intact if the penultimate router has to Pop the MPLS label. In this case, the penultimate router will send the packet with label 0 to the last router with all the other information of the MPLS header intact. Thus the QoS value will be available to the edge router which otherwise would have been removed in case of PHP.
Packet Operation
Now that we have learned about IP packet forwarding, MPLS, LDP, and all the routing tables, let us see how it all works together.
Example
Image 5 – IP and MPLS Packet Operation w.r.t. RIB, FIB, LIB, and LFIB
In the above image, it is assumed that we are inside a network where a packet is getting forwarded through the nodes. Suppose, an unlabeled IP packet reaches a router. The router will do the FIB lookup (with Adjacency table,) and will be forwarded to the Next Hop as an IP packet.
MPLS Packet Identification
Now, let us suppose that an MPLS packet arrives at the same router which is also part of the MPLS network. As a result, the MPLS packet will refer to the LFIB and will be forwarded (via label Swap, Pop, Stack) to the Next Hop. Based on the outcome of the label operation, the packet will exit the router either as an MPLS packet or as an IP packet.
What if an IP packet meant to be routed through the MPLS network arrives at the Ingress/Edge Router?
Suppose an IP packet meant to be routed through an MPLS network arrives at the Edge Router of the MPLS network for a destination. Considering FIB, LIB, and LFIB, all in place, as soon as the packet arrives, the Destination lookup will happen against the FIB. The FIB would already be containing a label value against the destination entry when LFIB would have been created for the edge router. Due to the label entry, the router will identify that the packet is meant for the MPLS network and will then refer to its Label Forwarding Information Base for forwarding information.
Using LFIB, the concerned label would be attached to the IP packet converting it into an MPLS packet, which will then be forwarded to the Next-hop in the MPLS network. The labeled packet will flow as per the MPLS switching and forwarding mechanism between the LSRs using LFIB of each router. The label will be removed when exiting the MPLS network and the packet would be forwarded to the destination as a native IP packet.
Where does FIB lookup happen in the case of an MPLS network?
For a packet to be routed via the MPLS network, the FIB lookup happens at the Edge Router which identifies the label information. Once the label is applied, the labeled packet gets forwarded inside the MPLS network using LFIB and not FIB.
LIB & LFIB: FAQs
Label Information Base or LIB is a routing table on a router where all the label bindings exchanged between that router and its LDP peers are stored. Like RIB, LIB is a Control-Plane MPLS table and is not used for the actual forwarding of the MPLS packets.
Label Forwarding Information Base or LFIB, like FIB, is a Data-Plane MPLS forwarding table. LFIB is used to forward the MPLS packets. LIB aids in creating the LFIB table with the help of the IP Routing table.
During the LDP session setup, the LDP Peers also inform each other about the connected interfaces between them. So, a source LSR would know that a particular IP is that of an interface on destination LSR, and thus label entry for destination LSR will be selected. The LFIB is then created using the local LIB and the IP Routing table.
Due to the label entry, the router will identify that the packet is meant for the MPLS network and will then refer to its Label Forwarding Information Base for forwarding information.
This is one of the simplest way to explain the routing protocols..super👍
Thank you. Glad to know that the article was useful to you.