Friday, May 27, 2011

Change IP address

C:\>netsh int ip set addr local dhcp
C:\>netsh int ip set addr NIC1 static 192.168.1.10 255.255.255.0 192.168.1.1 1
C:\>netsh int ip set addr "Local Area Connection 5" dhcp

The first one works if the connection you want to configure is "Local Area Connection," and they may also work if you have "Local Area Connection 2," but no others. If you're going to use this command on your own PCs with multiple NICs, it'd be better to rename your connections to "NIC1," "NIC2," etc, in which case you can use the second example. If you have multiple "Local Area Connections," you'll have to use the third one with the quotes.

Also note with the static address definition, it should be obvious that the format is IP[space]netmask[space]gateway, but you may not have noticed the [space]gateway metric at the end. To be perfectly honest, I don't even know what this means; just put a 1.

No comments:

Post a Comment