Contact Us We Proudly Sponsor:  Buzz Robotics 

413 944 0009

Offsider Blog: How to change Windows IP Addresses or DNS servers from the command line.

Nathan Pearce

This is NOT a
It's 2023, so we manage everything via GUI right?  Wrong.  Interestingly enough, in the same way that computers have gone from Mainframe to Client to Cloud, command of computers has gone full circle from command line interfaces only, to GUI Administration only, back to the command line being one of the most powerful adminstrative tools we have today to automate change in your environments.

So, as I sit here studying up on my technology history in order to be better prepared for an interview, I found this GEM of knowledge and I wanted to share it.

Changing your IP information on Windows via the Command Line utilizes the netsh command.

Two (or three) uses of the command can often get the job done. One to edit the IP address, subnet mask, and default gateway and another for your DNS server settings.

In order to change your IP address we use the netsh command, you need to know your interface name that Windows is referring to.

You can use either:

ipconfig /all

or

netsh interface show interface

Once you have the interface name, proceed with making your change via an administrative command prompt!

netsh interface ip set address ”SuperDuper Ethernet” static 192.168.0.10 255.255.255.0 192.168.0.1 

You might, however, be wondering how you can go from using an already set static IP address to getting an address via  DHCP.  In the above command, the source= section is implied,  In this case the command you are looking for is:

netsh interface ip set address ”SuperDuper Ethernet” dhcp
You can also use name= at the start of the interface name to specify it in the command.

As far as DNS goes you only have two settings to set, a primary DNS server as well as a secondary one if you require it. The command to set them is almost identical, to set your primary DNS server you will want to use: 

netsh interface ip set dns ”SuperDuper Ethernet” static 1.1.1.1

To change the IP address of the secondary DNS server you will need to specify the index parameter: 

netsh interface ip add dns ”SuperDuper Ethernet” 9.9.9.9 index=2 

Note the add instead of set and the index=2 at the end.  This will only work if you've elected to specify static DNS servers and have already configured your first server! 

netsh interface ip set dns "SuperDuper Ethernet" dhcp

Will, just as the IP address command mentioned previously, set the source of your DNS servers to DHCP.

A few great DNS Servers are:

1.1.1.1 = CloudFlare's DNS Servers.
1.0.0.1 = CloudFlare Backup to 1.1.1.1
1.1.1.2 = CloudFlare DNS for Families (No Malware)
1.1.1.3 = CloudFlare DNS for Families (No Malware or Adult Content)

4.2.2.1
4.2.2.2
4.2.2.3
4.2.2.4 = Level3's DNS services, typically highly reliable, but have become outpaced by newer competition.

8.8.8.8 = Google DNS
8.8.4.4 = Google Secondary DNS

9.9.9.9 = Quad9 DNS
9.9.9.10 = Quad9 with no blocking
149.112.112.112 = Quad9 Secondary

208.67.222.222
208.67.220.220 = OpenDNS

Stay away from:
8.26.56.26 & 8.20.247.20  - These are Comodo masquerading as a lovely secure company, "NuSEC".
Comodo have a horrid trust history, I would not trust them!

Finally, if you want faster internet, look into testing what DNS servers are fastest from your home!  The faster you perform the lookup of where you are going, the faster you will get there.  You can try https://www.dnsperf.com/dns-resolver/    or you can head to the wonderful Steve Gibson's GRC site for the definitive DNS Benchmark application to run inside your own network!

GRC's | DNS Nameserver Performance Benchmark

A unique, comprehensive, accurate & free Windows (and Linux/Wine) utility to determine the exact performance of local and remote DNS nameservers

I hope this blog helps someone out there. If it does, feel free to drop me a line at IP Address & DNS via CMD to say thanks!

That’s all the command line magic you are going to need to impress some of your friends, so what are you waiting for ?