Have you ever noticed that, sometimes when you’re on DHCP, you can have more than 2 DNS addresses? Perhaps you have a need to set 3 or 4 – or maybe, you need to set your primary and secondary DNS servers statically through command line. Well, don’t you worry, there’s a command to do just that.
Even if your primary is already set, I’ve had the best luck setting it again, then setting your secondary DNS. For this example, I’m going to use Google’s well known public DNS servers, but you can use your own internal IP addresses, your ISP’s DNS servers, OpenDNS, whatever works for you. Simply open a command prompt, and enter the following commands.
This first command sets your primary DNS server:
netsh interface ip set dns "Local Area Connection" static 220.127.116.11
Here, we set the secondary:
netsh interface ip add dns name="Local Area Connection" addr="18.104.22.168" index=2
If you need to set a third, fourth, and so on, all you need to do is change the index number at the end of the line:
netsh interface ip add dns name="Local Area Connection" addr="22.214.171.124" index=3
netsh interface ip add dns name="Local Area Connection" addr="126.96.36.199" index=4
To verify the settings took, you can check your DNS settings with a quick command of ipconfig /all and check how many and what DNS servers you are showing. If you show a strange hexadecimal value, try resetting the primary DNS entry with the different command at the top again, then the second, third, and so-on…