WSL 2 can’t ping a host
22 Oct 2024Using WSL and can’t access some internal sites? It could be because you’ve copy pasted some bad resolver config. Or, you might have made changes that don’t survive reboots.
Microsoft’s default configuration seems to not apply in all circumstances, and some Stack Overflow advice suggests just putting Google’s 8.8.8.8 into /etc/resolvers.conf
, which also requires elevated permissions.
In any case, if you have private DNS (for internal services or sites), this isn’t going to work, as hosts like secret-internal.example.com
may not be on your public DNS server.
If so, adding:
[network]
generateResolvConf=true
to your .wslconfig
file should help. This typically lives at C:\Users\<YourUserName>\.wslconfig
.
One more thing – follow the 8 second rule when applying this kind of config change.