iptables -N ssh-limit iptables -F ssh-limit iptables -A ssh-limit -p tcp ! --syn -j RETURN iptables -A ssh-limit -s [INSIDE NETWORK] -j RETURN [etc. for other IP blocks] iptables -A ssh-limit -m hashlimit --hashlimit-upto 6/minute --hashlimit-mode srcip,dstip --hashlimit-srcmask 24 --hashlimit-dstmask 24 --hashlimit-name ssh --hashlimit-burst 2 -j RETURN iptables -A ssh-limit -j DROP iptables -I FORWARD -p tcp --syn --dport 22 -o eth0 -j ssh-limit [etc. for other port/IF combinations]