Unable to reach WSL from Windows with mirrored networking mode
- Dominant language
- C++
- Stars
- 33.7k
- Forks
- 1.8k
- Avg merge
- 3d 17h
- Merged PRs (30d)
- 116
Description
### Windows Version
Microsoft Windows [Version 10.0.26100.4202]
### WSL Version
2.5.7.0
### Are you using WSL 1 or WSL 2?
- [x] WSL 2
- [ ] WSL 1
### Kernel Version
6.6.87.1-1
### Distro Version
Ubuntu 24.04
### Other Software
_No response_
### Repro Steps
#### Preparation
1. Set WSL to use mirrored networking mode, make sure systemd is enabled, and leave everything else default.
2. Reboot Windows to make sure the settings take effect. (The reboot has been necessary for me, I'm not sure about everyone else's situation.)
#### Scenario A - Docker 101 served from port 80
In WSL, run `docker run --rm -p 80:80 docker/getting-started` to start serving Docker 101 tutorial from port 80.
#### Scenario B - Serve a Next.js dev app from port 3000
1. In WSL, run `npx create-next-app@latest` to create a Next.js app.
2. `cd` into the project directory, and run `npm run dev` to start a dev server at port 3000.
#### Scenario C - Serving various Supabase services with Docker from port 5432*
1. In WSL, run `npx create-next-app@latest` to create a Next.js app.
2. `cd` into the project directory, and run `npm install supabase --save-dev` to install Supabase as a project dev dependency.
3. Run `npx supabase init` and then `npx supabase start` to start various containerised services - they should occupy port 54321, 54323 and 54324.
### Expected Behavior
These URLs should all be reachable from both within WSL and from host Windows:
* http://localhost:80
* http://localhost:3000
* http://localhost:54321
* http://localhost:54323
* http://localhost:54324
* http://127.0.0.1:80
* http://127.0.0.1:3000
* http://127.0.0.1:54321
* http://127.0.0.1:54323
* http://127.0.0.1:54324
### Actual Behavior
* All URLs listed were only reachable from within WSL.
* Loading any of the URLs in MS Edge running in host Windows resulted in (address differed for each URL):
```
Hmmm… can't reach this page
localhost refused to connect.
Try:
Search the web for [localhost](https://www.bing.com/search?form=ANLKDR&q=localhost)
Checking the connection
[Checking the proxy and the firewall](chrome-error://chromewebdata/#buttons)
ERR_CONNECTION_REFUSED
```
I also tried requesting using [Bruno](https://github.com/usebruno/bruno), and I always got `connect ETIMEDOUT 127.0.0.1:3000` (port differed for each URL).
#### Additional troubleshooting I've done
* Installed a brand-new Ubuntu 24.04 distro and tested from there - got same issue.
* Changed to NAT networking mode while leaving everything else unchanged - didn't get the same issue, i.e. can reach WSL from Windows.
* Tried `systemctl disable network-manager.service` and `systemctl disable NetworkManager.service` - neither worked since neither service existed.
* Realised there's `systemd-networkd.service` and it was already disabled; in vain hope, tried enabling & starting the service and then stopping & disabling the service - in the end, nothing changed i.e. still got the same issue.
* Tried both Hyper-V firewall commands noted at https://learn.microsoft.com/en-us/windows/wsl/networking#mirrored-mode-networking - made no difference i.e. still got the same issue.
* Played with disabling/enabling the "Hyper-V" and/or the "Windows Hypervisor Platform" Windows features - made no difference i.e. still got the same issue.
### Diagnostic Logs
[WslNetworkingLogs-2025-05-30_21-43-52.zip](https://github.com/user-attachments/files/20520727/WslNetworkingLogs-2025-05-30_21-43-52.zip)
Contributor guide
Research direction
Start by reviewing WslNetworkingLogs-2025-05-30_21-43-52.zip and the mirrored networking mode configuration described in the report. Reproduce the Docker port 80 and Next.js port 3000 scenarios, then compare host and WSL access to the listed localhost and 127.0.0.1 URLs; done means identifying and resolving the host connectivity failure without breaking NAT mode.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, linux, ubuntu
- Domain
- networking, operating-systems
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100