I have a distant server, that is not accessible from the outside world. I would like to turn it into a proxy nonetheless. I was thinking I could use server (that I fully own) to achieve my goal.

Apologies if the following is not clear enough, for I have very little knowledge about networking.

What I can do:

  • I know I can open a reverse ssh connexion from distant to server, and use it to access distant from the local computer. For instance, from local I can ssh server, then when logged in, use ssh localhost -p 12345 to finally access distant via ssh.
  • I also know about ssh -D 1080 server, that will allow me to use server as a SOCKS proxy from my computer

network figure

What I would like to do

I would like to open a SOCKS proxy from local, that uses the ip of distant. I have no idea wether this is possible, but in naive words, I'd say I'm trying to open a socks connexion to the server, while telling the server to use its own localhost:12345 to access internet.

In other words, I'm trying to funnel a SOCKS proxy from localto distant, thanks to server that is accessible via a public IP address.

Any idea/direction on how to do this, provided it is even possible ?


On local:

ssh -L 1080:localhost:1080
# now 1080 is listening on `local`

On server:

ssh -D 1080 -p 12345 localhost
# now 1080 is listening on `server`

Switch to autossh so the connections would persist.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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