Set A Static IP Address On Windows 7 From The Command Line

Windows has traditionally been all about the GUI. However, in Windows 7 it’s possible to set a static IP address from the command line. Here’s how to do it.

Let’s say you want to give your Windows 7 system an IP address of, a subnet mask of, a default gateway of, and a DNS server address of Go to an elevated command prompt (right-click on the command prompt icon and select Run As Administrator) and type these two commands:

netsh interface ipv4 set address “local area connection” static

netsh interface ipv set dnsservers “local area connection” static

These commands will configure the Local Area Connection with a static IP, netmask, gateway, and DNS server.

If you want to switch back to receiving your networking settings from a DHCP server, use these commands:

netsh interface ipv4 set address name=”local area connection” source=dhcp

netsh interface ipv4 set dnsservers name=”local area connection” source=dhcp

This will set the Local Area Connection back to using DHCP.


This entry was posted in Windows. Bookmark the permalink.