Skip to content

Instantly share code, notes, and snippets.

@chelsea
chelsea / gist:2658248
Created May 11, 2012 07:59 — forked from gabehollombe/gist:2468822
SSH tunnel between two NATed machines via a third SSH host
Useful for when you need to have two hosts talk to each other on a specific port but they're both NATed (behind routers).
For example, you want to be able to SSH into your friend's machine to pair program with them.
remote$ ssh -R 55555:localhost:22 myaccount@my_ssh_server.com
local$ ssh -L 55555:localhost:55555 myaccount@my_ssh_server.com
local$ ssh -p 55555 localhost -l remote_user