The show IP route command displays the routing table's entries. The output of this command contains the routes the router can use to forward data packets.
The show IP route is a privileged exec mode command. On Cisco routers, it displays the routing table's entries. Routers use routing table entries to forward packets. When a router receives a data packet, it compares the packet's destination address with all routes available in the routing table. It selects the route that matches the destination address to forward the packet. If it does not find a matching route, it discards the packet.
This tutorial is part of the tutorial series "Understanding route types in the routing table.". Other parts of this series are the following.
Chapter 1 The show IP route command on Routers
Chapter 2 Routing table updating methods
Chapter 3 Directly connected routes and Local routes
Chapter 4 Static and Floating Static Routes Explained
Chapter 5 Static and Dynamic routes in the routing table
Chapter 6 Default Route in the Routing Table
Chapter 7 Network Routes and Host Routes Explained
The following image shows the output of the show IP route command.
The command organizes the output into three sections: codes, default routes, and routes.
Codes
Each entry in the routing table starts with a letter. The letter shows the route's source. The codes section describes the codes the routing table uses to indicate the source of routes.
For example, the letter C shows the directly connected routes in the routing table.
Default Routes
The second section shows the default routes. Routers use default routes to forward a packet when no other routes for the packet's destination address are available.
Routes
The third section shows all routes the router can take. In this section, the routing table keeps only the routes the router can use to forward the data packets. If two or more routes to the same destination are available, the router compares them based on many parameters and selects the best route. It keeps the best route in the routing table and the remaining routes in their protocol-specific tables.
Let us take an example. A router learns two routes to the same destination. It learns the first route from the RIP protocol and the second route from the EIGRP protocol. It compares both and finds the second route is better than the first route. It adds the second route to the routing table and keeps the first route in the RIP database table. It uses the routing table to make forwarding decisions. It uses protocol-specific tables for backup purposes. For instance, in the preceding example if the second route fails, the router automatically adds the first route to the routing table from the RIP database table.
Understanding route entries in the routing table
A route entry contains the following information.
Source
It is the first field of a route entry. It contains a letter that provides information about the route's source. The code section describes the meaning of all the letters this field can have.
Destination
It is the second field. It contains the destination network or host address. The router compares the packet's destination address with the address stored in this field.
AD and Metric value
These are written with the destination field in a square bracket.
AD (Administrative distance) value is the trustworthiness of the source. Routers use a scale of number range 0 - 255. On this scale, 0 is the most trustworthy source, and 255 is the least trustworthy source.
Routing protocols assign a metric value to each route. It helps them to identify the best route when multiple routes to the same destination are available.
Next hop IP address
This field saves the IP address of the next hop. If the router selects this route to forward the packet, the router forwards the packet to the IP address specified in this field.
Elapsed time
This field stores the elapsed time since this route is added to the routing table.
Exit interface
It is the last field of a routing entry. It saves the interface's name that is connected to the next hop. If the router selects this route to forward the packet, the router forwards the packet from the interface specified in this field.