eSecureData Inc.

×
×

Change IP Address in Windows via Command Prompt

Back

Problem
Change or set to static an IP Address of an interface in Windows via netsh command in Command Prompt.

tl;dr

To see a list of interfaces:

netsh interface show interface

To set/change an address:

netsh interface ip set address "Ethernet" static 10.0.0.100 255.255.0.0 10.0.0.1 1

Where "Ethernet" is the name of the interface, 10.0.0.100 is the IP address, 255.255.0.0 is the subnet mask, and 10.0.0.1 is the default gateway.

Solution

In Windows, you can use the netsh command to edit network interfaces. To see a list of network interfaces on your system (including copies or disabled adapters), type in the following:

netsh interface show interface

To see a list of NICs with their configured network settings, type in the command below:

netsh interface ip show config

To set a static IP, run the netsh command with the following format:

netsh interface ip set address "ifname in quotes" static ipaddr subnetmask gateway metric

So, for example, if you need to set the IP address on Local Area Connection 3 to 10.0.0.100 (with a /16 subnet mask and a 10.0.0.1 default gateway), you would enter the following:

netsh interface ip set address "Local Area Connection 3" static 10.0.0.100 255.255.0.0 10.0.0.1 1

If you are setting a static IP for the first time, you will also need to configure a DNS server:

netsh interface ipv4 add dnsserver "Local Area Connection 3" address=8.8.8.8 index=1

To change the connection back to DHCP, run the following:

netsh interface ip set address "Local Area Connection 3" dhcp

Author

Vlad Dzhabarov

Was this article helpful?
Dislike17 Like44
Views: 99107