Friday, March 30, 2012

Configure Windows IP Addressing from Command Prompt

For reference, because I have a mental block about remembering this:


netsh interface ipv4 set dnsservers "Local Area Connection" static 8.8.8.8 primary
netsh interface ipv4 set address "Local Area Connection" static 1.1.1.2 255.255.255.0 1.1.1.1


netsh interface ipv4 set address "Local Area Connection" source=dhcp

3 comments:

HÃ¥vard Staub Nyhus said...

Tip:
Rename your network connection in windows to something simpler to type, like "lan" or "eth0"

Unknown said...

Try putting it in a batch file in one of your %path% folders (C:\Windows\system32), except with parameters.

setip.bat:
@echo off
netsh interface ipv4 set address "Local Area Connection" static %1 %2 %3

setdhcp.bat:
@echo off
netsh interface ipv4 set address "Local Area Connection" source=dhcp

Then call from an admin prompt:
setip.bat 10.10.10.10 255.255.255.0 10.10.10.254

Jay Swan said...

Aaron, thanks for the tip!