Friday, April 3, 2009

"netstat" - state information on network connections


"netstat" - state information on network connections

The following is sample output using one of the netstat option:
netstat -na|more

Active Connections

Proto Local Address Foreign Address State
TCP 108.168.7.21:139 0.0.0.0:0 LISTENING
TCP 10.17.7.21:1960 20.46.19.9:1863 ESTABLISHED
TCP 10.17.7.21:2971 20.18.11.20:8080 ESTABLISHED
TCP 127.0.0.1:1036 0.0.0.0:0 LISTENING
TCP 127.0.0.1:1110 127.0.0.1:1111 ESTABLISHED
TCP 127.0.0.1:1111 127.0.0.1:1110 ESTABLISHED
TCP 127.0.0.1:1113 127.0.0.1:1114 ESTABLISHED
TCP 127.0.0.1:1114 127.0.0.1:1113 ESTABLISHED
TCP 127.0.0.1:2970 127.0.0.1:30606 ESTABLISHED
TCP 127.0.0.1:5152 0.0.0.0:0 LISTENING
TCP 127.0.0.1:5152 127.0.0.1:1117 CLOSE_WAIT
TCP 127.0.0.1:5354 0.0.0.0:0 LISTENING
TCP 127.0.0.1:30606 0.0.0.0:0 LISTENING
TCP 127.0.0.1:30606 127.0.0.1:2932 TIME_WAIT
TCP 127.0.0.1:30606 127.0.0.1:2936 TIME_WAIT
TCP 127.0.0.1:30606 127.0.0.1:2966 TIME_WAIT
TCP 127.0.0.1:30606 127.0.0.1:2970 ESTABLISHED
TCP 127.0.0.1:62514 0.0.0.0:0 LISTENING



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.

No comments: