-
Notifications
You must be signed in to change notification settings - Fork 814
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
Devices within the LAN cannot access the network service running in WSL. #10714
Comments
@CatalinFetoiu Here is a detailed issue. |
AFAIK,
I think WSL resolves localhost to its IPv6 address ( PS> netstat -ano | findstr ":80"
TCP [::1]:80 [::]:0 LISTENING 17668 If you want your web server on IPv4 (i.e. |
If your objection pertains to dual-mode sockets? That is a separate issue. Here I think you're referring to the fact that the relay is only binding to localhost on the host. That is by design. Edit: Let me double check. |
@pmartincic Is there some issue with 'networkingMode=mirrored' and using
to create a port forward from the Windows host into the WSL 2 instance? |
@aki-k, it should, except given limitations of the way mirrored works you might have to use two different port numbers. |
@pmartincic I'm sorry for my poor expression. Here is the context of this issue #10597 (comment) I just wonder if the devices can access the service whihc hosted in WSL |
@Kutius did you set up Hyper-V firewall to allow inbound traffic to port 3001? If not, can you please try running the following command in an admin powershell windows, then try the scenario again? New-NetFirewallHyperVRule -DisplayName "allow port 3001 inbound" -Direction Inbound -LocalPorts 3001 -Action Allow |
@CatalinFetoiu Yes, as the same of previous issue. Once I typed the command, the LAN device can access ps: The service in WSL is keep running throughout |
@pmartincic Why did you close this issue with no solution? |
@Kutius I couldn't understand your previous message. Do you mean that this command
fixed your problem accessing the WSL 2 instance's service running on port 3001 from your other LAN devices? |
@aki-k Yes. If I create a hyperRule explicitly, LAN can access now. |
@Canowyrms By |
I didn't even know that WSL 2 was using some other firewall than the Windows Defender Firewall. I don't use the setting 'networkingMode=mirrored', but I allow access from the WSL 2 instance (from the private IPv4 networks) to the Windows host in Windows Defender Firewall. |
@aki-k I'm not learn about to WSL2 networking previously. I use WSL2 just because this version has the feature about mirrored network. Prior to this version, did WSL2 use a different network segment internally than windows? So development in WSL2 used to require port forwarding |
@Kutius I was not too clear about the relation between Windows firewall rules and Hyper-V firewall rules You can try the following scenario: |
Windows Version
Microsoft Windows [Version 10.0.22631.2506]
WSL Version
2.0.7.0
Are you using WSL 1 or WSL 2?
Kernel Version
5.15.133.1
Distro Version
Ubuntu 22.04
Other Software
node v20.9.0
Repro Steps
Details
192.168.6.288:3001
. The ip is Windows lan ip. And get no responseBy the way, Accessing
localhost:3001
in the computer's browser yields a response.If I run the script in windows, the LAN device can access.
Expected Behavior
Device in LAN can access
Actual Behavior
No response
Diagnostic Logs
.wslconfig:
The text was updated successfully, but these errors were encountered: