This guide will help overcome the DNS issues present in WSL 2 while still making the Windows host IP autogenerated by WSL available for use. Note: this was tested on Windows 10 Build 2004, running Ubuntu 20.04 LTS in WSL 2.
-
Open a WSL terminal
-
Copy the contents of
configure-wsl-dns.sh
to/opt/configure-wsl-dns.sh
:
sudo nano /opt/configure-wsl-dns.sh