Using netstat to read state information on network connections

Technote (FAQ)
Problem
Analyzing the state of network connections can contribute to resolving problems with application connectivity. Using netstat -an provides a list of connections and their state.
Cause
Network issues
Solution
The following is sample output using one of the netstat option:

# netstat -an
Active Internet connections (including servers)
Proto Recv-Q Send-Q Local Address Foreign Address (state)
tcp4 0 0 *.13 *.* LISTEN
tcp 0 0 *.21 *.* LISTEN
tcp 0 0 *.23 *.* LISTEN
tcp4 0 0 *.25 *.* LISTEN
tcp4 0 0 127.0.0.1.49213 *.* LISTEN
tcp4 0 0 *.6000 *.* LISTEN
tcp4 0 0 *.6112 *.* LISTEN
tcp4 0 0 9.27.40.28.32774 9.27.40.28.716 ESTABLISHED
tcp4 0 0 9.27.40.28.716 9.27.40.28.32774 ESTABLISHED
...

The states are defined as follows:
  • CLOSED
    Connection is closed.

  • LISTEN
    Listening for a connection.

  • SYN_SENT
    Active; sent SYN. Waiting for a matching connection request after having sent a connection request.

  • SYN_RCVD
    Sent and received SYN. Waiting for a confirming connection request acknowledgment after having both received and sent connection requests.

  • ESTABLISHED
    Connection established.

  • CLOSE_WAIT
    Received FIN; waiting to receive CLOSE.

  • LAST_ACK
    Received FIN and CLOSE; waiting for FIN ACK.

  • FIN_WAIT_1
    Closed; sent FIN.

  • CLOSING
    Closed; exchanged FIN; waiting for FIN.

  • FIN_WAIT_2
    Closed; FIN is acknowledged; awaiting FIN.

  • TIME_WAIT
    In 2 MSL (twice the maximum segment length) quiet wait after close.











Document Information

Product categories: Software, Application Servers, Distributed Application & Web Servers, WebSphere Application Server, HTTP Transport
Operating system(s): AIX, HPUX, Linux, Multi-Platform, Solaris, Windows, Windows 2000, Windows NT, Windows Server 2003, Windows XP
Software version: 3.5, 4.0, 5.0, 5.1, 6.0
Software edition: Edition Independent
Reference #: 1164078
IBM Group: Software Group
Modified date: 2004-03-24