Finding an IP Route


You want to find a particular route in your router's routing tables.


The EXEC level command to look at the entire IP routing table is:

Router>show ip route
Codes: C - connected, S - static, I - IGRP, 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, E - EGP
 i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, * - candidate default
 U - per-user static route, o - ODR

Gateway of last resort is to network is subnetted, 1 subnets
C is directly connected, Loopback1 is subnetted, 1 subnets
C is directly connected, Async1 is variably subnetted, 6 subnets, 3 masks
C is directly connected, Tunnel0
C is directly connected, Ethernet0
C is directly connected, Ethernet1
C is directly connected, Loopback0
O [110/11] via, 4d09h, Ethernet1
O IA [110/11] via, 2d11h, Ethernet0 is subnetted, 1 subnets
S [1/0] via
O*E1 [110/11] via, 1d07h, Ethernet0

You can also find the route to a particular device, such as

Router>show ip route
Routing entry for
 Known via "ospf 55", distance 110, metric 11, type inter area
 Redistributing via ospf 55
 Last update from on Ethernet0, 2d12h ago
 Routing Descriptor Blocks:
 *, from, 2d12h ago, via Ethernet0
 Route metric is 11, traffic share count is 1



The output of first command contains a lot of useful information. At the top is an explanation of the different codes used in the information that follows. For example, every line that begins with a "C" refers to a route that is directly connected to one of the router's interfaces, "S" means a static route, and so forth.

Note it's possible to have more than one such code, as in the route for In this case, the first letter, "O", indicates that this route was learned via the OSPF routing protocol. The next two letters, "IA," indicate that this is an OSPF interarea route. Similarly, the entry for is an OSPF external route of Type 1. The "*" indicates that this route is a candidate for default route. There may be several such candidates, but the one that the router thinks is best is captured at the top of the table in the line beginning "Gateway of last resort."

In a large network, it is often not very useful to list the entire routing table like this. Instead, if you are looking for a particular route, you can search for it directly, as the second example in this recipe shows.

Notice that the router did not have a 32-bit match for this particular destination, so it shows instead its best match, The result shows several useful pieces of information. It says exactly which match is being used. It tells you how the router knows about this route, via OSPF Process ID number 55, in this case. It also indicates that the next hop required to reach that destination is the device, and that it reaches this device through the interface Ethernet0.

If the desired route cannot be resolved except by means of the default gateway, the response is much shorter:

Router> show ip route
% Network not in table

This means that the router will use the default route when trying to reach this device. If there is no default route, it will drop the packets. Note that this assumes that we are using classless routing. If we had enabled classful routing on the router, then, if it has a route for any subnet of the classful network, it will also have an entry for the entire network. In this case the classful network would be

Router Configuration and File Management

Router Management

User Access and Privilege Levels


IP Routing





Frame Relay

Handling Queuing and Congestion

Tunnels and VPNs

Dial Backup

NTP and Time


Router Interfaces and Media

Simple Network Management Protocol





First Hop Redundancy Protocols

IP Multicast

IP Mobility




Appendix 1. External Software Packages

Appendix 2. IP Precedence, TOS, and DSCP Classifications


show all menu

Cisco IOS Cookbook
Cisco IOS Cookbook (Cookbooks (OReilly))
ISBN: 0596527225
EAN: 2147483647
Year: 2004
Pages: 505
Similar book on Amazon

Flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net