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

How can I change the DNS server IP address in Windows XP from command line? I don't want to do it from UI every time I need since it requires a lot clicks.

share|improve this question
up vote 3 down vote accepted

In a command prompt:

netsh interface ip set dns "local area connection" static

You can list the interfaces on your PC using:

netsh interface ip show interfaces

share|improve this answer

FYI, You can update both the primary and secondary dns servers by using the following commands

netsh interface ip set dns name="Local Area Connection" source=static addr= register=PRIMARY
netsh interface ip add dns name="Local Area Connection" addr= index=2
share|improve this answer
@Aaron I think second command has syntax error, index is not recognized in XP – erdogany Apr 7 '10 at 6:57
@erdogany Really? That might be an XP thing because i just ran it on windows 2003 and it worked. – Aaron Carlson Jul 16 '10 at 21:25
Actually it works, take note that the 2nd one is add dns not set dns. I had the same problem earlier using set dns and it complaint that index is not a valid argument – faulty May 21 '12 at 2:56

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.