iptables blocking ssh tunnel

Solution 1:

You need to allow packets to arrive via loopback:

-A INPUT -i lo -j ACCEPT

You can tighten up the rule somewhat by ensuring that packets arriving via loopback also have the loopback address:

-A INPUT -d 127.0.0.1/32 -i lo -j ACCEPT