Open bobvandevijver opened 4 years ago
I also facing similar issues where as sometimes port open from wsl2 accessible from windows host and sometimes not.. Didn't able to get actual reason anywhere... I have all things at latest version on todays date....
Is there any update on this at all?
Currently i did exactly as described above
Did you ever get this to work?
No, I did not get this to work, still using WSL1 at the moment
I thought I can use this, but finally end up in dual booting my system as always!
You're probably being blocked by the Windows firewall as Ethernet is a "Public" network. Create a new rule in windows firewall settings to allow inbound traffic
check out this answer on https://superuser.com/a/1496354
I adden an inbound rule for my test port (8000 in my case) that should apply for all interfaces and for all types of networks (so including public
). Still, I can't access the service from within WSL2 using the IP in /etc/resolv.conf
.
I also don't see dropped connections logged by the Windows firewall.
This is still an issue as to this day. I tried every possible workaround... The big problem is that this is preventing many people from migrating from Docker for Windows to Podman running inside Linux on WSL 2, as they cant test the services in the containers against an application server running on Windows (which you usually do when developing said server).
Downgrading to WSL 1 is also not an option as this causes issues with Podmans File system drivers
You need to allow inbound connection in Windows Firewall for that program which wants to connect with WSL2 side.
Allowed inbound connection in firewall and no luck
still open after two years and no response from Microsoft ... what a shame
but i found a workaround for this on Windows 10 using Internet Connection Sharing:
it's wired the chosen WSL disappear after restart in step 1's properties dialog, but seems have no impact.
NOTE: turn off windows defender firewall when testing
well...I also faced this issue today...
Microsoft, fack you.
i'm facing this issue too and it's feel so bad
Microsoft, fack you.
Windows was sht, is sht, always will be sh*t
You're probably being blocked by the Windows firewall as Ethernet is a "Public" network. Create a new rule in windows firewall settings to allow inbound traffic
check out this answer on https://superuser.com/a/1496354
Tried that, still no luck. This issue still persists.
Hi. Can you please collect networking logs by following the instructions below? https://github.com/microsoft/WSL/blob/master/CONTRIBUTING.md#collect-wsl-logs-for-networking-issues
I was finally able to connect from a docker container on WSL2 to Windows 10 host. (Docker -> WSL2 -> Windows 10). Here is some insight about how I did it: In my case, I was trying to connect to a gRPC server which was listening "localhost" in windows 10, from a client that was also targeting "localhost" and was inside a docker container on WSL2. So, the setup was looking something like this:
Docker(targets: "localhost") -> WSL2 -> Windows 10 (listens: "localhost")
I changed it to something like this:
Docker(targets: "the IP in /etc/resolv.conf on WSL2") -> WSL2 -> Windows 10 (listens: "0.0.0.0")
And it worked.
It might not applicable in your case but in the end I was able to receive connections from my WSL2 ubuntu instance towards Windows 10 host.
P.S.: I also put the docker container network mode to "host". Meaning it was not in its own sub "docker network".
Environment
Steps to reproduce
I just installed a fresh Ubuntu 20.04 LTS on WSL2 for creating this ticket (I experienced the same problem with my Debian on WSL2, so I downgraded that one back to WSL1 as I needed the functionality).
Make sure to have a webserver running on Windows, and you cannot access it with the IP from
/etc/resolv.conf
in WSL2, even through that should work according to the docs.In this case, I created a simply NodeJS server on port
8080
, which is listening on0.0.0.0
. It is accessible from the entire LAN on192.168.1.24
(local IP).Now, if you want to access it from WSL2, using the nameserver (
172.21.48.1
here, or virtual IP) as suggested in the article, it unfortunately does not respond at all. Usinglocalhost
doesn't work either (as expected), but using the direct IP address does work.Below is a screenshot of my test: top-left is the WSL2 Ubuntu, top-right is Powershell on Windows running the actual server. De two browser windows on the bottom are run on the host machine, demonstrating the webserver responds to both localhost and the external IP (external IP access was also tested from another machine on the LAN, that works fine).
Expected behavior
I would expect to either
/etc/resolv.conf
(but that breaks DNS resolving at this time)The latter would be useful for scripting.
Actual behavior
Well, it isn't working as I would have hopedπ
P.S. While working on this, I also managed to break DNS resolving completely. This was probably related to me resetting the Windows firewall (for testing), as it was fixed after rebooting.