Jan-Pascal van Best
 
  Location-Dependent Network Settings for Windows 95
 
Contents
  Home
PhD thesis
Research
Publications
Software
Private
Crypto
Private stuff
  Private page
Win'95 Networks
Terry Pratchett
Tolkien
Yanoff Java conduit
Denemo Windows binaries
What's this?

This page describes how to set up a multiboot environment for your laptop, so that network properties like IP address, DNS settings, NT domain, computer name etc. can be set at boot time.
Warning
Use at your own risk. The steps descibed here work for me, they may not work for you. In fact, they may cause your hard drive to crash, your Windows to refuse to start, your network cables to melt, your monitor to explode and your hair to fall out. Back up your hard drive first. Make sure you know what you are doing. No guarantees. Wear glasses. Use the right shampoo.
Introduction

At the moment (note: this was written in October 1998), I live in the Shugakuin International House in Kyoto, Japan. I own a Toshiba laptop, model Satellite 300CDT, which I use both in the International House and in the Kyoto University Hospital, department of Medical Informatics. My girlfriend Ellen Jagtman also uses a laptop, an Acer Extensa 390CX. Hers is also used in the International House, as well as at the department of Civil Engineering of Kyoto University.

At the dept. of Medical Informatics, I have a direct Internet connection with a static IP address. I use Windows Networking, the workgroup is Ae-room (whatever that means). At the faculty of Civil Engineering, Ellens laptop is connected to a local network and logs on to an NT domain. She gets her IP address etc. from a DHCP server. The local network is connected to the Internet by means of a proxy server at 192.168.1.2. At home, we use a local IP network. We sometimes connect to the Internet with a dial-up connection from Ellen's laptop. Then we run a proxy server on Ellen's computer (WinGate) to allow us to surf from both machines at the same time. The following table summarizes this setup:
 

  Jan-Pascal (MI) Jan-Pascal (IH) Ellen (CE) Ellen (IH)
IP-address 130.54.68.223/24 192.168.1.4 dynamic (DHCP) 192.168.1.3
Gateway 130.54.68.254 off dynamic off
DNS 130.54.9.242 off dynamic off
Computer name Elliebellie Elliebellie Pinkwin Pinkwin
Workgroup Ae-room Jellep urfac Jellep
NT domain - - urfac -
NT login name - - jagtman -
HTTP Proxy - 192.168.1.3 192.168.1.2 -

Finding where the settings are stored

Everything except the HTTP Proxy is set in the Network Properties dialog (Start/Settings/Configuration Panel/Network). These settings are stored in the registry, a sort of internal Windows 95 database. The registry can be viewed, searched and edited with the regedit program (Start/Execute and type regedit). By the way, have you read the warning? Any changes you make are committed directly (there is no "Save" or "Save As"), so take care. By searching the registry (Edit/Search) for strings like "130.54.68.223", "Ae-room", or "gateway" you can find out where these settings are stored in the registry. In my case, the following registry keys hold the relevant data:
 

Information Registry key
IP address HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Class\NetTrans\0000\IPAddress
IP netmask HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Class\NetTrans\0000\IPMask
Gateway HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Class\NetTrans\0000\DefaultGateway
Enable DNS HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\VxD\MSTCP\EnableDNS
DNS hostname HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\VxD\MSTCP\HostName
DNS domain HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\VxD\MSTCP\Domain
DNS servers HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\VxD\MSTCP\NameServer
Computer name HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\VxD\VNETSUP\ComputerName
Workgroup HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\VxD\VNETSUP\Workgroup
Logon to NT HKEY_LOCAL_MACHINE\Network\Logon\LMLogon
NT Domain HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\VxD\VNETSUP\Workgroup
NT login name HKEY_LOCAL_MACHINE\Network\Logon\username

Please find out for yourself where the relevant settings are stored in your case. Probably, they are stored in about the same places as for me.

We use Netscape Navigator 4.05 as webbrowser. Its preferences are set in the dialog you get when you select Edit/Preferences. These settings are stored in the file prefs.js in the directory C:\Program Files\Netscape\Communicator\default. Please examine this file to see.

Make sure you know exactly where the differences between the two network environments are stored, then proceed to the next step.

Extracting the information

When you select a registry key, you can extract it to a text file by choosing Registry/Export. You will be prompted for the name to save the information to. Please take the time to examine the resulting .reg file. As you will see, it contains all the registry information from the registry-"directory" you selected. If you want, you can delete the lines that are not relevant for your setup. Now, create two sets of .reg files, one set for each network environment. It is convenient, as we will see later, to use a naming system for these files. I used a two-letter code for each environment (MI, IH, and CE), to be used when the registry files are used at boot time. Because we will use them at boot time, it is also handy to make sure that the file names are DOS 8.3 compliant (at most 8 characters, then a dot . and the three-character extension reg). Store these files together in a directory, eg. C:\setup. Also store the two versions of the prefs.js file there. I created to following files:
 

Data source MedInfo file Int. House file
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Class\NetTrans\0000 TCPIP_MI.reg TCPIP_IH.reg
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\VxD\MSTCP MSTCP_MI.reg TCPIP_IH.reg
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\VxD\VNETSUP IDENT_MI.reg IDENT_IH.reg
HKEY_LOCAL_MACHINE\Network\Logon LOGON_MI.reg LOGON_IH.reg
Netscape preferences prefs_MI.reg prefs_IH.reg

Finishing off

Now that all the proper information for both network environments are available, the only thing you have to do is to make sure that the proper settings are used at boot time. For this you have to change the c:\config.sys and c:\autoexec.bat files. At the beginning of config.sys, before anything that is already there, you add something like:

[menu]
menudefault MI,4
menuitem MI,Medical Informatics
menuitem IH,International House

[MI]

[IH]

[common]
REM -- put your original config.sys here --

Here, [menu] indicates the start of a boot menu. menudefault MI,4 means that, if you don't react to the menu within 4 seconds, the MI configuration will be chosen. Next come the two configurations. The first argument to menuitem is the symbolic name, the second is the name that is printed on screen to choose from. Next, the [MI] en [IH] sections are empty. This means that there are no special drivers that need to be loaded for these configurations. It is necessary to include the empty [MI] en [IH] section, you will get an error at boot time if you omit them. Then, the [common] section contains the drivers that have to be loaded for every configuration. In your case, these are all the drivers that were in your original config.sys.

Somewhere in your autoexec.bat (I put it at the end), you add something like the following:

regedit c:\setup\IDENT_%config%.reg
regedit c:\setup\MSTCP_%config%.reg
regedit c:\setup\LOGON_%config%.reg
regedit c:\setup\TCPIP_%config%.reg
copy c:\setup\prefs_%config%.js c:\progra~1\netscape\users\default\prefs.js

The regedit commands insert the proper registry keys into the registry, so that when Windows starts, the proper IP address, DNS settings etc. are used. The %config% refers to the environment variable config, which is set by DOS according to what you choose from the boot menu. The copy command copies the proper Netscape preferences file to its usual place.

Testing

Exit and restart Windows. If everything goes well, you will be offered the choices you entered in the previous step. Use your computer is both environments and see if everything works well.

Feedback

If you are happy to use this information, if you have any questions, if here is a much easier way to achieve this, please let me know at the following address: janpascal(at)vanbest.org.

Sony VAIO customer service

 

Contact Info
Site Questions to: Jan-Pascal van Best Last update: Thu 15 Nov 2007 09:49:44

 

Back home