帮助与文档

帮助与文档 >  云服务器 > linux 限制连接数 ,cc攻击

linux 限制连接数 ,cc攻击

image.png


统计所有连接数 ,超过500大约就是攻击了:

 netstat -an  | wc -l


统计80端口的连接数


netstat -an | grep -i “:80” |wc -l



统计ip 连接数 

netstat -tun | awk '{print $5}' | cut -d: -f1 |sort | uniq -c | sort -n



https://wenku.baidu.com/view/2a32103e17791711cc7931b765ce050876327519.html

firewall-cmd –permanent –add-rich-rule=”rule family="ipv4″ source address="192.168.1.2″ port protocol="tcp” port=“22″ accept



centos7 版本

禁止ip

sshd:8.8.8.8:deny


解除禁止ip

sshd:8.8.8.8:allow


对应的文件

/etc/hosts.deny


centos 6 版本

封ip 

iptables -I INPUT -s 211.1.0.0 -j DROP


封c段

iptables -I INPUT -s 220.175.144.0/24 -j DROP

封b段

iptables -I INPUT -s 220.175.0.0/16 -j DROP


解封ip

iptables  -D INPUT -s 211.1.0.0 -j DROP