Microsoft Merges One-Line Fix for WSL DNS Failures in VPN Environments

When DNS tunneling is disabled in WSL2 mirrored mode, VPN DNS servers can occupy the available slots and cause name resolution to fail. Microsoft has merged a fix that applies a per-VPN-adapter limit to the combined IPv4 and IPv6 total.
Wi-Fi DNS servers are not selected
On November 26, a user running WSL 3.0.5.0 and Arch Linux ARM reported name-resolution failures in the Linux environment.
The user was running WSL2 in mirrored mode on Windows with DNS tunneling disabled. The Windows virtual network adapter for the VPN had no DNS server configured and was reportedly assigned three fallback IPv6 addresses.
The Wi-Fi connection had both IPv4 and IPv6 DNS servers configured. The automatically generated WSL DNS configuration file, /etc/resolv.conf, contained three VPN IPv6 addresses. None of the addresses could be reached in the user's environment, and name resolution failed because the Wi-Fi DNS servers were not selected.
The DNS server selection process has a maximum of three slots. When candidates were selected with priority given to the VPN, IPv6 processing could consume slots needed by other networks.
IPv6 selection limit calculated per adapter
A proposed fix was submitted to Microsoft's WSL development repository on November 23 and merged into the development master branch at 11:06 a.m. on November 26.
One-Line Fix Merged for WSL2 VPN DNS Failure
| Item | Before fix | Development code after fix |
|---|---|---|
| Mirrored mode with DNS tunneling disabled (VPNs handled per adapter) | ||
| VPN IPv4 limit | Up to one | Up to one |
| VPN IPv6 limit | Overall remaining capacity | One minus number of selected IPv4 servers |
| Total per VPN | Up to three | Up to one |
| Overall registration limit | Three | Three |
| Failure example (WSL 3.0.5.0; post-fix figures estimated) | ||
| Registered VPN IPv6 servers | Three | One |
| Remaining Wi-Fi slots | Zero | Two |
The previous code limited the number of IPv4 DNS servers obtained from a VPN adapter to one. The IPv6 selection logic still calculated its limit from the remaining capacity of the entire DNS server list, allowing IPv6 candidates to be registered beyond the per-VPN-adapter limit.
The change rewrites one line of logic in WslCoreHostDnsInfo.cpp. The IPv6 selection limit is now calculated by subtracting the number of already selected IPv4 servers from the limit assigned to that adapter.
The limit of one entry in total across IPv4 and IPv6 is applied to each VPN adapter. IPv4 candidates are prioritized; when no IPv4 candidate is available and IPv6 is eligible, up to one IPv6 candidate is selected. The overall limit remains three entries.
Applying the new calculation to the reported environment would reduce the number of registered VPN IPv6 addresses to one, leaving two slots for Wi-Fi DNS servers.
The developer responsible for the fix told the user that the change was expected to resolve the issue. As of November 26, the public record did not include results from the reporter testing the fix.
Why DNS tunneling may be disabled
Microsoft explains that mirrored mode, which reflects the Windows network configuration into Linux, can improve VPN compatibility. DNS tunneling is also enabled by default on Windows 11 22H2 and later, and responds to DNS requests from Linux through the virtualization layer.
The reporter uses software that inspects and routes DNS traffic on the Linux side. DNS tunneling bypasses that processing, so the user needed to disable it.
On February 17, engineers at PERSOL & Serverworks described their company's use of VPNs on standard PCs. Because mirrored mode did not work well with their VPN environment, they adopted WSL1 and configured DNS manually. It has not been established whether that case shares the same cause as this bug.
As of November 26, version 3.0.5, which the official WSL release list identifies as the latest stable release, still uses the previous calculation. The fix has not yet been confirmed in a generally available release.
VPN DNS should take priority, but room should remain for DNS from the regular network.
KioskNews shows a cleaned-up reading view extracted from the publisher’s page — the original always lives on their site, not ours.