Windows IT Pro is the leading independent community for IT professionals deploying Microsoft Windows server and client applications and technologies.
  
  
  Advanced Search 


Return to article

Windows 2000 lets me change from dynamic to static IP addressing without rebooting my workstation. Our laptop users need to make this change because some of our subnets use static IP, others use DHCP. Is executing the change from within a script possible?
 

A. To make IP address changes from within a script, you can use Win2K's multipurpose Net Shell (Netsh) command. This command provides several functions that relate to viewing and changing IP addressing on a Win2K system. For example, to change a system from static IP addressing to dynamic DHCP-based addressing, open a command prompt and enter the following command:

netsh interface ip set address "<connection name>" dhcp

where connection name is the name of the LAN adapter on which you're making the IP address configuration change. (By default, this adapter is called local area connection, but it might have a different name on machines with multiple LAN adapters or on machines that an administrator has manually renamed.)

To make the reverse change—that is, to change a connection or adapter from DHCP-configured addressing to static addressing—enter the following command:

netsh interface ip set address "<connection name>" static <ip_address>
<netmask< <gateway> <metric>

where ip_address is the static IP address you wish to assign to the connection, netmask is the subnet mask (e.g., 255.255.255.0) associated with the IP address, gateway is the default gateway (if any) on the local IP subnet, and metric is an optional numeric value (e.g., 1, 2) that defines the number of hops to the default gateway (if one exists). For example, to change from DHCP-based addressing to the static IP address 10.1.1.2, mask 255.255.255.0, and gateway 10.1.1.1 (metric 1), you'd enter

netsh interface ip set address "local area connection" 
static 10.1.1.2 255.255.255.0 10.1.1.1 1






Reader Comments

Try this software package from Globesoft.com, called MultiNetwork Manager. It allows for multiple conmfigurations on one NIC, and you can change the TCP/IP settings without a reboot, and very little user intervention.

Sean -November 25, 2002

Is there anyone know how to list my interface name ?I have tried many time but turn out "It is not correct interface name". Thank you.

TonyPai -July 18, 2003

Is there a similar command to convert NT 4 clients? Thx

kstan -September 22, 2003

This article solved my IP-Swithing-problem. Good article, thanks

Avi -November 25, 2003

Great advice. Excellent article.

Mark Spence -March 09, 2004

Good article. Now my only problem is finding out what the "connection name" is. I tried the default "local area connection" and it gives me invalid connection name

nez -April 08, 2004

how i cand changed my ip adress throuh ms dos ommand promt thankksss

saqib -April 08, 2004

is there a way to bind/unbind windows sharing from an adapter? to turn off the netbios over ip for a particular adapter?

daveey -April 21, 2004

is there a way to bind/unbind windows sharing from an adapter? to turn off the netbios over ip for a particular adapter?

daveey -April 21, 2004

Use this command to find out connection names netsh interface ip dump | find /i "ip configuration for"

Anonymous User -July 13, 2005
Windows IT Pro Home Register FAQ for Windows WinInfo News
Europe Edition About Us Contact Us/Customer Service Media Kit Affiliates / Licensing  
SQL Server Magazine Office & SharePoint Pro DevProConnections IT Job Hound
Left-Brain.com Technology Resource Directory asp.netPRO ITTV Windows SuperSite 
 
 Windows IT Pro is a Division of Penton Media Inc.
 © 2009 Penton Media, Inc. Terms of Use | Privacy Statement