Cisco Command Christmas Calendar #19: show ip route

Uh oh, the ping doesn't work... What do you do? Probably show ip route, which will display the contents of the routing table. The routing table is the ultimate source a router uses to forward packets. It is the best of the best. The router builds the routing table from routes learned from different sources, including connected, static, and different routing protocols. Example:

R1#show ip route
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
       a - application route
       + - replicated route, % - next hop override

Gateway of last resort is not set

     10.0.0.0/8 is variably subnetted, 5 subnets, 3 masks
S       10.0.0.0/8 [1/0] via 192.168.10.2
C       10.10.10.0/30 is directly connected, Serial1/0
L       10.10.10.1/32 is directly connected, Serial1/0
C       10.10.20.0/30 is directly connected, Serial2/0
L       10.10.20.1/32 is directly connected, Serial2/0
     172.31.0.0/24 is subnetted, 1 subnets
S       172.31.10.0 [1/0] via 10.10.10.2
     192.168.10.0/24 is variably subnetted, 2 subnets, 2 masks
C       192.168.10.0/30 is directly connected, Serial3/0
L       192.168.10.1/32 is directly connected, Serial3/0
D   192.168.32.0/26 [90/25789217] via 10.10.10.1, 00:00:20, Serial1/0
R   192.168.32.0/24 [120/4] via 10.10.10.1, 00:02:24, Serial1/0
O   192.168.32.0/19 [110/229840] via 10.10.10.1, 00:05:37, Serial1/0

There are two types of codes on the left hand side, which indicate the protocol that derived the route and the type of route. For example, B for BGP, D for EIGRP, and O for OSPF are available for protocols and E1/E2 for OSPF external type 1/2 route or L1/L2 for IS-IS level 1/2 routes.

Let's break down D   192.168.32.0/26 [90/25789217] via 10.10.10.1, 00:00:20, Serial1/0:
  • D indicates an EIGRP route
  • 192.168.32.0/26 indicates the address of the remote network
  • [90/25789217]: The first number in brackets is the administrative distance of the information source; the second number is the metric for the route.
  • via 10.10.10.1 specifies the address of the next device to the remote network.
  • 00:00:20 specifies the last time the route was updated (in hours:minutes:seconds).
  • Serial1/0 specifies the interface through which the specified network can be reached.

The show ip route command also accepts a variety of keywords to narrow down the output. For example, you can limit the routing table to only display OSPF routes using the show ip route ospf command. Example:

R1#show ip route ospf
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
       a - application route
       + - replicated route, % - next hop override

Gateway of last resort is not set

O   192.168.32.0/19 [110/229840] via 10.10.10.1, 00:05:55, Serial1/0

The show ip route command can also display details for a specific destination or prefix. Example:

Device# show ip route 10.22.0.0

Routing entry for 10.22.0.0/16
  Known via “isis”, distance 115, metric 12
  Tag 120, type level-1
  Redistributing via isis
  Last update from 172.19.170.12 on Ethernet2, 01:29:13 ago
  Routing Descriptor Blocks:
    * 172.19.170.12, from 10.3.3.3, via Ethernet2
        Route metric is 12, traffic share count is 1
        Route tag 120

The above sample output also displays a tag attached to the route, which can be used for route filtering etc. Let's look at the details of the output:
  • Routing entry for 10.22.0.0/16 indicates the prefix
  • Known via “isis”, distance 115, metric 12 indicates how the route was learned, the administrative distance, and the metric.
  • Tag 120, type level-1 indicates a tag is assigned to the route and the type of route.
  • Redistributing via isis indicates the redistribution protocol.
  • Last update from 172.19.170.12 on Ethernet2, 01:29:13 ago indicates the IP address of the router that is the next hop to the remote network and the interface on which the last update arrived.
  • Routing Descriptor Blocks: * 172.19.170.12, from 10.3.3.3, via Ethernet2 displays the next-hop IP address followed by the information source.
  • Route metric is 12, traffic share count is 1 indicates the best metric value for this route and the packet ratio transmitted over various routes.
  • Route tag 120 indicates the route tag again.


Cisco documentation: show ip route

Comments