In Windows XP, how do you change the secondary DNS server on a network adapter via the command line?
Asked
Active
Viewed 4.2k times
1 Answers
6
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]

Anthony Miller
- 457
- 3
- 6
- 19
-
3That 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 08 '12 at 22:08
-
1I never noticed that. Adding it to answer. Thanks. – Anthony Miller Oct 09 '12 at 13:03
-
INDEX=2 is not valid parameter in windows xp – Sep 25 '14 at 20:29