Building an SSH Tunnel using Windows Services for Linux

8,922

The problem has to do with, by default, the system wanting to use IPv6. If you force to IPv4 it will work. Try one of these options:

ssh -L 127.0.0.1:3390:192.168.1.235:3389 srv.my.org

OR

ssh -L 0.0.0.0:3390:192.168.1.235:3389 srv.my.org
Share:
8,922

Related videos on Youtube

Patrick Schomburg
Author by

Patrick Schomburg

Updated on September 18, 2022

Comments

  • Patrick Schomburg
    Patrick Schomburg over 1 year

    I'm running the following ssh command to open a remote session to my network and tunnel RDP through it. What I'm looking to do is open local port 3390 and have it forward out the remote end to 192.168.1.235:3389.

    ssh -L 3390:192.168.1.235:3389 srv.my.org
    

    I use a similar setup with putty that works fine. Using Ubuntu/bash on Windows 10 (build 14393), I receive a bind: Address already in use. The ssh session establishes, but not the tunnel. I verified nothing is currently running on either port using netstat -an |grep 3390. Also ran lsof -ti:3390 and received no results.

    • Jakuje
      Jakuje over 7 years
      You probably want remote port forwarding, if you want your local 3390 port accessible on the 192.168.1.235.
    • Patrick Schomburg
      Patrick Schomburg over 7 years
      @Jakuje I may not be clear on the remote/local definitions. I added a bit on what I'm trying to do.
    • tobiasBora
      tobiasBora over 7 years
      Could you try to run "lsof -ti:3390" to see what is using this port ?
    • Patrick Schomburg
      Patrick Schomburg over 7 years
      @tobiasBora Thx. Done and added to question. No results were returned.
    • tobiasBora
      tobiasBora over 7 years
      Event if you run it as sudo ?
    • Patrick Schomburg
      Patrick Schomburg over 7 years
      @tobiasBora yes. Keep in mind this is a limited linux environment running within Windows. I've used netstat -an|findstr 3390 to verify the port is not in use under Windows
    • tobiasBora
      tobiasBora over 7 years
      Hum... How did you set-up the linux environment under Windows ? Is you use instead Putty like this, does it work ? : klinkner.net/~srk/techTips/ssh-remote
    • Patrick Schomburg
      Patrick Schomburg over 7 years
      Using Windows Services for Linux (see: msdn.microsoft.com/en-us/commandline/wsl/about). And yes, putty tunnels work fine. I suspect this is a feature of the way ssh is working under WSL. Was hoping to find some insight.