Skip to content

Instantly share code, notes, and snippets.

@cloudchen
Created August 19, 2013 03:15
Show Gist options
  • Save cloudchen/6265497 to your computer and use it in GitHub Desktop.
Save cloudchen/6265497 to your computer and use it in GitHub Desktop.
autossh wrapping remote ssh port forwarding
#Explanation of key parameters
#autossh -M<LocalListenPort> -f -q -N -R <RemoteIP>:<RemotePort>:<LocalIP>:<LocalPort> RemoteHost
#Example
#Forward local network port 22 of 10.128.42.134 to remote network port 7000 of 192.168.1.2 via ssh connection of example.org
autossh -M20000 -f -q -N -R 192.168.1.2:7000:10.128.42.134:22 example.org
#After connection is established by local network, you can run
#ssh -p 7000 192.168.1.2
#from remote network environment to connect 10.128.42.134:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment