Limiting the number of connections to SSH Server using Iptables

This is the quickest way to limit the number of connection to your SSH server with iptables.

[bash]
sudo /sbin/iptables -A INPUT -p tcp –syn –dport 22 -m connlimit –connlimit-above 5 -j REJECT
[/bash]

This will only allow up to 5 concurrent connections to the SSH server, subsequent connections will be rejected by iptables, thus this can thwarts Brute-force attempts to your server.

More Articles About Securing SSH Server

3 thoughts on “Limiting the number of connections to SSH Server using Iptables

  1. While running the above command am getting the following error

    /sbin/iptables -A INPUT -p tcp –syn –dport 22 -m connlimit –connlimit-above 8 -j REJECT
    iptables: Unknown error 18446744073709551615

    Am using Amazon AWS EC2 virtual machine, please let me know how i can fix this issue

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>