Skip to content

Instantly share code, notes, and snippets.

@andmax
Last active December 12, 2019 12:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andmax/abfcd54f5f1c5610c5ed7c77ae44887a to your computer and use it in GitHub Desktop.
Save andmax/abfcd54f5f1c5610c5ed7c77ae44887a to your computer and use it in GitHub Desktop.
Tunnel port through ssh gateway useful for tensorboard/notebook behind a firewall
ssh -L <local-port>:<2nd-pc-address>:<2nd-pc-port> <1st-pc-address>
=
Host target-forwarding
Hostname <1st-pc-address>
User <1st-pc-username>
LocalForward <local-port> <2nd-pc-address>:<2nd-pc-port>
IdentityFile <1st-pc-identity-file>
# if unix is the gateway (1st-pc) and has its own configuration
Host unix-gateway
User <1st-pc-username>
Port <1st-pc-port>
HostName <1st-pc-address>
IdentityFile <1st-pc-identity-file>
Host target-forwarding
User <2nd-pc-username>
HostName <2nd-pc-address>
ProxyCommand ssh -aT unix-gateway nc %h %p
IdentityFile <2nd-pc-identity-file>
# if windows is the gateway (1st-pc) then have cygwin64/nc.exe installed and do:
Host windows-gateway
User <1st-pc-username>
Port <1st-pc-port>
Hostname <1st-pc-address>
IdentityFile <1st-pc-identity-file>
Host target-forwarding
User <2nd-pc-username>
HostName <2nd-pc-address>
ProxyCommand ssh -aT windows-gateway c:\\cygwin64\\bin\\nc.exe %h %p
IdentityFile <2nd-pc-identity-file>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment