Windows – Make sure Windows always uses VPN provided DNS servers

domain-name-systemopenvpnwindows

I have a VPN server and it provides DNS in the remote network to the clients.

Under Windows the DNS settings get updated automatically, however the old, local DNS server seems to remain in the config of the physical interface when I display it with ipconfig /all

Now the OpenVPN supposed to give only access to the remote site network and not route all traffic through it. However as I use local domains there for different Webserver vHosts, the remote DNS supposed to be used when VPN is active and not the local.

Under Linux I can make sure that the remote DNS is used (it has access to the internet too and can also resolve normal addresses), by just setting it into the resolv.conf as the first entry. On Windows however it seems the System always asks the local DNS first and when that one answers "I don't know that domain" (which it doesn't because it only exists in the remote network), the Browser stops bothering and tells that the site can not be found. Using nslookup remotesite.dns 10.0.42.1 I get the correct IP number in the remote network.

How can I make sure that when VPN connection is up, ALWAYS the DNS the VPN-Server pushed to the client is used and NOT the local one anymore?

Best Answer

According this forum entry you can change metric for local network interface, set it higher then metric on VPN adapter(tun or tap). That will force Windows to send requests to remote DNS.