Skip to content

Instantly share code, notes, and snippets.

@levidehaan
Created May 6, 2013 17:56
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 6 You must be signed in to fork a gist
  • Save levidehaan/5526813 to your computer and use it in GitHub Desktop.
Save levidehaan/5526813 to your computer and use it in GitHub Desktop.
SSH Multi-Hop Tunneling
Command to run:
ssh -L 2222:localhost:8501 user@remoteserver.com
where 2222 is the local port mapping it can be any number above 1000
where localhost must be set to localhost and refers to your current connection
where 8501 is the port you will be opening up on the remote machine
where user@remoteserver.com is the first hop in your quest for internal access
Now hit return and log into your remote box
Now inside your remote box run
ssh -D 8501 user@secondhopserver.com
Where -D 8501 is the same mapping you made earlier, we're extending it, and making it a Socks5 proxy
user@secondhopserver.com is the server you always wanted access to.
now open firefox and go to preferences->network
click the settings button
check manual proxy configuration
in SOCKS Host put 127.0.0.1 port 2222
make sure SOCKS v5 is selected
click ok
BAM your done! :) now you are able to view sites served through that second hop machine :) whoot!
@v6
Copy link

v6 commented Aug 25, 2015

// , I might try this out.

@v6
Copy link

v6 commented Aug 25, 2015

// , Could something like this work for cloning from github?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment