Problem solve Get help with specific problems with your technologies, process and projects.

Checking routing

Checking routing
Craig Hunt

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

	%netstat  -nr | grep '128.8.0	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, and a ping test returns the following results:

	%ping  -s 56 2
	PING 56 data bytes
	Sendto: network is unreachable
	Ping: wrote 64 chars, ret=-1
	Sendto: Network is unreachable
        Ping: write 64 chars, ret=-1 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 The IP address of is, which is a class B address. Remember that routes are network-oriented. So we check for a route to network

	%netstat ?nr |grep '

This test shows that there is no specific route to 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	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/'
	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.

This was last published in April 2001

Dig Deeper on Network Infrastructure

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.