WSL DNS issues
Sometimes my WSL's DNS changed to something weird and it stopped resolving.
/etc/resolv.conf contains the relevant nameservers, usually when WSL breaks this contains some 172. something IP that is not resolving properly.
You can change the
nameserver section but that will not keep the settings for a while as WSL reapplies it.
To fix, you need to add the following to
[network] generateResolvConf = false
This will stop the WSL from updating the DNS entries on the next WSL boot.
You need to turn it off and start it again using this in an Elevated Powershell:
After that, open WSL again and the DNS should not be automatically modified.
Now remove the symlink that is the previous
sudo rm /etc/resolv.conf
And then create it again and save:
From now on the DNS entry should stay as is.