Friday, November 21, 2008

IP switcher

As a manager of a national IP network I find myself constantly changing static IP addresses on my windows XP laptop. Commercial profile managers and switching utilities are available. You can instead just write a simple batch file to configure your network interface.

Here are two that I just created.


rpghome.bat

netsh interface ip set address name="Local Area Connection" source=static addr=192.168.9.8 mask=255.255.255.0

netsh interface ip set address name="Local Area Connection" gateway=192.168.9.1 gwmetric=1
netsh interface ip set dns name="Local Area Connection" source=static addr=217.22.80.10 register=PRIMARY
netsh interface ip add dns name="Local Area Connection" addr=217.22.95.10 index=2
netsh interface ip set wins name="Local Area Connection" source=static addr=none

rpgdhcp.bat

netsh interface ip set address name="Local Area Connection" source=dhcp
netsh interface ip set dns name="Local Area Connection" source=dhcp register=PRIMARY
netsh interface ip set wins name="Local Area Connection" source=dhcp