limit number of connections for a single ip on port 80 to CentOS 5.5
How to number of connections for a single ip on port 80 to CentOS 5.5 with iptables?
connlimit did not work on CentOS and nginx does not provide a module for that |
iptables -I INPUT -p tcp -s 0/0 –sport 513:65535 –dport 80 -m state –state NEW,ESTABLISHED -m recent –set -j ACCEPT
iptables -I INPUT -p tcp –dport 80 -m state –state NEW -m recent –update –seconds 2 –hitcount 25 -j DROP iptables -A OUTPUT -p tcp -s 0/0 -d 0/0 –sport 22 –dport 513:65535 -m state –state ESTABLISHED -j ACCEPT that rules should do what you want, works fine for me. |
Thanks nullbyte!
why do you add –sport 513:65535 ? |
from 3 lines your required line is
iptables -I INPUT -p tcp –dport 80 -m state –state NEW -m recent –update –seconds 2 –hitcount 25 -j DROP The third one is for ssh access. |
Quote:
|
All times are GMT -5. The time now is 02:03 PM. |