Enable systemd and prevent any modification on the /etc/resolv.conf to prevent any internet problem access:
2 steps:
– Edit /etc/wsl.conf with:
[boot] systemd=true [network] generateResolvConf = false |
– hardcode the content of /etc/resolv.conf:
sudo rm /etc/resolv.conf
sudo bash -c 'echo "nameserver 1.1.1.1" > /etc/resolv.conf'
You can restart WSL now:
wsl --shutdown