Testing Routing

When a routing problem is indicated, the first thing to do is examine the routing table to make sure that the necessary routes for the local interface and the default route are defined. Use the route command with the -n option to display the table, as shown in Listing 13.11.

Listing 13.11: Displaying the Routing Table

$ route -n

Kernel IP routing table

Destination Gateway

Genmask

Flags

Metric

Ref

Use

Iface

172.16.12.3 0.0.0.0

255.255,

.255,

255 UH

0

0

0

eth0

172.16.12.0 0.0.0.0

255.255,

.255,

. 0 U

0

0

0

eth0

127.0.0.0 0.0.0.0

255.0.0,

0

U

0

0

0

lo

0.0.0.0 172.16.12.2

0.0.0.0

UG

0

0

0

eth0

The various fields in the routing table listing are described in Chapter 7, "Network Gateway Services." For this check, however, the details aren't important. You just want to make sure that the route to the remote host exists in your routing table—either a specific route to the network that the host is attached to or a default route. (The default route has a destination of 0.0.0.0.) If you built the routing table from static routing entries, this will probably be a default route. If the table was built dynamically by a routing protocol, it might be very large and contain a specific route for the remote network. Regardless of how it got there, you need to make sure that your system has the necessary route.

Note In the case of a large routing table, use grep with the route command to search for a default route or a specific route.

Was this article helpful?

0 0

Post a comment