netstat -n | awk ‘/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}’ TIME_WAIT 8947 FIN_WAIT1 15 FIN_WAIT2 1 ESTABLISHED 55 SYN_RECV 21 CLOSING 2 LAST_ACK 4 |
TCP鏈接狀態詳解 LISTEN: 偵聽來自遠方的TCP端口的鏈接請求SYN-SENT: 再發送鏈接請求後等待匹配的鏈接請求SYN-RECEIVED:再收到和發送一個鏈接請求後等待對方對鏈接請求的確認ESTABLISHED: 表明一個打開的鏈接FIN-WAIT-1: 等待遠程TCP鏈接中斷請求,或先前的鏈接中斷請求的確認FIN-WAIT-2: 從遠程TCP等待鏈接中斷請求CLOSE-WAIT: 等待從本地用戶發來的鏈接中斷請求CLOSING: 等待遠程TCP對鏈接中斷的確認LAST-ACK: 等待原來的發向遠程TCP的鏈接中斷請求的確認TIME-WAIT: 等待足夠的時間以確保遠程TCP接收到鏈接中斷請求的確認CLOSED: 沒有任何鏈接狀態 |