Keep an Eye on Your Linux Systems with Netstat
What It Means

Carla Schroder
Thursday, November 4, 2004 08:33:38 AM
"Proto" is short for
protocol, which is either TCP or UDP.
"Recv-Q" and "Send-Q" mean receiving queue and sending queue. These
should always be zero; if they're not you might have a problem. Packets
should not be piling up in either queue, except briefly, as this
example shows:
tcp 0 593 192.168.1.5:34321 venus.euao.com:smtp ESTABLISHED
That happened when I
hit the "check mail" button in KMail; a brief queuing of outgoing
packets is normal behavior. If the receiving queue is consistently
jamming up, you might be experiencing a denial-of-service attack. If
the sending queue does not clear quickly, you might have an application
that is sending them out too fast, or the receiver cannot accept them
quickly enough.
"Local address" is
either your IP and port number, or IP and the name of a service.
"Foreign address" is the hostname and service you are connected to. The
asterisk is a placeholder for IP addresses, which of course cannot be
known until a remote host connects.
"State" is the current status of the connection. Any TCP state can be
displayed here, but these three are the ones you want to see:
LISTEN- waiting to receive a connection
ESTABLISHED- a connection is active
TIME_WAIT- a recently terminated connection;
this should last only a minute or two, then change back to LISTEN. The
socket pair cannot be re-used as long the TIME_WAIT state persists.
UDP is stateless, so the "State" column is always blank.
A socket pair is both sides of a TCP/IP connection, like this example for a locally-attached printer:
localhost:ipp localhost:34493 ESTABLISHED
Or a telnet connection to a remote server:
192.168.1.5:34437 65.106.57.106.pt:telnet ESTABLISHED
A socket is any hostname-port combination, or IP address-port.
Next: Continuous Capture, "Borken" DNS, and Interface Checking »