Change IP or DNS value in Windows from the Command Line

It was fun to see people complaining about slow internet (because of Mauritius Telecom) on Facebook today. It was even more fun watching geeks screaming change your DNS to google (8.8.8.8 or 8.8.4.4) and providing long instructions to achieve that. While I’m not a Windows guru and I don’t want to be one either … it hurts my soul though to see those screenshots or procedures to go through just to get a DNS change!

So … I had to mingle a bit on the Windows VM to find a faster way.

It took just a couple of minutes with the help of google :-)

To change your DNS to 8.8.8.8 you just have to execute the below line in Command Prompt or simply Start > Run and ‘run’ it.

netsh interface ip set dns “Local Area Connection” static 8.8.8.8  

To get your NIC to automatically obtain DNS settings :

netsh interface ip set dns “Local Area Connection” dhcp  

To get your NIC to automatically obtain IP from a DHCP server :

netsh interface ip set address “Local Area Connection” dhcp  

Finally to configure your IP address and other TCP/IP related settings :

netsh interface ip set address name=”Local Area Connection” static 192.168.0.10 255.255.255.0 192.168.0.1 1  

Note: The IP/DNS addresses I used are as examples only.


Share this post