How to configure DNS on Windows with multiple NICs?

I have two network adapters on my PC each connected to a different network (one LAN and one Wireless). I set up routing tables to have some of the addresses routed to the LAN and others to the Wireless, but I'm having problems with the DNS configuration. I'd like the DNS lookup to first try the default DNS for the LAN and then if there was no match, try the default DNS for the wireless.

The problem is that DNS servers (and hence their order) are defined per network connection. I can't figure out which of the DNS's are used when I try to i.e. ping a server by name.

Is there a concept of a primary network adapter?

Can I create or manage a global list of DNS servers without regard to the adapter?


Solution 1:

You can prioritize one adapter over another. Read through this article for how to do it.

However, when you say "I'd like the DNS lookup to first try the default DNS for the LAN and then if there was no match, try the default DNS for the wireless.", that is not going to work. Your LAN DNS Server, if available, will either resolve the name for you, answer that the name does not exist, or refer you to another DNS server. While you might think that the third option would be your ticket, understand that the DNS resolver in Windows (an most other systems) is a stub resolver that can not follow referrals, and so your DNS query will fail at that point.

If what you truly want is to get the internal IP adresses of your systems when you are connected through your LAN, and external resolved addresses when connected outside, or in general for any external names. This can be achieved by setting up split DNS on your LAN DNS server.

Solution 2:

Due to the metric of the connection, a DNS lookup should always pick LAN over WLAN. As long as the routing table is showing a lower metric for the LAN connection than the WLAN, it should be working the way you want.

If you need to verify your metrics per connection, you should be able to look at the IP address in the interface column to get the corresponding metric. Physical interfaces should have the same metric for all entries. Virtual interfaces (and loopback) will gave different metrics based on the physical connection they are using for the given entry. (This KB article explains how the Automatic Metrics are assigned.)

If you want to ensure a specific order to the DNS servers, you can define a prefered order list at "Connection Properties>Internet Protocol(TCP/IP) Properties>Advanced>DNS". This list will need to be defined on each connection.