3

On Bash for Windows (WSL), I'm trying to create an SSH bridge, using the following command:

ssh -l ubuntu -L 15555:<ip1>:22 <ip2> 

but I'm getting an error bind: Address already in use at this point:

Authenticated to <ip2> ([<ip2>]:22). debug1: Local connections to LOCALHOST:15555 forwarded to remote address <ip1>:22 debug3: channel_setup_fwd_listener: type 2 wildcard 0 addr NULL debug3: sock_set_v6only: set socket 4 IPV6_V6ONLY debug1: Local forwarding listening on ::1 port 15555. debug2: fd 4 setting O_NONBLOCK debug3: fd 4 is O_NONBLOCK debug1: channel 0: new [port listener] debug1: Local forwarding listening on 127.0.0.1 port 15555. bind: Address already in use 

I've tried the same command on Ubuntu and Cygwin and it works, but I just can't get it to work on WSL. I've also tried different ports without any success and I didn't see anything that could be causing this on netstat.

Any idea what could be the reason?

2
  • Typo: your command mentions port 13333, your trace mentions port 15555. Besides, could it be that Windows security layer prevents you from opening a listening port on the local machine? Else, "already in use" means that another program is using the exact same port 15555. DId you launch your ssh command twice? Commented Mar 23, 2017 at 11:38
  • Yes sorry I've updated the question, it's because i've tried several ports 13333, 14444, etc. It could indeed be some issue with Windows security layer, however I managed to get Apache and MySQL running so some services definitely manage to listen on some ports. Commented Mar 23, 2017 at 11:52

1 Answer 1

3

Try this instead:

ssh -l ubuntu -L 127.0.0.1:15555:<ip1>:22 <ip2> 

Or this:

ssh -l ubuntu -4 -L 15555:<ip1>:22 <ip2> 

The problem is that it binds to the IPv6 address by default. This was already reported as a bug here and solved in BashOnWindows build 14942.

1
  • Yes that was it, the second line solved it, thanks a lot! Commented Mar 23, 2017 at 15:50

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.