Quickly Configure DNS Server IPs From Windows Command Prompt

The common way to set IP addresses for primary and secondary DNS  servers in Windows is through Network and Sharing Center > Change Adapter Settings followed by selecting “Properties” of the specific adapter and then configuring IP settings.

Common way of modifying properties of network connections in Windows

All of the above can be done through just two lines from Windows command prompt. Suppose DNS server IPs to be set are 208.67.220.220 and 208.67.222.222 (these are OpenDNS IPs, here is the related post on that), then to do this :

Open Windows command prompt as and administrator (Right click and select “Run as administrator” for Accessories > Command prompt).

Open Windows command prompt as administrator

then enter the following :

netsh interface ip set dns name="Local Area Connection" static 208.67.220.220

This will set the IP address of primary DNS server as 208.67.220.220.

To set the secondary DNS IP :

netsh interface ip add dns name="Local Area Connection" 208.67.222.222 index=2

Setting DNS server IP addresses through Windows command prompt

So now, the primary and secondary DNS servers will be having IP addresses : 208.67.220.220 and 208.67.222.222.

Same can be verified through the adapter properties :

Configured DNS server IP addresses

Short and sweet. 🙂

Comments are closed.