Reverse SSH, using SSH tunnel to bypass NAT

If you want to connect using SSH in a machine that is behind a NAT and have no wait to configure a port forward, here goes the way to do it.

#Execute this in machine behind NAT

ssh -o StrictHostKeyChecking=no -C -N -f -R 2222:127.0.0.1:22 user@remote_host_with_public_ip

#Execute this in server with public IP

ssh -p 2222 localhost -l root

  1. Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: