Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

On a win32 multiple nic computer, how to force DNS resolving through gethostbyname() on a specific nic if all nics have different DNS configured and have the same metric ?

Otherwise, how to know which DNS will be used to resolve names each time a gethostbyname() call will be performed by the application ?

share|improve this question

I don't believe you can. Windows will choose the DNS servers assigned to the most preferred "up" interface. However, you can change the order of interface preference. In XP (and probably 2003):

  1. Open Control Panel.
  2. Open Network Connections.
  3. Go to the Advanced menu and choose Advanced Settings.

You will see a list of all interfaces (real or virtual) on the computer, and you can rearrange them however you wish.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.