查看Linux服务器的客户端连接情况

安装net-tools

apt install net-tools

执行命令

netstat -nt | tail -n +3 | awk -F "[ :]+" -v OFS="" '{printf("%45s => %s:%-5s\n",$6,$4,$5)}' | sort | uniq -c | sort -rn

参数解释:

输出

      3                                 61.177.173.22 => 66.42.76.76:22   
      3                                36.154.116.131 => 66.42.76.76:22   
      3                                     127.0.0.1 => 127.0.0.1:9507 
      2                                     127.0.0.1 => 127.0.0.1:6378 
      1                                     127.0.0.1 => 127.0.0.1:53870
      1                                     127.0.0.1 => 127.0.0.1:51814
      1                                     127.0.0.1 => 127.0.0.1:47646
      1                                     127.0.0.1 => 127.0.0.1:40952
      1                                     127.0.0.1 => 127.0.0.1:33292

从输入结果我们可以看到有哪些IP连接了我们的服务器,并且可以看到连接的数量和连接的端口

猜你喜欢

转载自blog.csdn.net/y1534414425/article/details/128468426
今日推荐