Skip to content

svargas-dev/wsl-dns

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

WSL Update/Revert DNS servers

Background

Due to the way WSL is configured by default some DNS resolutions may fail e.g. using a VPN or using Node dns.resolveMX()

This repo provides scripts to manually update and revert the DNS server to resolve these issues based on Microsoft Docs: WSL has no network connectivity once connected to a VPN for the default Ubuntu 22.04 on WSL2.

Disclaimer: Use at your own risk! Make sure your read and understand any scripts before running them!

How to use

There are two scripts:

  • updatedns <IPv4 address e.g. 192.168.0.1>
    • To get the DNS server open a PowerShell and type ipconfig.exe /all and look for the line DNS Servers . . . . . . . . . . . : x.x.x.x on the adapter in use
  • revertdns

One way to use these would be to

$ mkdir ~/.local/bin && cd ~/.local/bin
$ git clone <url repo> .
$ chmod +x updatedns revertdns

Then add the scripts' path to your shell PATHS

About

Shell scripts to update and revert DNS server configuration in Ubuntu 22.04 on WSL2 e.g. when using a VPN

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages