Is it possible to set this kind of rule?

I want to avoid unwanted crawlers or spam bots to access multiple requests in a low period of time per ip.

To avoid overloading of webserver.

Thanks.

link|improve this question

75% accept rate
feedback

1 Answer

up vote 0 down vote accepted

Try this:

iptables -A INPUT -p tcp --dport 80 -i eth0 -m state --state NEW -m recent --set 
iptables -A INPUT -p tcp --dport 80 -i eth0 -m state --state NEW -m recent --update --seconds 60 --hitcount 5 -j DROP

it will drop incoming connections if IP make more than 5 connection attempts to port 80 within one minute.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.