Re: switching between two network configurations
Am Die, 2002-12-10 um 11.54 schrieb Jörg Johannes:
> With my laptop, I'd like to access two different networks (depending on
> where I am): My home network and university network.
> At home, my IP is 192.168.0.99 and hostname shold be "horchloeffel", at
> university the IP and hostname are set to other fixed values. What I'd
> like to do is choosing at boot-time which network configuration to load.
> Is it possible to write a shell script that is invoked by a lilo
I've never tried that with Debian but with SuSE every kernel-parameter
is send as a parameter (dunno which $x) to all rc-scripts.
So in theory you can edit /etc/init.d/networks to parse "$*". And if
"$*" contains "uni" or something like that, it sets up the hostname and
IP with respect to the parameter.
Also when using PCMCIA network cards switching between two or more
network setups is *very* easy.
Have a look at /etc/pcmcia/network.opts and to a man cardctl (look for
If network.opts is set up correctly you can switch your network
environment as easy as "cardctl scheme $NAME_OF_ENVIRONMENT".
> It would have to set the hostname, the nameservers and the IP
> adress according to predefined values (should be simple to write two
> configurations, say /etc/hostname.uni and /etc/hostname.home, one of
> which is copied to /etc/hostname and so on).
> Is this possible, or are there other (better) solutions for doing this task?
Yes: cardctl, see above (but only if you use PCMCIA).
[www.hentges.net] -> PGP + HTML are welcome
ICQ: 97 26 97 4 -> No files, no URLs
My OS: Debian Woody: Geek by Nature, Linux by Choice