Skip to content

WSL_DNS

Mike Gorman edited this page Apr 6, 2022 · 1 revision

WSL, or Windows Subsystem for Linux is a great tool for performing a lot of actions, but there are a few things that need to be set up to make it work the way you want it to, especially if using OpenZiti, and attempting to access services from it. The biggest one is domain name resolution. WSL already makes it a little odd, and OpenZiti adds a wrinkle to it. The key items to address are to prevent Windows from attempting to create the resolv.conf file, placing the right values in the resolv.conf, and protecting it from overwriting.

  1. To prevent Windows from attempting to create a new resolv.conf, you have to create a wsl.conf file in the /etc directory, and place a pair of lines in it (you will need sudo or to be root).: [network] generateResolvConf = false
  2. Add the name servers you want to use to the resolv.conf file (again, you should be root, or use sudo). The OpenZiti wrinkle is to add 100.64.0.3 as the first entry. This will attempt to use the OpenZiti resolver first, and if there are no services defined with that name, it will proceed to the next entry. The default of 100.64.0.3 may change, and you should check the Windows client tunnel information if this does not work. You also should add general nameservers. These can be the local nameservers gathered from your Windows instance via "ipconfig /all", or use public DNS servers, like Google's (8.8.8.8). Open resolve.conf and add these lines, removing or editing the current entries, of the file exists. nameserver 100.64.0.3 nameserver 8.8.8.8 nameserver [whatever name servers you wish to use]
  3. Lastly, protect the file from being overwritten, as it seems to be even though Windows has been told not to create it. To do this, we change an option on the file to protect it from being deleted or overwritten by using the following command: sudo chattr +i /etc/resolv.conf

The steps above should allow you to use all of the OpenZiti services from your Windows client from within WSL!