当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
本文介绍了如何使用iptables和ipset来限制特定IP地址的访问请求。通过设置并发连接数上限,可以有效防止CC攻击。此外,还介绍了如何创建、管理和使用ipset,包括添加IP到集合中以及通过iptables限制这些IP的访问。

被折叠的 条评论
为什么被折叠?



