I have a laptop, and currently, I like to test out several different network configurations. Between NAT, Bridged and mixed modes, as well as on being on different external networks when my laptop changes between various wireless AP's, base stations, and its own ethernet port, I find that using "ifconfig" manually becomes very tiresome and boring.
I've discovered that there's a quick way to switch between several predefined networks that can be accessed via bootup. Its as simple as this:
startup location=home
The startup batch file, then passes the contents of the command line to coLinux, which then gets passed into the linux operating system. From there, one can parse out the init command line via /proc/cmdline. This can be done as follows (in a bash shell script):
if ~[ ~`cat /proc/cmdline | grep ~"location=home" | wc -l` != 0 ]; then echo Setting up home network <do home network setup here> fi
Oh, the contents of my startup batch file are:
colinux-daemon -t nt kernel=vmlinux ram=64 eth0=tuntap cobd0=root_fs root=/dev/cobd0 ro %*
The %* in the command line allows for the passing of the command line of the script directly to coLinux, which really helps when you want to boot in single-user mode for fsck'ing or debugging (instead of changing the XML file each time you want sinle user mode).
MassTranslated on 25 Dec 2004.
MassTranslated on Sun Apr 23 17:36:32 UTC 2006