/etc/resolv.conf
in a cmd window (WSL2?)
wsl --shutdown
Create or append to file /etc/wsl.conf
[network]
generateResolvConf = false
microsoft/WSL#1350 DNS server coming from vpn network is not reflected in WSL
By default, bash.exe will auto-generate /etc/resolv.conf every time you launch bash.exe. Then it will try to keep it up to date with changes from Windows, when bash is running.
- in /etc/resolv.conf
- # This file was automatically generated by WSL. To stop automatic generation of this file, remove this line.
ordering of the dns servers is incorrect when the vpn is connected
In PowerShell
Get-DnsClientServerAddress -AddressFamily ipv4 | Select-Object -ExpandProperty ServerAddresses