Chapter 56. Handy Unix Network Troubleshooting Commands

The following network troubleshooting commands will vary slightly in syntax depending on which operating system you are using. Some operating systems will provide more options, and some less. Please use the following information (and the syntax presented) as a guide--with "a grain of salt!"

arp

If you are having problems connecting to other network hosts, use this command to see the IP-to-MAC address translation table . It is a dynamic cache that updates every 120 seconds. ARP stands for Address Resolution Protocol (ARP).

arp - a address resolution protocolhost name (IP address) at (Ethernet address)

ping

The ping command is the most versatile network troubleshooting command in Unix. Use ping to verify that your TCP/IP network services are operating correctly. The ping command allows you to determine the following:

The following is a step by step guide to aid you in determining if your network stack is configured properly:

  1. ping 127.0.0.1Checks that your TCP/IP stack is working properly up to the network interface card (NIC). If this fails, check to see if you have TCP/IP services loaded.

  2. ping "IP address of default gateway"Checks that the network interface card is working on the local subnet by pinging the local side of the default gateway which is a router. If this fails, check that TCP/IP is bound to the NIC. Then check that the NIC's IRQ, and base address are set properly both on the card itself and in the operating system's interface configuration.

  3. ping "IP address across the gateway"Checks that the default gateway is correctly identified in the TCP/IP configuration and that the proper subnet mask is configured. The IP address selected must not be on the local subnet.

  4. ping "domain name"Checks that the domain name services (DNS) is correctly configured in the TCP/IP stack. A domain name is a name like www.yahoo.com. If it fails, check that the DNS server's IP address is entered in properly in the TCP/IP configuration.

netstat

The network status command "netstat" displays status information about the network interfaces on the host machine and it can also display routing table information.

  1. Local interface status

    netstat -aina - all interfaces are displayedi -
              displays configuration - IP addresses (!n - host names)example output:
              NameMTUNet/destaddressIerrsOpktsCollisQueuele01500(net IP addr)(local IP)....

  2. Routing table information

    netstat -r
              (-nr or rn gives ip addresses)Routing TableDestinationGatewayFlagsInterface
              (net or host)(IP address)UHGD(name)U - upH - hostG -
              gatewayD- discovered using ICMP Req

ifconfig

The ifconfig command is used to display the local interface configuration (winipcfg for Windows), and to modify the configuration. Local interfaces can be Ethernet network cards, modems, and so on.

ifconfig (interface name) (down/up/nothing)nothing gives status(interface name):
flags - 63 (up, broadcast, notra, Running)inet (ip address) netmask FFFFFF00 broadcast 128.6.7.255

route

The route command allows you to add static routes to the routing tables.

route (-n) (add/delete/nothing)
(dest IP address/subnet/DEFAULT) (local IP address) (hop)

traceroute (tracert in Windows)

Traceroute displays the routers that are passed through to reach the destination.

traceroute "IP address or domain name"
Tracing route to www.apllejcok.com [192.168.1.64]over a maximum of 30 hops:
1116 ms134 ms112 msts10.dshark.com[192.168.128.20]2124 ms112 ms114 msbl1.poufe.com
[192.168.130.1]3122 ms118 ms117 msfifo.amalag.com[192.168.64.2]
4130 ms156 ms132 msdfg.apllejcok.com [192.168.1.1]

If this section was helpful, why not donate to further development?

Donate $1.25.

Donate $2.50.

Donate $5.00.