Block ip for long time

Posted by Tiziano Dan on Server Fault See other posts from Server Fault or by Tiziano Dan
Published on 2013-07-02T15:46:18Z Indexed on 2013/07/02 17:07 UTC
Read the original article Hit count: 231

Filed under:

This question is about a iptables, I wanna to know how can I block these ip for 1hour and not only a little time.. because they make to many sql requests, I'm using it for block but it's not enough because there's anyway 100k ip who attack then too much requests for sql server.

iptables -N SYN-LIMIT
iptables -A SYN-LIMIT -m hashlimit --hashlimit 8/second --hashlimit-mode srcip --hashlimit-name SYN-LIMIT -j RETURN
iptables -A SYN-LIMIT -j DROP
iptables -I INPUT -p tcp --dport 80 --syn -j SYN-LIMIT
iptables -I INPUT -p tcp --dport 80 -m connlimit --connlimit-above 6 -j REJECT --reject-with tcp-reset

How can I make the same but block IP for long time ? (Not manually !)

© Server Fault or respective owner

Related posts about iptables