In this article
When the Windows Roaming Client runs on a computer with Windows Subsystem for Linux (WSL), WSL can have recurring connectivity issues, such as:
- "No route to host" errors
- WSL networking that works for a while after a restart, then fails again
These issues occur because the Roaming Client interferes with the default NAT networking mode in WSL. There are two methods to resolve this issue.
Method 1: Use mirrored networking (recommended)
Switching WSL to mirrored networking mode resolves the conflict.
This method requires Windows 11 version 22H2 or later and WSL version 2.0.9 or later.
- Create or edit a
.wslconfigfile in the Windows user directory (C:\Users\<UserName>\.wslconfig). -
Add these lines:
[wsl2] networkingMode=mirrored - Save the file and restart the WSL distributions.
WSL can then reach the network without the "no route to host" error.
Method 2: Configure DNS manually
Use this method if mirrored networking is not supported. With this method, DNS queries from the WSL distribution go directly to 1.1.1.1 and 8.8.8.8, and DNSFilter does not filter them.
- Open the WSL distribution.
-
Remove the automatically generated
resolv.conffile:sudo rm /etc/resolv.conf -
Create a new
resolv.conffile:sudo nano /etc/resolv.confAdd these external DNS servers and save the file:
nameserver 1.1.1.1 nameserver 8.8.8.8 -
Create an additional file to keep the DNS setting permanent:
sudo nano /etc/wsl.confAdd this network setting and save the file:
[network] generateResolvConf = false -
Restart WSL:
wsl --shutdownThe WSL instance now uses the alternate DNS settings. Verify the settings with this command:
cat /etc/resolv.conf
Comments
0 comments
Article is closed for comments.