WSL will automatically "fallback" to NAT mode when "networkingMode=mirrored" is set and proxy enabled
- 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.3915]
### WSL Version
2.3.26.0
### Are you using WSL 1 or WSL 2?
- [x] WSL 2
- [ ] WSL 1
### Kernel Version
5.15.167.4-1
### Distro Version
Ubuntu 24.04
### Other Software
_No response_
### Repro Steps
1. Set `C:/Users//.wslconfig` to the following:
```
[wsl2]
memory=16GB
processors=8
networkingMode=mirrored
[experimental]
autoMemoryReclaim=gradual
bestEffortDnsParsing=true
```
2. Run a global proxy server on localhost and configure it correspondingly on the host. For example,
Mine here is http://127.0.0.1:10810
3. Start `wsl.exe`.
A message "wsl: 检测到 localhost 代理配置,但未镜像到 WSL。NAT 模式下的 WSL 不支持 localhost 代理。"("wsl: detected localhost proxy settings, but are not mirrored to WSL. WSL under NAT mode does not support localhost proxies.") will appear. No connection to outside can be made inside WSL, no matter it is available readily without proxy or not. For example,
### Expected Behavior
Expected it to be normal (using Windows' network configurations and proxy settings; can normally make connections).
### Actual Behavior
As mentioned above, no connection could be made inside WSL to outside.
### Diagnostic Logs
_No response_
Contributor guide
Research direction
Reproduce the issue by setting networkingMode=mirrored in C:/Users//.wslconfig, enabling a localhost proxy, and starting wsl.exe. Compare the reported NAT fallback and failed outbound connections with the expected mirrored networking behavior; done means WSL remains usable with the host proxy configuration.
Written by the indexing model from the issue text.
Assessment
- Domain
- networking, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100