Skip to content

Instantly share code, notes, and snippets.

@nyuszika7h

nyuszika7h/fix_wsl_dns.sh

Last active Oct 21, 2020
Embed
What would you like to do?
#!/bin/bash
echo 'Updating /etc/wsl.conf...'
printf '[network]\ngenerateResolvConf=false\' | sudo tee -a /etc/wsl.conf > /dev/null
echo 'Updating /etc/resolv.conf...'
printf 'nameserver 8.8.8.8' | sudo tee /etc/resolv.conf > /dev/null
echo 'DNS settings updated. Press Enter to terminate WSL. Any unsaved work will be lost!'
read -r < /dev/tty
wsl.exe --shutdown
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment