Viewing a Router’s Routing Table
Debugging problems with your router may require that you review the contents of the routing table. To view the routing table on your router, you connect to the command-line interface and type the following commands:
Router2>enable Password: Router2#show ip route Codes: 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 Gateway of last resort is 192.168.5.10 to network 0.0.0.0 C 192.168.5.0/24 is directly connected, FastEthernet0/1 C 192.168.1.0/24 is directly connected, FastEthernet0/0 192.168.100.0/24 is variably subnetted, 2 subnets, 2 masks S 192.168.100.0/24 [1/0] via 192.168.5.2 S 192.168.100.75/32 [1/0] via 192.168.5.5 S* 0.0.0.0/0 [1/0] via 192.168.5.10
Note that the routing table output includes a list of all known routes and the routing protocol that those routes were learned from. In this case, two networks are directly connected (C) to the routers’ interfaces: 192.168.5.0/24 and 192.168.1.0/24. Directly connected interfaces are always added to the routing table. Because the router is directly connected to those networks, the router knows that data can be sent to them.
In addition to these directly connected networks are three static (“S”) or manually typed routes, one for a network (192.168.100.0/24), one for an IP host (192.168.100.75/32), and one for everything else (0.0.0.0/0). The last route is the default gateway or gateway of last resort, which means that if a better route is not found, this route is chosen.
After you connect your router in a single router network, if you need to route only to directly connected networks, you do not have to worry about setting up static routes or enabling a routing protocol.
In the preceding routing table, you have routes to all systems on the 192.168.1.0/24 and 192.168.5.0/24 networks. For data going to either of these networks, you use the appropriate router interface, FastEthernet0/0 or FastEthernet0/1. If you have data for a system on the 192.168.100.0/24 network, you send that data on to the next router, which is found at 192.168.5.2.
Bear in mind that this next router must be on a network to which you are directly connected. There is one routing table entry for the 192.168.100.0/24 network, but there is also the exception for the address of 192.168.100.75/32. The host 192.168.100.75 has a special route and the router passes the data to the router 192.168.5.5, rather than to the normal router for that network (192.168.5.2).
You might use a special route such as this one if, for example, you want to use different security settings that make it easier (or harder) to communicate with system 192.168.100.75; or, perhaps the physical links going from that router may be faster (or slower), and based on the role of 192.168.100.75, using links with specific speed settings makes more sense.
The point is that you tailor your routing table to pass data for sections of the same network over different paths, and the router always chooses the route based on the route that most closely matches the destination address.