Skip to content

WSL cannot access port forwarded on Windows 10 #10206

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
1 of 2 tasks
sindrom91 opened this issue Jun 16, 2023 · 2 comments
Closed
1 of 2 tasks

WSL cannot access port forwarded on Windows 10 #10206

sindrom91 opened this issue Jun 16, 2023 · 2 comments
Labels

Comments

@sindrom91
Copy link

Windows Version

Microsoft Windows [Version 10.0.19045.2965]

WSL Version

1.2.5.0

Are you using WSL 1 or WSL 2?

  • WSL 2
  • WSL 1

Kernel Version

5.15.90.1-microsoft-standard-WSL2

Distro Version

OpenSUSE 15.4

Other Software

No response

Repro Steps

Run some kind of server on Windows on loopback address which is not 127.0.0.1, for example:
python3.exe -m http.server -b 127.128.0.11 11224

Forward that address and port to localhost:
netsh interface portproxy add v4tov4 listenaddress=127.0.0.1 listenport=11224 connectaddress=127.128.0.11 connectport=11224

Try to access the forwarded port from Windows, for example:
wget localhost:11224 (this works for me)

Try accessing that port from WSL:
wget ${HOST}.local:11224 (this doesn't work for me, connection times out)

Note that if I run the server directly on 127.0.0.1:11224, it works correctly.

Expected Behavior

I expected to be able to access the forwarded port.

Actual Behavior

I get connection timeout.

Diagnostic Logs

No response

@ghost
Copy link

ghost commented Jun 20, 2023

If I'm reading this correctly this is by design. On ipv4 only binds on 127.0.0.1 or 0.0.0.0 have port forwarding.

@ghost ghost closed this as completed Jun 20, 2023
@ghost ghost added the bydesign label Jun 20, 2023
@sindrom91
Copy link
Author

I see, thanks for the feedback. I thought I could work around this with forwarding.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant