Home | Mirror | Search |
netstat 監控TCP狀態
#netstat -n | awk ‘/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}’
狀態: 描述 CLOSED: 無連接是活動的或正在進行 LISTEN: 伺服器在等待進入呼叫 SYN_RECV: 一個連接請求已經到達,等待確認 SYN_SENT: 應用已經開始,打開一個連接 ESTABLISHED:正常數據傳輸狀態 FIN_WAIT1: 應用說它已經完成 FIN_WAIT2: 另一邊已同意釋放 ITMED_WAIT:等待所有分組死掉 CLOSING: 兩邊同時嘗試關閉 TIME_WAIT: 另一邊已初始化一個釋放 LAST_ACK: 等待所有分組死掉
# ss State Recv-Q Send-Q Local Address:Port Peer Address:Port CLOSE-WAIT 1 0 192.168.3.124:19644 130.75.116.209:http CLOSE-WAIT 1 0 192.168.3.124:31289 170.224.194.69:https CLOSE-WAIT 1 0 192.168.3.124:64903 198.20.8.241:https CLOSE-WAIT 1 0 192.168.3.124:64902 198.20.8.241:https CLOSE-WAIT 1 0 192.168.3.124:27528 170.224.160.205:https CLOSE-WAIT 1 0 192.168.3.124:10152 198.20.8.241:https CLOSE-WAIT 1 0 192.168.3.124:18263 170.224.194.69:http CLOSE-WAIT 1 0 192.168.3.124:18262 170.224.194.69:http CLOSE-WAIT 1 0 192.168.3.124:27792 129.89.61.70:http CLOSE-WAIT 1 0 192.168.3.124:27595 129.89.61.70:http CLOSE-WAIT 1 0 192.168.3.124:28970 129.89.61.70:http CLOSE-WAIT 1 0 192.168.3.124:28158 130.75.116.210:http CLOSE-WAIT 1 0 192.168.3.124:26186 130.75.116.210:http CLOSE-WAIT 1 0 192.168.3.124:26185 130.75.116.210:http CLOSE-WAIT 1 0 192.168.3.124:42563 74.125.71.99:http CLOSE-WAIT 1 0 192.168.3.124:42564 74.125.71.99:http CLOSE-WAIT 1 0 192.168.3.124:63459 130.75.116.202:http CLOSE-WAIT 1 0 192.168.3.124:63458 130.75.116.202:http ESTAB 0 0 192.168.3.124:30829 192.168.3.17:3260 ESTAB 0 0 192.168.3.124:13234 192.168.3.15:3260 ESTAB 0 0 ::ffff:192.168.3.124:ssh ::ffff:192.168.80.5:5 2682 ESTAB 0 1960 ::ffff:192.168.3.124:ssh ::ffff:192.168.80.5:5 2957 $ ss State Recv-Q Send-Q Local Address:Port Peer Address:Port ESTAB 0 0 192.168.80.1:38281 64.4.61.72:1863 ESTAB 0 0 192.168.80.1:54504 112.95.240.77:8000 ESTAB 0 0 192.168.80.1:14698 74.125.71.125:5222 ESTAB 0 0 192.168.80.1:14697 74.125.71.125:5222 ESTAB 0 0 192.168.80.1:54123 64.12.28.171:https ESTAB 0 0 192.168.80.1:4225 64.4.61.171:1863 ESTAB 0 0 192.168.80.1:ssh 192.168.80.5:51291 ESTAB 0 0 ::ffff:192.168.80.1:microsoft-ds ::ffff:192.168.80.5:51094 ESTAB 0 0 192.168.80.1:22074 205.188.1.241:https ESTAB 0 0 192.168.80.1:59340 64.4.34.213:1863 ESTAB 0 0 192.168.80.1:9766 91.189.89.114:https ESTAB 0 0 192.168.80.1:3300 64.4.44.78:1863
CentOS
# yum install nload -y
Ubuntu
# sudo apt-get install nload
運行監控命令
# nload
Device eth0 [172.16.3.90] (1/5): ============================================================================= Incoming: Curr: 10.00 kBit/s Avg: 103.95 kBit/s Min: 0.00 Bit/s || Max: 3.23 MBit/s ## Ttl: 1090.93 GByte Outgoing: Curr: 12.84 kBit/s Avg: 15.29 kBit/s Min: 0.00 Bit/s Max: 206.63 kBit/s Ttl: 48.57 GByte