当IP地址并发超过20 ,则拒绝
iptables -I INPUT -P tcp --dport 80 -m connlimit --connlimit-above 20 -j REJECT
ipset的使用
当肉机 cc攻击你的服务器时,筛选出来,通过iptables限制这些肉机
安装ipset
apt-get instal ipset
创建ip集
ipset create setname hash:net
查看ip集
ipset list
在ipset里添加IP
ipset add setname IP
保存ip集
ipset save setname -f xxx.txt
限制ipset里面的ip登陆
iptables -I INPUT -m set --match-set abc src -p tcp --destination-port 22 -j DROP