Skip to content
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

Mirrored network, port listen in Windows not accessable from WSL using external LAN ip. #10611

Closed
1 of 2 tasks
fanthos opened this issue Oct 9, 2023 · 3 comments
Closed
1 of 2 tasks

Comments

@fanthos
Copy link

fanthos commented Oct 9, 2023

Windows Version

22621.2361ws

WSL Version

2.0.4.0

Are you using WSL 1 or WSL 2?

  • WSL 2
  • WSL 1

Kernel Version

5.15.123.1-1

Distro Version

No response

Other Software

No response

Repro Steps

Set network type to mirrored in .wslconfig.
Listen a port in Windows.
Access the port from WSL2 using external LAN IP on ethernet adapter.

Expected Behavior

The port should accessable.

Actual Behavior

The port is not accessable.

Access port using 127.0.0.1 works, but not on lan IP.

Diagnostic Logs

No response

@fanthos fanthos changed the title Port listen in Windows not accessable from WSL using external LAN ip. Mirrored network, port listen in Windows not accessable from WSL using external LAN ip. Oct 9, 2023
@aki-k
Copy link

aki-k commented Oct 9, 2023

For ssh access you can create a port forward on the Windows host like this:

Open an Administrator CMD prompt

netsh interface portproxy add v4tov4 listenaddress=windows_host_ip listenport=22 connectaddress=localhost connectport=22

Then you can connect to windows_host_ip:22 and access the WSL 2 instance.

@craigloewen-msft
Copy link
Member

Hi @fanthos this is by design. Does this block a certain scenario or workflow for you?? (This scenario isn't supported in NAT either).

If it does, could you open a feature request for us? I'd love to know more about the scenario on why you need this. Thank you!

@whusnoopy
Copy link

Hi @fanthos this is by design. Does this block a certain scenario or workflow for you?? (This scenario isn't supported in NAT either).

If it does, could you open a feature request for us? I'd love to know more about the scenario on why you need this. Thank you!

I meet the same question, here is why I need to access WSL2 listened port by IP on host machine:

I run a web service on my WSL2 for coworkers in the same office, and I need to use it also, when I told others to "access 192.168.1.4:8000 to use it", but I need to access localhost:8000 instead 192.168.1.4:8000, if I copy the link in my browser address bar, others get localhost:8000 which they cannot arrival the right place.

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

No branches or pull requests

5 participants