Take the 2-minute tour ×
Server Fault is a question and answer site for professional 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
add comment

1 Answer 1

up vote 1 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
2  
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
    
I never noticed that. Adding it to answer. Thanks. –  Mechaflash Oct 9 '12 at 13:03
add comment

Your Answer

 
discard

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.