A router searches a routing table for routes, and each router maintains at least one routing table.
Routing tables store the routes discovered by various routing protocols. Based on the generation method, routes in a routing table consist of the following types:
Routes discovered by link layer protocols, which are also called interface routes or direct routes
Static routes configured by the network administrator
Dynamic routes that are discovered by dynamic routing protocols
Each router maintains a local core routing table, and each routing protocol maintains its own routing table.
Protocol routing table
A protocol routing table stores routing information discovered by the protocol.
A routing protocol can import and advertise routes generated by other routing protocols. For example, if a router that runs Open Shortest Path First (OSPF) needs to use OSPF to advertise direct routes, static routes, or Intermediate System to Intermediate System (IS-IS) routes, the router needs to import these routes into the OSPF routing table.
Local core routing table
A local core routing table stores protocol routes and optimal routes and selects routes based on the priorities of routing protocols and costs of routes. You can run the display ip routing-table command to view the local core routing table of a router.
Each router that supports Layer 3 virtual private network (L3VPN) maintains a management routing table (local core routing table) for each VPN instance.
On the NetEngine 8000 F, the display ip routing-table command displays brief information about the routing table.
<HUAWEI> display ip routing-table Route Flags: R - relay, D - download to fib, T - to vpn-instance, B - black hole route ------------------------------------------------------------------------------ Routing Table: Public Destinations : 8 Routes : 8 Destination/Mask Proto Pre Cost Flags NextHop Interface 0.0.0.0/0 Static 60 0 D 10.1.4.2 GigabitEthernet1/0/0 10.1.4.0/30 OSPF 10 0 D 10.1.4.1 GigabitEthernet1/0/0 10.1.4.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0 10.1.4.2/32 OSPF 10 0 D 10.1.4.2 GigabitEthernet1/0/0 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 entries:
Destination: indicates the destination IP address or the destination network address of an IP packet.
Mask: indicates the network mask. The network mask and the destination address are used together to identify the address of the network segment where the destination host or router resides.
The address of the network segment where the destination host or router resides can be calculated using after the AND operation on the destination address and network mask. For example, if the destination address is 22.214.171.124 and the mask is 255.255.255.0, the address of the network segment where the host or the router resides is 126.96.36.199.
The mask, which consists of several consecutive 1s, can be expressed either in dotted decimal notation or by the number of consecutive 1s in the mask. For example, the length of the mask 255.255.255.0 is 24, and therefore, the mask can also be expressed as 24.
Protocol: indicates the name of a routing protocol.
Pre: indicates the priority of a route that is added to the IP routing table. If multiple routes have the same destination but different next hops or outbound interfaces or these routes are static routes or discovered by different routing protocols, the one with the highest priority (the smallest value) is selected as the optimal route. For the route priority of each routing protocol, see Table 1.
Cost: indicates the route cost. When multiple routes to the same destination have the same priority, the route with the smallest cost is selected as the optimal route.
The Preference is used during the selection of routes discovered by different routing protocols, whereas the Cost is used during the selection of routes discovered by the same routing protocol.
Next hop: indicates the IP address of the next router through which an IP packet passes.
Interface: indicates the outbound interface that forwards an IP packet.
Based on the destination addresses, routes can be classified into the following types:
Network segment route: The destination is a network segment.
Host route: The destination is a host.
In addition, based on whether the destination is directly connected to the router, route types are as follows:
Direct route: The router is directly connected to the destination network.
Indirect route: The router is indirectly connected to the destination network.
Setting a default route can reduce the number of routing entries in the routing table. When a router cannot find a route in the routing table, the router uses the default route (destined for 0.0.0.0/0) to send packets.