Thursday, July 7, 2011

Command to find active TCP connections

Use the netstat command as below to see active TCP connections... It will tell you state of different connections.. for e.g., if TCP SYN has been sent.. connection has been ESTABLISHED, WAIT_CLOSE which tells that it is waiting to close the connection once get an acknowledgement back from the remote machine that it received all data.

netstat -tan
 or
netstat -tag

Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp        0      0 0.0.0.0:10050           0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN
tcp        0      0 10.202.149.48:22        XXX.XXX.XXX.XXX:48185     ESTABLISHED
tcp6       0      0 :::10052                :::*                    LISTEN
tcp6       0      0 :::8009                 :::*                    LISTEN
tcp6       0      0 :::80                   :::*                    LISTEN
tcp6       0      0 :::54803                :::*                    LISTEN
tcp6       0      0 :::22                   :::*                    LISTEN
tcp6       0      0 :::443                  :::*                    LISTEN

No comments:

Post a Comment