Featured image of post When WSL DNS fails you

When WSL DNS fails you

So that I will remember!

When running WSL in a corporate environment, I sometimes an error like the following, where the cli is not able to resolve the IP address correctly. This error is from terraform but I have seen it elsewhere.


╷ │ Error: Failed to query available provider packages │ │ Could not retrieve the list of available versions for provider hashicorp/random: could not connect to registry.terraform.io: failed to request discovery document: Get │ “https://registry.terraform.io/.well-known/terraform.json": dial tcp: lookup registry.terraform.io on read udp> i/o timeout

to fix it

Change the DNS Server in /etc/resolv.conf

sudo nano /etc/resolv.conf

wsl-dns-resolve I normally just change the nameserver to

You will need to do this for every tab you open or you can follow the instructions to set it permanently

# This file was automatically generated by WSL. To stop automatic generation of this file, add the following entry to /etc/wsl.conf:
# [network]
# generateResolvConf = false

Now I know :-)

Built with Hugo
Theme Stack designed by Jimmy