2

netsat

netstat -ant

得到

root@f6c0aba5201d:/# netstat -ant
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp6       0      0 :::8080                 :::*                    LISTEN
tcp6      52      0 172.17.0.2:8080         192.168.99.1:56750      ESTABLISHED
tcp6       0      0 172.17.0.2:8080         192.168.99.1:56503      TIME_WAIT
tcp6      52      0 172.17.0.2:8080         192.168.99.1:56788      ESTABLISHED
tcp6       0      0 172.17.0.2:8080         192.168.99.1:56686      TIME_WAIT
tcp6       0      0 172.17.0.2:8080         192.168.99.1:56658      TIME_WAIT
tcp6       0      0 172.17.0.2:8080         192.168.99.1:56723      TIME_WAIT
tcp6      52      0 172.17.0.2:8080         192.168.99.1:56695      ESTABLISHED
tcp6       0      0 172.17.0.2:8080         192.168.99.1:56688      TIME_WAIT
tcp6       0      0 172.17.0.2:8080         192.168.99.1:56701      TIME_WAIT

整体统计

netstat -an | awk '/^tcp/ {++S[$NF]} END {for (a in S) print a, S[a]}'

得到

root@f6c0aba5201d:/# netstat -an | awk '/^tcp/ {++S[$NF]} END {for (a in S) print a, S[a]}'
LISTEN 1
TIME_WAIT 22
ESTABLISHED 96

TCP的状态机

clipboard.png

建立连接时对应的状态

clipboard.png

doc


codecraft
11.9k 声望2k 粉丝

当一个代码的工匠回首往事时,不因虚度年华而悔恨,也不因碌碌无为而羞愧,这样,当他老的时候,可以很自豪告诉世人,我曾经将代码注入生命去打造互联网的浪潮之巅,那是个很疯狂的时代,我在一波波的浪潮上留下...


引用和评论

0 条评论