Skip to content

Instantly share code, notes, and snippets.

@niderhoff
Last active June 29, 2021 08:16
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 niderhoff/519441d6e8fe1b88ab47118275a348d3 to your computer and use it in GitHub Desktop.
Save niderhoff/519441d6e8fe1b88ab47118275a348d3 to your computer and use it in GitHub Desktop.
Fix WSL2 nameserver for VPN
  1. find out your nameserver in the vpn/intranet by opening powershell and writing nslookup
PS C:\Users\niderhof> nslookup
Standardserver:  S4DE4ZSYDIEE123.abc-sa.xxxxx.xyz
Address:  66.66.666.66 <--------

that is the nameserver you want WSL to use also.

  1. execute this: (replace with real value you obtained on your machine)
sudo rm /etc/resolv.conf
sudo bash -c 'echo "nameserver 66.66.666.66" > /etc/resolv.conf'
sudo chattr +i /etc/resolv.conf

then sudo vim /etc/wsl.conf and edit as follows:

[network]
generateResolvConf = false

restart.

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