When moving from site to site, it is often necessary to switch between static IP addressing and
DHCP.
This used to be a real pain.
Using the NETSH command on my Windows 2000 laptop, I script it, without the need to even restart.
To implement this technique, determine what adapters / IP addresses you currently have by typing:
NETSH interface ip show ipaddress
If you have 2 NICs, the result would look something like:
MIB-II IP Address Entry IP Address Mask BC Fmt Reasm Sz Interface --------------- --------------- ------ -------- ----------------------- 127.0.0.1 255.0.0.0 1 65535 Loopback 192.168.0.50 255.255.255.0 1 65535 Local Area Connection 216.144.1.126 255.255.254.0 1 65535 InternetNOTE: The RemoteAccess service must be started. If it is Disabled, set it to Manual or Automatic. Then type net start remoteaccess.
To switch the Local Area Connection to DHCP, type:
netsh interface ip set address "Local Area Connection" dhcp
To change the Local Area Connection to a static ip address, type:
netsh interface ip set address "Local Area Connection" static <ipaddr> <subnetmask>
netsh interface ip set address "Local Area Connection" gateway = <gateway> gwmetric = <metric>
where:
<ipaddr> is the ip address.
<subnetmask> is the subnet mask.
<gateway> is the default gateway.
<metric> is the metric.
To change the Local Area Connection to 192.168.0.50, subnet mask 255.255.255.0, default gateway 192.168.0.1 and a metric of 1, type:
netsh interface ip set address "Local Area Connection" static 192.168.0.50 255.255.255.0
netsh interface ip set address "Local Area Connection" gasteway = 192.168.0.1 gwmetric = 1
NOTE: Type netsh interface ip dump to see the settings of a configured PC.