Troubleshooting with the ifconfig command
Sometimes you just can't connect, and nothing you do seems to work. How can you find out what's wrong? We all know some troubleshooting tools, but we don't know everything they do. This tip, excerpted from TCP/IP Network Administration, Help for UNIX System Administrators
, helps out.
ifconfig checks the network interface configuration. Use this command to verify the user's configuration if the user's system has been recently configured, or if the user's system cannot reach the remote host while other systems on the same network can.
When ifconfig is entered with an interface name and no other arguments, it displays the current values assigned to that interface. For example, checking interface 1e0 on a Solaris system gives this report:
%ifconfig 1e0 1e0:m flags=863
mtu 1550 Inet 172.16.55.105 netmask ffffff00 broadcasst 172.16.55.255
The ifconfig command displays two lines of output. The first line of the display shows the interface's name and its characteristics. Check for these characteristics:
- The interface is enabled for use. If the interface is "down," have the system's supervisor bring the interface "up" with the ifconfig command (e.g. ifconfig 1e0 up). If the interface won't come up, replace the interface cable and try again. If it still fails, have the interface hardware checked.
- This interface is operational. If the interface is not "running," the driver for this interface may not be properly installed. The system administrator should review all of the steps necessary to install this interface, looking for errors or missed steps.
The second line of ifconfig output shows the IP address, the subnet mask (written in hexadecimal), and the broadcast address. Check these three fields to make sure the network interface is properly configured.
Two common interface configuration problems are misconfigured subnet masks and incorrect IP addresses. A bad subnet mask is indicated when the host can reach other hosts on its local subnet and remote hosts on distant network, but cannot reach hosts on other local subnets. ifconfig quickly reveals if a bad subnet mask is set.
An incorrectly set IP address can be a subtle problem. If the network part of the address is incorrect, every ping will fail with the "no answer" error. In this case, using ifconfig will reveal the incorrect address. However, if the host part of the address is wrong, the problem can be more difficult to detect. A small system, such as a PC that only connects out to other systems and never accepts incoming connections, can run for a long time with the wrong address without its user noticing the problem. Additionally, the system that suffers the ill effects may not be the one that is misconfigured. It is possible for someone to accidentally use your IP address on his own system, and for his mistake to cause your system intermittent communications problems. This type of configuration error cannot be discovered by ifconfig, because the error is on a remote host. The arp command is used for this type of problem.
To learn more about TCP/IP Network Administration, Help for UNIX System Administrators, or to buy this book, click here.
Did you like this tip? If you did (or if you didn't) then send us an email and let us know.
This was first published in March 2001