Created
June 16, 2023 21:36
-
-
Save kthy/b35babc226c7b29a2d56100e4532571d to your computer and use it in GitHub Desktop.
Add Windows host DNS entry in Ubuntu/WSL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ! $(cat /etc/hosts | grep -q 'winhost'); then | |
echo 'Adding DNS entry for Windows host in /etc/hosts' | |
echo '# Windows host - added via ~/.bashrc' | sudo tee -a /etc/hosts | |
echo -e "$(grep nameserver /etc/resolv.conf | awk '{print $2, " winhost"}')" | sudo tee -a /etc/hosts | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment