The network looks like this : Server X -- My machine -- Server Y

My machine has SSH access to both boxes. Server Y has internet but not server X. How can I make a tunnel so server X can acces the internet through Y?

Thank you

  • Do we have to use a two-step tunnel or can we do things like enabling routing on your computer? – David King Dec 3 '15 at 20:30
  • Two-steps tunnel – user3916237 Dec 3 '15 at 20:36

There are several ways of doing this but none of them are good solutions. The way I would probably do it if I had to is like this:

  1. From your machine, tunnel port 222 from your machine to port 22 server Y

    ssh -L222:localhost:22 servery

  2. From server X, create a dynamic tunnel from server X to server Y using the previously constructed tunnel. Note: your destination on this command is mymachine but the credentials you'll use are for server Y since it's what you're actually connecting to.

    ssh -D8080 -p 222 mymachine

  3. Setup server X with a system wide SOCKS Proxy of localhost:8080
  • How the second command would create a tunnel between X & Y? you're only giving it port 222 which has been forwareded on my machine to port 22 on Y. There is no reference to server X – user3916237 Dec 7 '15 at 14:37
  • I just edited my answer. The command on step #2 should be run from server X. – David King Dec 7 '15 at 14:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.