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. Show Routing TableEach router maintains a local core routing table (namely, an IP routing table), and each routing protocol maintains its own routing table.
Routing Table ContentsYou 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: <HUAWEI> display ip routing-table Proto: Protocol Pre: Preference Route Flags: R - relay, D - download to fib, T - to vpn-instance, B - black hole route ------------------------------------------------------------------------------ Routing Table: _public_ Destinations : 14 Routes : 14 Destination/Mask Proto Pre Cost Flags NextHop Interface 0.0.0.0/0 Static 60 0 RD 10.137.216.1 Vlanif20 10.10.10.0/24 Direct 0 0 D 10.10.10.10 Vlanif20 10.10.10.10/32 Direct 0 0 D 127.0.0.1 InLoopBack0 10.10.10.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0 10.10.11.0/24 Direct 0 0 D 10.10.11.1 LoopBack0 10.10.11.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0 10.10.11.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0 10.137.216.0/23 Direct 0 0 D 10.137.217.208 Vlanif20 10.137.217.208/32 Direct 0 0 D 127.0.0.1 InLoopBack0 10.137.217.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0 127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0 127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0 127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0 255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0 A routing table contains the following key data for each IP packet:
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. Automatic Restoration After the Number of Routes Exceeds the Upper LimitA 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:
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. 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. Matching with FIB TableAfter 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. |