歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux技術 >> 為iptables增加connlimit模塊 限制DOS攻擊

為iptables增加connlimit模塊 限制DOS攻擊

日期:2017/3/1 18:08:18   编辑:Linux技術
注:2.6.23以前的內核版本默認不支持 connlimit

推薦規則

iptables -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
Copyright © Linux教程網 All Rights Reserved