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

    Requires Free Membership to View

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 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, 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/gated.pid'
	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 first published in April 2001

There are Comments. Add yours.

TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.