I want to make a tunnel - listen some fixed port on my local machine and every traffic it gets to be sent over SOCKS proxy (with authentication) to some specific fixed host&port behind that proxy and back.
On windows.
It should behave like ssh port forwarding tunnel but with authenticated SOCKS proxy in between.
How can I achieve that?

UPD: I think I need something like https://github.com/tonyseek/rsocks but for windows, maybe I'll be able to launch it via WSL

  • Does the application you are trying to use support SOCKS4/5? SOCKS uses a Session layer header on all packets to control the proxy connection, unlike SSH tunnels which just relies on configuring the destination port the application uses. SOCKS is good when you can't predict the remote end point to preconfigure a tunnel, and configure the app to use it, but doesn't encrypt the whole packet, and requires the application to knowingly use it. Jun 21, 2018 at 19:58
  • @FrankThomas, you are right, there is an application, that have no socks support/settings, but I can configure host and port where it should connect too. It works ok via ssh tunnels, but now I also need to pass its traffic through socks proxy
    – guai
    Jun 22, 2018 at 9:21
  • I'm afraid socks doesn't work that way, unless you can find some software that can Socks-ify traffic and redirect it to a proxy. you can't set up a SOCKS session with just a host and port. it just doesn't work the same way as ssh or stunnel. Jun 24, 2018 at 6:02
  • @FrankThomas, I know that and I'm looking for such a software
    – guai
    Jun 25, 2018 at 9:15

1 Answer 1


What you are asking for is called remote port forwarding. You only need SSH for making it work, and no other software or proxy is required.

For Linux, you need to edit the file /etc/ssh/sshd_config file, which surely has an equivalent in Windows. Add the following line at the bottom:

GatewayPorts yes

You will use the command

ssh -R sourcePort:forwardToHost:onPort connectToHost

Which means: connect with ssh to connectToHost, and forward all connection attempts to the remote sourcePort to port onPort on the machine called forwardToHost, which can be reached from your local machine.

There are many useful sources to be found. Some of them are:

  • that's not what I need. Yes, I need a transparent tunnel like ssh makes, but with socks in between endpoints. rsocks seems promising. I made it work on windows via WSL. Maybe it will work on bare windows too, since its in python - didn't try yet
    – guai
    Jul 2, 2018 at 11:38

You must log in to answer this question.

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