iptables limit module

Using iptables limit module to limit the the number of connections to the ssh port to 3 per minute.

iptables -A INPUT -p tcp –dport 22 –syn -m limit –limit 1/m –limit-burst 3 -j ACCEPT
iptables -A INPUT -p tcp –dport 22 –syn -j DROP

The first line will accept new connections on port 22 provided that IP address hasn’t made more than 3 connection attempts in the last minute. If more than 3 connection attempts have been made within the last minute, then the second line will DROP the connection.

Trackback URI | Comments RSS

Leave a Reply

You must be logged in to post a comment.