Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

In Windows XP, how do you change the secondary DNS server on a network adapter via the command line?

share|improve this question

closed as off-topic by kasperd, Andrew Schulman, gtirloni, Dave M, MadHatter Sep 28 at 20:47

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions must be relevant to professional system administration. Server Fault is dedicated to professional system and network administrators. End user and enthusiast questions are off-topic (contact your system administrator or hire a professional to help you out). Please see the Help Center for more information." – kasperd, Andrew Schulman, gtirloni, Dave M, MadHatter
If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer 1

up vote 2 down vote accepted

IN Windows XP, in order to change the secondary DNS server, you have to add it via cmd

netsh interface ip add dns

If a secondary DNS server already exists, it must first be removed before adding the new one. Again in cmd

netsh interface ip delete dns "[connection name]" [old DNS ip address]

replace [connection name] with the name of the network adapter (i.e. "Local Area Connection")
replace [old DNS ip address] with the I.P. address for the secondary DNS server to remove

To add the secondary DNS setting, use the following command:

netsh interface ip add dns "[connection name]" [ip for secondary DNS] INDEX=2

replace [connection name] with the name of the network adapter (i.e. "Local Area Connection")
replace [ip for secondary DNS] with the I.P. address for the secondary DNS server

Note that you can use an alternative method when you only need to change the primary DNS that is faster

netsh interface ip set dns "[connection name]" static [ip for primary DNS]
share|improve this answer
3  
That will insert the DNS server at the given index, moving an existing entry to index 3. To change the secondary server you have to remove the existing entry before adding the new one: netsh int ip delete dns "[connection name]" [old ip]. And you can use the exact same syntax for changing the primary DNS server. Just set index=1. –  Ansgar Wiechers Oct 8 '12 at 22:08
1  
I never noticed that. Adding it to answer. Thanks. –  Mechaflash Oct 9 '12 at 13:03
    
INDEX=2 is not valid parameter in windows xp –  user245059 Sep 25 at 20:29

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