I am trying to setup iptables + tunnel via ssh and just can't succeed with this.

I am trying to setup a tunnel:

ssh -N -f -L 8500:localhost:8500 root@<ip-of-the-server>

And the connection is dropped due to last row:

sudo iptables -A INPUT -j DROP

Question: what should I include in iptables to allow such a tunneling from specific IP ie my computer?

iptables -A INPUT --src --protocol tcp --dport 8500 -J ACCEPT

for the tunneld port. This allows connections from to port 8500/tcp

iptables -A INPUT --src $IP_Here --protocol tcp --dport 22 -J ACCEPT

For the ssh-connection (This would allow connections on port 22, which is ssh from $IP_Here, which you have to set/replace with a actual IP Address)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.