Do you use your laptop in different network environments? At home? In the office? At a customers site?
If yes, the small package "netenv" might be useful for you. When booting your laptop it provides you with a simple interface from which you can choose the current network environment. The first time in a new environment, you can enter the basic data and save it for later reuse.
Netenv sets up a file containing variable assignments which describe the current environment. This can be used by the PCMCIA setup scheme, e.g. like the one that comes with Debian/GNU Linux and perhaps others.
The netenv data can be used for things like:
Network Device: Configure the network device for different environments.
Choose a proper XF86Config
: Think of using your
laptop standalone with touchpad vs. connected to a CRT monitor along
with an external mouse. For example, a wheel mouse could be used when
docked, but the driver is not compatible with the normal trackpoint or
touchpad.
Windowmanager: You can set up your windowmanager appropriate to the current location of your machine.
Printing Environment: The netenv data can easily be used to set up the printing environment.
Netenv is available at netenv home. It depends on dialog(1) for its menu interface. Netenv was developed by Gerd Bavendiek.
SuSE's System Configuration Profile Management - SCPM software allows you to switch configuration profiles. You can boot directly into one profile and then switch to another profile at run time. This is the successor of SuSE's older "scheme" management software.
ifplugd is a lightweight Linux daemon which configures the network automatically when a cable is plugged in and deconfigures it when the cable is pulled. It is primarily intended for usage with laptops. It relies on the distribution's native network configuration subsystem, and is thus not very intrusive.
divine is an utility for people who use their machines in different networks all the time. "The idea is this:
you describe the possible networks in /etc/divine.conf, including one or more machines that are probably up (routers and NIS servers come to mind).
at boot time, you run divine.
divine starts a thread that injects fake arp requests into the network. The thread will try again up to three times, pausing 1 second between retries. If the last try times out again, the thread will print an error message, leave the interface in the original state and exit cleanly.
the main thread just looks for arp replies and exits if one is found.
You have one resolv.conf
per network, for example
/etc/resolv.conf.default
and
/etc/resolv.conf.work
. divine
will symlink one of them to /etc/resolv.conf
for
you.
You can specify a proxy server plus port and divine
will write the proxy server to
/etc/proxy
. This can be evaluated
inside your shell startup script, like this (zsh):
export http_proxy="http://`</etc/proxy`/"
The included perl script edit-netscape-proxy.pl will edit the proxy settings in your Netscape 4 preferences file.
You can even specify an additional script to be run for each selection.
You can use this to edit /etc/printcap
or
/etc/issue
or do something else I forgot.
The point about divine in contrast to other solutions is that other solutions normally use ping or something like that. divine can check a large number of networks instantaneously, assuming that the machines you ping answer within one second (.4 seconds are normal on Ethernets). And pinging an unknown address will do an arp request anyway, so why not do an arp request in the first place?"
From the Networking-HOWTO : "The term IP Mobility describes the ability of a host that is able to move its network connection from one point on the Internet to another without changing its IP address or losing connectivity. Usually when an IP host changes its point of connectivity it must also change its IP address. IP Mobility overcomes this problem by allocating a fixed IP address to the mobile host and using IP encapsulation (tunneling) with automatic routing to ensure that datagrams destined for it are routed to the actual IP address it is currently using."
Dynamics Mobile IP is a dynamical, hierarchical Mobile IP system for Linux operating system. The implementation enables a hierarchical model for IP mobility, thus decreasing the location update times as a mobile host moves. Dynamics system has been designed Wireless LAN technology in mind, and the system has optimized functionality for mobility in WLAN.
See also Linux and Mobile AdHoc Networks - MANETs.
Linux Mobile IP from HP Labs Bristol by Manuel Rodriguez.
Sources: Kenneth E. Harker and Dag Brattli
DHCP and BootP are also useful for working in different environments. Please see the DHCP-HOWTO .
The pppd command can be configured via several different files: pppd file /etc/ppp/<your_options> .
You may even choose to do your configuration by editing the
/etc/init.d
files manually.
How can I have separate PCMCIA device setups for home and work? This is fairly easy using PCMCIA scheme support. Use two configuration schemes, called home and work. For details please read the appropriate chapter in the PCMCIA-HOWTO.
From Martin J. Evans I have taken this recommendation: The first point to note is that init will take any arguments of the form name=value as environment variable assignments if they are not recognized as something else. This means you can set environment variables from the LILO boot prompt before your rc scripts run. I set the LOCATION environment variable depending on where I am when I boot Linux. e.g.
LILO: linux LOCATION=home
Or
LILO: linux LOCATION=work
Or simply
LILO: linux
where failing to set LOCATION means the same as
LOCATION=home (i.e. my default). Instead of typing
LOCATION=place each time you boot you can add an
entry to your /etc/lilo.conf
file and use the
append instruction. e.g.
# Linux bootable partition for booting Linux at home # image = /vmlinuz root = /dev/hda3 label = linux read-only # Linux bootable partition config ends # # Linux bootable partition for booting Linux at work # image = /vmlinuz root = /dev/hda3 label = work read-only append="LOCATION=work" # Linux bootable partition config ends
With the example above you can use "linux" for booting at home and "work" for booting at work.
Armed with the facility above, you can now edit the relevant rc scripts to test ENVIRONMENT before running ifconfig, setting up route etc.
There are several other bootloaders which are often overlooked. Besides LILO, have a look at loadlin, CHooseOS (CHOS) (not GPL), GRand Unified Bootloader (GRUB), System Commander and take a look at ftp://metalab.unc.edu/pub/Linux/system/boot/loaders/ . The MicroSoft Windows-NT boot loader or OS/2 boot loader may even be used.
From Steve <steve_AT_cygnet.co.uk> I got a configuration for X Windows with an external monitor: Note that I have introduced a neat trick! For my nice 17" monitor I start X11 with no options and get the default 16-bit 1152x864 display - but when using the LCD screen I specify a 15-bit display (startx -- -bpp 15) and get the correct 800x600 resolution automatically. This saves having to have two X11 config files.
Using a Laptop in Different Environments by Gerd Bavendiek . This article appeared in the August, 1997 issue of the Linux Gazette . This is an excellent, short technical article describing an easy way to setup your Linux notebook to boot into different network and printing configurations, especially useful for those who use their machines at home as well as other locations such as in the office, at school, or at a customer site.