Yesterday I installed the new cool Windows feature “Linux Subsystem for Windows” on my work laptop with VPN. After the installation I concluded that my DNS wasn’t working in the subsystem.
First i checked my DNS Settings in the subsystem.
Change the DNS Resolvers in Linux (in my case Ubuntu).
1 2 3 4 5 6 |
sudo rm /etc/resolv.conf sudo nano /etc/resolv.conf search ***.local nameserver **** nameserver **** |
Lock resolv.conf, so it won’t be re-created after launching again.
1 2 |
sudo chmod 444 /etc/resolv.conf sudo chattr +i /etc/resolv.conf |
Still no DNS in my subsystem.
After Googling a while I saw a post about VPN connections on the host system which can cause problems. Doing some bigger digging I found a command which solved my DNS Problems in combination with the Cisco anyconnect VPN client. The command actually change the adapter metrics. In my case the metrics where the problem, each time I connect it run this script automatically. Don’t know if this is the case with other VPN clients to..
1 2 |
$VPNClientInterfaceName = "Cisco AnyConnect" Get-NetAdapter | Where-Object {$_.InterfaceDescription -Match $VPNClientInterfaceName} | Set-NetIPInterface -InterfaceMetric 6000 |