netstat command

The netstat command works in conjunction with the ifconfig command to provide a status condition of the TCP/IP network interface.

The command netstat -in for example uses the -i flag to present information on the network interfaces while the -n flag prints the IP addresses instead of the host names. Use this command to verify SLIP interfaces, addresses, and host names. The following section describes netstat -in output.

Program the modem using the settings shown in the section, SLIP modem considerations. The following example demonstrates how to program and save basic settings for a Hayes-compatible modem. Enter:

Name  Mtu   Network    Address             Ipkts     Ierrs Opkts Oerrs  Col
lo0   1536  <Link>                         2462       0    2462   0     0
lo0   1536  127        localhost.austi     2462       0    2462   0     0
tr0   1492  <Link>                         1914560    0   21000   0     0
tr0   1492  129.35.16  glad.austin.ibm     1914560    0   21000   0     0
sl0   552   1.1.1.0    1.1.1.1             48035      0   54963   0     0
sl1*  552   140.252.1  140.252.1.5         48035      0   54963   0     0

Notice the * next to the sl1 interface. This shows that the network interface is down or unavailable for use. The user can correct this by issuing the ifconfig sl1 up command if it is a valid SLIP interface.

netstat provides statistics concerning input and output packet counts as well as input and output errors that are helpful when troubleshooting SLIP connections.

For example, a user enters a ping to a remote host across a SLIP link and the ping command appears to hang. The user quickly run a netstat -in command from another command shell and notice that the Opkts are increasing but that there are no Ipkts from the remote host. This indicates that the remote system is not returning (or not receiving) the information. The user must run the same netstat command on the remote system to verify the receipt of the ping packets or rise in the error count.

The translation of hostnames versus Internet numbers is relative to name resolution and thus critical to proper operation of a SLIP line. To debug host name, aliases, and routing problems, use the netstat -rn command. The base name of the host or host name is the only name that should return from the /etc/hosts file. If the machine is being serviced by a name server (that is, /etc/resolv.conf exists), then the name-server will return the fully qualified-domain name in this command.