Just use the following command:

iptables -A INPUT -p tcp --syn --dport 22 -m connlimit --connlimit-above 5 -j REJECT

In this example our connections are limited to 5.