A few words of thanks would be greatly appreciated.

Windows - Change IP via the Command Prompt

If you're using a PC running Windows operating system, you can change your IP address via the Command Prompt. You might want to do this for security reasons. We'll show you how to get started in this article.

How To Change Your IP Address via the Command Prompt

Firstly, open the command prompt as administrator:

  • Press the Windows key on your keyboard or click Start to bring up the boot menu.
  • In the search bar, type "cmd".
  • Instead of validating the search, press CTRL + SHIFT + Enter.

To change IP and default gateway

  • netsh int ip set address "local area connection" static 1 

To change DNS:

  • netsh int ip set dns "local area connection" static primary 

This procedure will work, based on the following:

  • The network adapter you're trying to change the IP for named "local area connection". It could also be named as "local area connection 2" or "wireless network connection".
  • Look in your control panel for the correct name
  • The IP you want to set is, change this to whatever IP you want to use.
  • The default gateway and DNS are the same as the IP. Change this to match your network config found with the command ipconfig /all

Thanks to 2xod.com for this tip

Image: © Microsoft.


A few words of thanks would be greatly appreciated.

Ask a question
CCM is a leading international tech website. Our content is written in collaboration with IT experts, under the direction of Jean-François Pillou, founder of CCM.net. CCM reaches more than 50 million unique visitors per month and is available in 11 languages.
This document, titled « Windows - Change IP via the Command Prompt », is available under the Creative Commons license. Any copy, reuse, or modification of the content should be sufficiently credited to CCM (ccm.net).