为iptables增加connlimit模块 限制DOS攻击

注:2.6.23以前的内核版本默认不支持 connlimit

推荐规则

-A INPUT -p tcp -m tcp -m connlimit --dport 80 --tcp-flags SYN,ACK,FIN,RST SYN -j DROP --connlimit-above 32 --connlimit-mask 32

如果/var/logs/message出现

ipt_connlimit: Oops: invalid ct state ?

在这条规则前面加一条

iptables -A INPUT -m conntrack -j DROP --ctstate INVALID

阻断非法数据包

查看效果

iptables -n -L -v |grep conn

17479 1033K DROP tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:80 flags:0x17/0x02 #conn/32 > 32



相关文章
推荐文章
热门文章

微信公众号推荐

相关推荐