Multiple Network Configurations with Windows XP
When using a networked laptop, you often you want to change network configurations. For example, you'll probably have a different configuration at home from the one at the office. Windows XP has facilities to allow you to maintain multiple configurations, but they are very badly designed, poorly documented, buggy and hard to use. This note is partly based on an old version of Wayne Maples' page, with some of my own notes added.
The recommended method is to use a main configuration and an alternate configuration. You find these options in Settings|Network Connections|some adapter|TCP/IP|Properties, but they only show up if you choose "Obtain an IP address automatically"; (which is Microsoft's way of saying "Use DHCP").
This scheme only works if one of your sites uses DHCP, and the other one uses static IP addresses, and even then it's irritating: on the static IP site, you'll have to wait 60 seconds for the DHCP method to fail before the fallback to the static IP happens.
Publicity for Windows XP mentions that it includes support for "Network Location Awareness". Some web sites guessed from the name and the incredibly uninformative Microsoft description that this was a facility which would automatically configure your network as you moved your laptop from place to place. That would be really useful, but that's not what NLD does. I'm not sure exactly what it does do, but I think it's a mechanism to allow programs to be told whenever you make changes to your network configuration, not a method to actually make the changes for you.
I found a description of a method using the administrator's NETSH utility for Windows 2000 on an old Win2K version of Wayne Maples' web page that works (with some modifications) for me in Win XP. NETSH is a very powerful utility for setting the configuration of your system. Be careful using it; you can mess up your installation very easily. Here are the details that worked for me in Windows XP Professional. I've got no idea if they work in any other versions.
a) You use the program NETSH.EXE, which is normally installed in the directory c:\windows\system32. You must be logged on with administrator rights to use it, or use "Run as..." on the right mouse button to run it as an administrator.
b) NETSH.EXE requires a library called framedyn.dll that's in the c:\windows\system32\wbem directory. That's probably not on your path; the easiest thing to do is to copy the framedyn.dll file up into the c:\windows\system32 directory.
c) The easiest way to use NETSH is to create a script of commands for it. Set up your networking using the usual method with Settings|Network Connections|some adapter|TCP/IP|Properties, then open a command window (as an administrator), and run
netsh interface ip dump >config.txt
Now with older versions of NETSH, you may need to edit the config.txt file. Those versions NETSH have a bug, and create a file which they can't read. The problem is that NETSH puts "register=PRIMARY"; on the lines defining your DNS servers, e.g.
set dns name="Local Area Connection" source=static addr=18.104.22.168 register=PRIMARY
add dns name="Local Area Connection" addr=22.214.171.124 register=PRIMARY
but those older versions of NETSH can't handle this. So, if you find you have an error when you follow the instructions below, delete register=PRIMARY, so the lines look like this:
set dns name="Local Area Connection" source=static addr=126.96.36.199
add dns name="Local Area Connection" addr=188.8.131.52Don't do this deletion unless you get an error below, or you may not get your connection configured properly. (Thanks to Sikamena Siyumbwa for this update.)
d) Now create a shortcut to execute the script. The command on the shortcut should be
c:\windows\system32\netsh -f drive:\path\to\config.txt
e) Set up your machine for a different location, and repeat steps c) and d), saving the configuration in a different file.
f) Now, to switch to the new location, just run the shortcut (as administrator).
Last modified 24 April 2009
Back to home page