Get-DnsClientServerAddress -AddressFamily ipv4 | Select-Object -ExpandProperty ServerAddresses
(on the result returned you have to detect which dns address is used for your vpn, in my case, 3 result are returned,
2 are internal to my local network than it should be the third (for sake of example: 11.9.8.7).
than i used
wsl --list --verbose
to list wsl2 installation that i had, i had one called Debian
(correspond to debian installed from windows store)
than i applied the below command in Debian Shell (thanks goes to 1)
# | steps | explanations |
---|---|---|
1 | cd /etc |
go to etc folder in WSL |
2 | echo "[network]" | sudo tee wsl.conf |
Create wsl.conf file and add the first line. |
3 | echo "generateResolvConf = false" | sudo tee -a wsl.conf |
Append wsl.conf the next line. |
4 | wsl --terminate Debian |
Terminate WSL in Windows cmd. |
5 | cd ~/../../etc |
go to etc folder in WSL |
6 | echo "nameserver 11.9.8.7" | sudo tee resolv.conf |
Create or override resolv.conf and append the line. |
7 | wsl --terminate Debian |
Terminate WSL in Windows cmd. |
N.B: sometime file creation won't work (it happened for me for /etc/resolv.conf
), you can just created under a user directory and move it to another folder