IP Routing Basics – Huawei

Routers forward packets based on routing tables and forwarding information base (FIB) tables. Each router maintains at least one routing table and one FIB table. Routers select routes based on routing tables and forward packets based on FIB tables.

A routing protocol can import and advertise routes that are discovered by other routing protocols. For example, if a router running the Open Shortest Path First (OSPF) protocol needs to use OSPF to advertise direct routes, static routes, or Intermediate System-Intermediate System (IS-IS) routes, the router must import the routes into the OSPF routing table.

A router uses the local core routing table to store preferred routes. The router then sends the preferred routes to the FIB table to guide packet forwarding. The router selects routes according to the priorities of protocols and costs stored in the routing table.

Each router maintains a local core routing table (namely, an IP routing table), and each routing protocol maintains its own routing table.

In Figure 1-1 , the routing table of RouterA shows that it connects to three networks, so it has three IP addresses and three outbound interfaces.

Interface: indicates the outbound interface through which an IP packet is forwarded.

NextHop: indicates the IP address of the next device that an IP packet passes through.

The Preference value is used to compare the preferences of different routing protocols, while the Cost value is used to compare the preferences of different routes of the same routing protocol.

Cost: indicates the route cost. When multiple routes to the same destination have the same preference, the route with the lowest cost is selected as the optimal route.

Pre: indicates the routing protocol preference of a route. There may multiple routes to the same destination, which have different next hops and outbound interfaces. These routes may be discovered by different routing protocols or manually configured. A router selects the route with the highest preference (the smallest value) as the optimal route. For the routing protocol preference, see Routing Protocol Preference.

The network mask is composed of several consecutive 1s. These 1s can be expressed in either the dotted decimal notation or the number of consecutive 1s in the mask. For example, the network mask can be expressed either as 255.255.255.0 or 24.

The network segment address of a destination host or router is obtained through the “AND” operation on the destination address and network mask. For example, if the destination address is 10.1.1.1 and the mask is 255.255.255.0, the address of the network segment where the host or router resides is 10.1.1.0.

Mask: supplements the destination address to specially identify the address of the network segment where the destination host or router resides.

You can run the display ip routing-table command on a router to view basic information about the routing table of the router. The command output is as follows:

After routes of protocols are deleted from the local core routing table, and the number of routes falls below the upper limit, the system prompts all the protocols that failed to add routes to the local core routing table to re-add the routes to the local core routing table. This process restores most of the routes in the local core routing table. The size of released table space determines whether all routes in the local core routing table can be restored.

If a protocol fails to add routes to the local core routing table due to a specific route limitation, the system records the failure with the protocol name and routing table ID.

A local core routing table stores routes of different routing protocols. If the number of routes in the local core routing table reaches the upper limit, no more route can be added to the table. The local core routing table has the following route limitations:

Matching with FIB Table

After selecting an optimal route from the routing table, a router sends it to the FIB table. When receives a packet, the router compares it against the FIB table to find the optimal route to forward the packet.

Each entry in the FIB table contains the physical or logical interface through which a packet is sent to a network segment or host to reach the next router. An entry can also indicate whether the packet can be sent to a destination host in a directly connected network.

The router performs the “AND” operation on the destination address in the packet and the network mask of each entry in the FIB table. The router then compares the result of the “AND” operation with the entries in the FIB table to find a match and chooses the optimal route to forward packets according to the longest match rule.

For example, assume that a router has the following routing table:

Routing Tables:
Destination/Mask    Proto  Pre  Cost     Flags NextHop         Interface
 0.0.0.0/0      Static   60   0       D   192.168.0.2      GigabitEthernet1/0/0
 10.8.0.0/16    Static   60   3       D   192.168.0.2      GigabitEthernet1/0/0
 10.9.0.0/16    Static   60   50      D   172.16.0.2       GigabitEthernet3/0/0
 10.9.1.0/24    Static   60   4       D   192.168.0.2      GigabitEthernet2/0/0
 10.20.0.0/16   Direct   0    0       D   172.16.0.1       GigabitEthernet4/0/0

After receiving a packet carrying the destination address 10.9.1.2, the router searches the following FIB table:

 FIB Table:
 Total number of Routes : 5
Destination/Mask   Nexthop         Flag TimeStamp     Interface              TunnelID
0.0.0.0/0            192.168.0.2       SU   t[37]         GigabitEthernet1/0/0  0x0
10.8.0.0/16          192.168.0.2       DU   t[37]         GigabitEthernet1/0/0  0x0
10.9.0.0/16          172.16.0.2        DU   t[9992]       GigabitEthernet3/0/0  0x0
10.9.1.0/24          192.168.0.2       DU   t[9992]       GigabitEthernet2/0/0  0x0
10.20.0.0/16         172.16.0.1        U    t[9992]       GigabitEthernet4/0/0  0x0

The router performs the “AND” operation on the destination address 10.9.1.2 and the masks 0, 16, and 24 to obtain the network segment addresses: 0.0.0.0/0, 10.9.0.0/16, and 10.9.1.0/24. The three addresses match three entries in the FIB table. The router chooses the entry 10.9.1.0/24 according to the longest match rule, and forwards the packet through GigabitEthernet2/0/0.