Introduction to Data Communications
61. Handy Unix Network Troubleshooting Commands

1. Handy Unix Network Troubleshooting Commands

The following network troubleshooting commands will vary slightly in syntax depending on which operating system is used. Some operating systems will provide more options and some less. Please use the following information as a guide and the syntax presented with "a grain of salt".


arp

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

	arp - a



	address resolution protocol

	host name (IP address) at (ethernet address)


ping

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

  • TCP/IP stack is configured properly

  • Network interface card is configured properly

  • Default gateway and subnet mask is configured properly

  • Domain name services is configured properly.

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

  1. ping 127.0.0.1

    Checks 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 display routing table information.

  1. Local interface status

    netstat -ain
    
    
    
    	a - all interfaces are displayed
    
    	i - displays configuration
    
    	n - IP addresses (!n - host names)
    
    
    
    example output:
    
    
    
    Name	MTU	Net/dest	address		Ierrs	Opkts	Collis	Queue
    
    le0	1500	(net IP addr)	(local IP)	.	..	...	....
    
    

  2. Routing table information

    netstat -r  (-nr or rn gives ip addresses)
    
    
    
    Routing Table
    
    Destination	Gateway	Flags	Interface
    
    (net or host)	(IP address)	UHGD	(name)
    
    
    
    U - up		H - host	G - gateway		D- 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, etc..

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 tabling.

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:



1	116 ms	134 ms	112 ms	ts10.dshark.com	[192.168.128.20]

2	124 ms	112 ms	114 ms	bl1.poufe.com	[192.168.130.1]

3	122 ms	118 ms	117 ms	fifo.amalag.com	[192.168.64.2]

4	130 ms	156 ms	132 ms	dfg.apllejcok.com [192.168.1.1]
 
Introduction to Data Communications
 Previous Table of Contents Next