iptables防御抵御CC攻击(抵御少量肉机)暨ipset的使用
当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
附
删除ipset :ipset destory setname
删除后可以重新加载ipset :ipset restore -f xxx.txt
route查看此主机的ip等信息
arp -v 查看所有主机的IP等信息
查看ipset信息 ipset -L
浙公网安备 33010602011771号