Windows - Change IP via the command prompt

December 2016





Issue

How to change the IP address via the command prompt?

Solution

  • First 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 192.168.0.101 255.255.255.0 192.168.0.254 1 
  • To change DNS:
    • netsh int ip set dns "local area connection" static 192.168.0.254 primary 
  • This procedure will work, assuming that:
    • 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 192.168.0.101, 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

Related :

This document entitled « Windows - Change IP via the command prompt » from CCM (ccm.net) is made available under the Creative Commons license. You can copy, modify copies of this page, under the conditions stipulated by the license, as this note appears clearly.