Quantcast
Channel: Active questions tagged windows-subsystem-for-linux - Ask Ubuntu
Viewing all articles
Browse latest Browse all 2930

How to fix WSL domain resolution

$
0
0

so I was having issues with domain resolution with WSL whenever I use the VPN. I would get this:

ping: google.com: Temporary failure in name resolution

I tried following instructions from these answers Temporary Failure in name resolution on WSL

Specifically from this part:

  1. Inside WSL2, create or append file: /etc/wsl.conf

  2. Put the following lines in the file in order to ensure the your DNS changes do not get blown away

    echo "[network]" | sudo tee /etc/wsl.confecho "generateResolvConf = false" | sudo tee -a /etc/wsl.conf
  3. In a cmd window, run wsl --shutdown

  4. Start WSL2

  5. Run the following inside WSL2

    sudo rm -rf /etc/resolv.confsudo cat << EOF > /etc/resolv.confsearch [yourbase.domain.local]nameserver 8.8.8.8nameserver 1.1.1.1EOF

However, I cannot seem to be able to edit the file /etc/resolv.conf as I would get zsh: permission denied: /etc/resolv.conf

I also don't know what it means [yourbase.domain.local] or with what I should be replacing it. I already messed up my domain resolution, and now I get the first error every time, even when my laptop is not connected to the VPN. I really need to know how to fix the config files that I modified

Edit: using muru's suggestion from the comments, I was able to fix the domain resolution with the command

sudo tee /etc/resolv.conf <<EOF

However, I'd like to know if there is a solution for this error when I connect to a VPN. Since none of the solutions from the mentioned link didn't work for me.


Viewing all articles
Browse latest Browse all 2930

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>