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 172.25.1.1 to network 0.0.0.0 192.168.17.0/27 is subnetted, 1 subnets C 192.168.17.0 is directly connected, Loopback1 172.16.0.0/30 is subnetted, 1 subnets C 172.16.1.0 is directly connected, Async1 172.25.0.0/16 is variably subnetted, 6 subnets, 3 masks C 172.25.25.0/30 is directly connected, Tunnel0 C 172.25.1.0/24 is directly connected, Ethernet0 C 172.25.9.0/24 is directly connected, Ethernet1 C 172.25.10.1/32 is directly connected, Loopback0 O 172.25.100.1/32 [110/11] via 172.25.9.2, 4d09h, Ethernet1 O IA 172.25.100.0/24 [110/11] via 172.25.1.1, 2d11h, Ethernet0 192.168.1.0/32 is subnetted, 1 subnets S 192.168.1.1 [1/0] via 172.25.1.4 O*E1 0.0.0.0/0 [110/11] via 172.25.1.1, 1d07h, Ethernet0
You can also find the route to a particular device, such as 172.25.100.15:
Router>show ip route 172.25.100.15
Routing entry for 172.25.100.0/24
Known via "ospf 55", distance 110, metric 11, type inter area
Redistributing via ospf 55
Last update from 172.25.1.1 on Ethernet0, 2d12h ago
Routing Descriptor Blocks:
* 172.25.1.1, from 172.25.1.1, 2d12h ago, via Ethernet0
Route metric is 11, traffic share count is 1
The output of the 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 that it is possible to have more than one such code, as in the route for 172.25.100.0/24. 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 inter-area route. Similarly, the entry for 0.0.0.0/0 is an OSPF external route of type 1. The asterisk (*) 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.
The router didn't have a 32-bit match for this particular destination (172.25.100.15), so it shows its best match, 172.25.100.0/24. 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, in this case via OSPF Process ID number 55. It also indicates that the next hop required to reach that destination is the device 172.25.1.1, 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 172.16.101.5
% 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 we are using classless routing. If we had enabled classful routing on the router, a route for any subnet of the classful network would also have an entry for the entire network. In this case, the classful network would be 172.16.0.0/16.
Top |