Skip to content

Instantly share code, notes, and snippets.

@ferrouswheel
Last active December 14, 2015 19:39
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 ferrouswheel/5138128 to your computer and use it in GitHub Desktop.
Save ferrouswheel/5138128 to your computer and use it in GitHub Desktop.
Want to tunnel your ssh connections through host A to get to host B?
# Why would you do this?
# Well, perhaps you have a VPN to A, and A can access B but you can't access B directly.
# Assuming a and b are hosts in the domain example.com. Add the below to ~/.ssh/config on
# your local machine.
Host b.example.com
ProxyCommand ssh -q a.example.com nc -q0 b.example.com 22
# If you have another host that only b can access, you can also chain through that!
Host c.example.com
ProxyCommand ssh -q b.example.com nc -q0 c.example.com 22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment