Skip to content

Instantly share code, notes, and snippets.

@Himura2la
Created September 1, 2021 15:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Himura2la/c6b2568b5fca6a0ee24994c97a3a0689 to your computer and use it in GitHub Desktop.
Save Himura2la/c6b2568b5fca6a0ee24994c97a3a0689 to your computer and use it in GitHub Desktop.
How to fix domain hosts resolve in WSL

In your Debian or Ubuntu WSL do:

cat << EOF | sudo tee /etc/wsl.conf
[network]
generateResolvConf = false
EOF

Reboot your WSL (from PowerShell or CMD)

wsl --terminate Debian 

Reconnect to your WSL and remove the symlink of resolv.conf

sudo rm /etc/resolv.conf

Fill the resolv.conf with the correct info

cat << EOF | sudo tee /etc/resolv.conf
domain your.domain.com
search your.domain.com
nameserver 177.77.0.51
nameserver 177.77.0.53
EOF

Reboot (from PowerShell or CMD)

wsl --terminate Debian 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment