The show ip route Command Explained

This tutorial explains how to read the output of the show ip route command. Learn how the routing table organizes the routing information and how to view it.

The 'show ip route' command displays the structure and contents of the routing table. You can use the 'show ip route' for the following purposes.

  • To list the routing table's entries
  • To view how many routes available for a particular destination
  • To view the route the router uses to forward data packets for a specific destination
  • To know the routes added by a routing protocol
  • To know the routes added by the router from the IP configurations
  • To view the current status of a route
  • To verify and troubleshoot the routing

To use the 'show ip route' command, enter privileged-exec mode and run the following command.

#show ip route

The output of this command is organized into three sections. These sections are Codes, Default route, and Routes. The following image shows the output of this command.

the show ip route command

Codes

The routing table uses the abbreviated code to store the type of route. This section displays the meaning of each abbreviated code.

Default route

This section displays the default route. The router uses the routing table's routes to forward data packets. If there is no route available for the destination address of a data packet, the router uses the default route to forward the data packet. If the default route is not set, the router discards the data packet.

Routes

The routing table puts all routes in this section. To arrange routes, the routing table uses blocks. Each block contains a classful network and the classless networks created from the classful network. If a classful network is subnetted into small classless networks and the router knows the routes for the classless networks, the routing table uses a heading to group all classless networks of the same classful network.

The routing table uses the heading for a classful network only if it knows more than one route for the classful network. If there is only one route for the network, the routing table adds the route without the heading.

The following image shows routes with the heading and without the heading.

heading in output of ip route command

The heading includes three things: the classful network, the total number of subnets, and the total number of masks used to create the subnets. Let's understand these things.

The classful network

The routing table organizes routes by classful networks. If a classful network is subnetted into classless networks and the routes for the classless networks are available, the router arranges all classless networks under the classful network.

Total number of subnets

A router learns routes from various sources. This part shows the total number of routes the router learned from all sources for the classful network. The total number includes all routes for the classful network and all classless networks created from the same classful network.

When you assign an IP configuration to the interface, the router automatically creates two routes from the IP configuration and adds them to the routing table. The router adds the first route for the network address of the IP configuration. The router uses this route to forward data packets. The router adds the second route for the interface. The router uses this route to reach the interface. The router uses the prefix /32 for this route.

total number of mask

Total number of masks

This is the total number of different masks used in all routes for all subnets created from the classful network mentioned in the heading.

The routing table uses a heading to organize all routes created from the same classful network. We have already discussed the things the routing table uses to create the heading. Now let's discuss the things the routing table uses to build route entries.

Legend code

The legend code is the first thing in a route entry. A router can learn a route from various sources. The legend code shows the source from which the router learned the route. The routing table stores the legend code in the abbreviated form. The first section of the output of the 'show ip route' command shows the meaning of each code.

legend code in output

Network address / Subnet mask

Each route reaches a specific destination. Each route entry includes only one destination network. After the legend code, the routing table places the destination network address with the subnet mask in the route entry.

network address and subnet mask

Routers use the routing table to make a forwarding decision. A router compares the destination address of the data packet to the network address stored in each entry of the routing table. If the network address mentioned in an entry matches the destination address of the data packet, the router forwards the data packet from the interface or to the next-hop router's interface mentioned the matching entry.

To learn how this process works or how routers take a routing decision, you can check the following tutorial.

Routing Decision Longest Match Explained

AD(Administrative Distance)/Metric

ad value and metric

The routing table stores only one route for each destination. If the router learns more than one route for a destination from different sources, the router adds only the best route to the routing table. To select the best route, the router uses the AD (Administrative Distance) value.

The AD value is the trustworthiness of a source. A source with a lower AD value is considered more reliable than a source with a higher AD value.

Let's take an example. A router learned two routes for the same destination. The AD value of the first source is 10 and the AD value of the second source is 20. The router will add the route learned from the first source to the routing table.

A router can also learn more than one route from the same source. If the router learns more than one route for a destination from the same source, the router uses the metric value of the routes to select the best route. Sources use the metric value to calculate the best route for the destination.

In simple words, a router uses the AD value to select the best route learned from different sources and the metric value to select the best route learned from the same source.

difference between ad value and metric value

The IP address of the next-hop router

This is the IP address of the next-hop router. A router forwards the packet to the next-hop router if the destination address and the address specified in the route match.

next-hop ip address

EIGRP/OSPF Timer

EIGRP and OSPF routing protocols use a timer for each learned route. If the route is learned by EIGRP or OSPF, the routing protocol includes the timer in the routing information.

opsf and eigrp timers

Exit interface

This is the local interface the router uses to forward the data packet.

exit interface

That's all for this tutorial. In this tutorial, we discussed how the 'show ip route' command formats the output and learned the meaning of various codes in the output.

ComputerNetworkingNotes CCNA Study Guide The show ip route Command Explained