I want to set up a Raspberry Pi on my home network that I can use as a socks proxy from work or other location (parents' house). In other words, I want to navigate the web and have it appear that it's happening from my home network regardless of where I'm connecting from.

I know this question has been asked multiple times, but I just can't seem to figure out what I'm doing wrong or missing.

I am close to making it work, but after hours and hours of searching and trying, I can't quite put it all together.

Here's what I have so far.

RPi at home ----> Linux VPS <----- me, on windows box

From the RPI, I issue the command:

ssh -f -N -T -R 2210:localhost:22 [email protected]

This appears to set up the reverse tunnel on the VPS (I can see it listening on port 2210 on the VPS):

tcp  0   0*         LISTEN

From my local windows workstation, I can use Putty to ssh into the Linux VPS and issue:

ssh -p 2210 RPi-account@localhost


ssh -l RPi-account -p 2210 localhost

I have keys set up on the RPI and the VPS so they can log into each other without a password.

This connects me from my windows workstation through the VPS to the RPI and I'm able to get an SSH connection to the RPi, but the socks proxy isn't working.

What I cannot figure out is how to configure the SSH command from the VPS and also Putty on my workstation to make this connection and pass the socks connection through the RPI so I can browse. I have tried many combinations of SSH tunnel configs in Putty (port forwarding, dynamic ports), but the best I can do is get a socks proxy connection that goes out to the Net from the Linux VPS (the mid-point).

From the VPS, I've tried:

ssh -p 2210 -D 8888 RPi-account@localhost

and then from Putty on my workstations I set up the connection to the VPS with a tunnel like this:


setting the socks proxy locally to port 50000 doesn't give the browser access to the outside world.

What am I missing to allow me to socks proxy from my local workstation to the VPS and chain it to and through the RPi?


1 Answer 1


You don't want the SOCKS proxy on the Linux VPS, you want it on the Windows machine. You can use a regular port forwarding to another regular port forwarding, but you can't use a SOCKS forwarding to another SOCKS forwarding.

The simple solution is to use Putty to connect to Linux-VPS at port 2210 while creating a SOCKS tunnel in Putty. The connection to Linux-VPS:2210 will be forwarded to your PI, so connections to the SOCKS port will be forwarded to the PI.

A regular forwarding to a SOCKS forwarding, as you described, should also work, but is more complicated. You should verify that the second SSH connection from the VPS to the PI is really established and has port 8888 open.


The reverse forwarding you create with the SSH connection from the PI to the VPS means that a SSH connection to Linux-VPS:2210 is the same as a connection to PI:22, except that you can't use the latter because of firewall/routing limitations.

So in Unix terms, you just need to connect to the PI (via VPS) and make the port forwarding:

ssh -D 50000 -p 2210 RPi-account@Linux-VPS

This is equivalent to

ssh -D 50000 -p 22 RPi-account@PI

As you use Putty, you configure host and port (Linux-VPS:2210) in the Session tab, the username (RPi-account) in "Connection->Data" and the port forwarding on "Connection->SSH->Tunnels". You enter source port 50000, destination is empty, and select dynamic and auto, then press Add. The forwarding should be listed as D50000. You may also want to configure a key for automatic login to the PI. Your VPS doesn't need a key to the PI for this to work.

  • Your 'simple solution' in the 2nd paragraph sounds great. I believe I'm creating the reverse tunnel from the RPi to the Linux VPS. I can see the VPS listening on port 2210. What I can't figure out is the Putty settings to pass the socks tunnel through the VPS. If I understand correctly, I need to use a Dynamic port in Putty to create the socks tunnel so I set up port forwarding using D50000. I can then proxy out except it's going out to the Net from the VPS and not through the tunnel to the RPi. What Putty settings do I use to forward the tunnel from Putty to port 2210 on the VPS? Thanks!
    – LPowers
    Dec 21, 2018 at 18:39
  • I added some details, I hope this helps.
    – RalfFriedl
    Dec 22, 2018 at 18:00
  • Thank you so much. The specific Putty config instructions you provided did the trick. I had been so close before but never quite got everything in the right place at the same time. Hopefully this helps others with the same question.
    – LPowers
    Jan 1, 2019 at 17:14
  • Thank you for mentioning "dynamic"! That's the key! I successfully made a reverse socks proxy, yay!
    – pepoluan
    Aug 23, 2023 at 10:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .