I read about doing this the way described below someplace, but I have
lost the reference to it so I can't give
credit to the original author.
You will need to change your /etc/lilo.conf file, as well as
renaming files in /etc/sysconfig and /etc/sysconfig/network-scripts.
You should have a good backup before you start changing things
"just in case". If you mess up your system and don't have a way
to get it running again, don't blame me.
(This system dual boots Linux and Windows 98)
What you want to do is add copies of the linux boot information, changing
the "label" line and adding
a line that tells the kernel to setup an environment variable called
LOCATION
that the network setup scripts
will use to figure out which network setup to load. For
example:
image=/boot/vmlinuz-2.2.16-3
label=home
read-only
append="LOCATION=home"
root=/dev/hda3
If you type "home" to the lilo prompt, it will set LOCATION to "home". Here's a copy of the lilo.conf on my laptop.
You should run lilo at this point and make sure your system
still boots correctly.
cd /etc/sysconfig
mv network network-work
mv network-scripts/ifcfg-eth0 network-scripts/ifcfg-eth0-work
Now you need to create new copies of those files that call the renamed ones. For example, here's the /etc/sysconfig/network file from my laptop:
# figure out from the LOCATION env variable what we are supposed to setup
if [ "X$LOCATION" != "X" ]; then
. /etc/sysconfig/network-$LOCATION
else
. /etc/sysconfig/network-work
fi
The new /etc/sysconfig/network-scripts/ifcfg-eth0 is very similar:
# figure out from the LOCATION env variable what setup we use
if [ "X$LOCATION" != "X" ]; then
. /etc/sysconfig/network-scripts/ifcfg-eth0-$LOCATION
else
. /etc/sysconfig/network-scripts/ifcfg-eth0-work
fi
At this point you should reboot your system to make sure it still works the way it is supposed to.
Now all you need to do is setup /etc/sysconfig/network-xyzzy and
/etc/sysconfig/network-scripts/ifcfg-eth0-xyzzy
scripts for each network interface you are
using on your system. On my laptop, I leave the ethernet interface
in it all the time and switch in wireless cards
as needed. The wireless cards are eth1, so I also have
a /etc/sysconfig/network-scripts/ifcfg-eth1-xyzzy file to control
that interface.
The lilo.conf file...
/etc/lilo.conf
The network files...
/etc/sysconfig/network
/etc/sysconfig/network-work
/etc/sysconfig/network-home
/etc/sysconfig/network-wl
/etc/sysconfig/network-nonet
The ifcfg-eth* files...
/etc/sysconfig/network-scripts/ifcfg-eth0
/etc/sysconfig/network-scripts/ifcfg-eth1
The setup for work. Boots using the ethernet interface using a
static address
/etc/sysconfig/network-scripts/ifcfg-eth0-work
/etc/sysconfig/network-scripts/ifcfg-eth1-work
The setup for home. Boots using the ethernet interface and uses
DHCP to get an address
etc/sysconfig/network-scripts/ifcfg-eth0-home
/etc/sysconfig/network-scripts/ifcfg-eth1-home
The wireless setup. Boots using the wireless card (eth1)
and uses DHCP to get an address
/etc/sysconfig/network-scripts/ifcfg-eth0-wl
/etc/sysconfig/network-scripts/ifcfg-eth1-wl
Boot with no networking setup
(There are no ifcfg-eth* files in this setup)