Don't know what to do if you get a "network unreachable" error? This tip, excerpted from TCP/IP Network Administration, Help for UNIX System Administrators, by Craig Hunt, published by O'Reilly and Associates, offers guidance.
The "network unreachable" error message clearly indicates a routing problem. If the problem is in the local host's routing table, it is easy to detect and resolve. First, use netstat ?nr and grep to see whether or not a valid route to your destination is installed in the routing table. This example checks for a specific route to network 184.108.40.206:
%netstat -nr | grep '128.8.0 220.127.116.11 18.104.22.168 UG 0 37 std0
This same test, run on a system that did not have this route in its routing table, would return no response at all. For example, a user reports that the "network is down" because he cannot ftp to sunsite.unc.edu, and a ping test returns the following results:
%ping -s sunsite.unc.edu 56 2 PING sunsite.unc.edu: 56 data bytes Sendto: network is unreachable Ping: wrote sunsite.unc.edu 64 chars, ret=-1 Sendto: Network is unreachable Ping: write sunsite.unc.edu 64 chars, ret=-1 ----sunsite.unc.edu PING statistics 2 packets transmitted, 0 packets received, 100% packet loss
Based on the "network unreachable" error message, check the user's routing table. In our example, we're looking for a route to sunsite.unc.edu. The IP address of sunsite.unc.edu is 22.214.171.124, which is a class B address. Remember that routes are network-oriented. So we check for a route to network 126.96.36.199:
%netstat ?nr |grep '188.8.131.52 %
This test shows that there is no specific route to 184.108.40.206. If a route were found, grep would display it. Since there's no specific route to the destination, remember to look for a default route. This example shows a successful check for a default route:
%netstat ?nr |grep def default 172.16.12.1 UG 0 101277 1e0
If netstat shows the correct specific route, or a valid default route, the problem is not in the routing table. In that case, use traceroute to trace the route all the way to its destination.
If netstat doesn't return the expected route, it's a local routing problem. There are two ways to approach local routing problems, depending on whether the system uses static or dynamic routing. If you're using static routing, install the missing route using the route add command. Remember, most systems that use static routing rely on a default route, so the missing route could be the default route. Make sure that the startup files add the needed route to the table whenever the system reboots.
If you're using dynamic routing, make sure that the routing program is running. For example, the command below makes sure that gated is running:
%ps 'cat /etc/gated.pid' PID TT STAT TIME COMMAND 27711 ? S 304:59 gated ?tep /etc/log/gated.log
If the correct routing daemon is not running, restart it and specify tracing. Tracing allows you to check for problems that might be causing the daemon to terminate abnormally.
For more information about TCP/IP Network Administration, Help for UNIX System Administrators, or to buy this book, click here.
Did you like this tip? If so, (or if not) why not let us know? Email to sound off, or visit our tips page to rate this, and other tips, or to submit one of your own.