Linux服务器维护 统计连接数查看外部IP
时间:2010-08-11 来源:wangfng5
1)统计80端口连接数
netstat -nat|grep -i "80"|wc -l
87
2)统计httpd协议连接数
ps -ef|grep httpd|wc -l
28
3)、统计已连接上的,状态为“established'
netstat -na|grep ESTABLISHED|wc -l
41
4)、列出IP
netstat -na|grep ESTABLISHED|awk '{print $5}'|awk -F: '{print $1}'
5)、过滤重复IP
netstat -na|grep ESTABLISHED|awk '{print $5}'|awk -F: '{print $1}'|sort|uniq -c|sort -r
6)、查出哪个IP地址连接最多,将其封了.
netstat -na|grep ESTABLISHED|awk '{print $5}'|awk -F: '{print $1}'|sort|uniq -c|sort -r +0n
netstat -na|grep SYN|awk '{print $5}'|awk -F: '{print $1}'|sort|uniq -c|sort -r +0n 相关阅读 更多 +