SourceFiles.org - Use the Source, Luke
Home | Register | News | Forums | Guide | MyLinks | Bookmark

Related Sites

Latest News
  General News
  Reviews
  Press Releases
  Software
  Hardware
  Security
  Tutorials
  Off Topic


Back to files

QuickSwitch 1.02 (quickswitch.sourceforge.net) Mohit Muthanna (www.muthanna.com)
Paul Seamons (www.seamons.com) (perl@seamons.com)

$Id: README,v 1.9 2003/01/23 16:03:53 muthanna Exp $

Introduction

QuickSwitch is a little utility that lets linux/Unix laptop users create and use roaming network profiles. Instead of individually reconfiguring the network card, changing DNS entries, hosts files etc. it lets you create one centralized file for all your different profiles. So if you keep moving around with your laptop (like myself) and have to keep reconfiguring everything over and over again; this might just make your life a wee bit easier. QuickSwitch also lets you configure all your network settings over the command line (in one line), including the default route and DNS addresses. This saves you the hassle of going out and editing files one by one.

New in version 1.02

  • Fixed 'route add' bug. Specifies interface in route.
  • Fixed command line switching docs. Requires '-a'.

New in version 1.01

  • DHCP bugs and issued fixed.
  • dhcpkill option.

New in version 0.16

  • Code Rewrite in both switcher and switchto
  • Strict, warn, and taint safe.
  • Moved switch.conf to switchto.conf
  • Use new Curses libraries in switcher
  • Safe for setuid execution.

New in version 0.14

  • All file switching operations changed from copying to symbolic linking. Saves some administrative burden,
  • Funky new ANSI colors. Makes it easy to decipher the messages.

New in version 0.12

  • Dynamic file-switching configuration. A simple mechanism by which other configuration files can be switched, eg., printers, X configs, etc.
  • Wireless LAN bug fix

New in version 0.10

  • A new web page... for a start. See quickswitch.sourceforge.net.
  • Wireless LAN configuration.
  • Save last good known configuration.
  • Configure via kernel parameter.

Installing

Prerequsites: Perl 5, Awk and root access.

Untar the distribution package:

> cd /usr/local
> su -
(Type root password here)
> tar -zxvf quickswitch-0.1.2-linux-intel.tar.gz

Run the Installation script:

> ./INSTALL.sh

Configuring QuickSwitch

Setting up QuickSwitch is a piece of cake. Just edit the /etc/switchto.conf file using the sample provided and you're ready to go. Remember to switch to root before using it.

Using QuickSwitch

Setting a profile:
> switchto MyProfile

QuickSwitch options are detailed as follows:

-l: Lists all available service profiles setup in the configuration file. eg:

> switchto -l
QuickSwitch v0.1 Mohit Muthanna 2000
Available service profiles:
Home
ITS
Prodigy

-d: Set debug (logging) level. Logs are sent to standard output. Levels can be 1 or 2. 2 just produces more output. eg:

> switchto -d 2 ITS

QuickSwitch v0.1 Mohit Muthanna 2000
Using service: ITS
Configuring device...
/sbin/ifconfig eth0 192.168.1.119 netmask 255.255.255.0 SIOCSIFADDR: Permission denied
SIOCSIFFLAGS: Permission denied
SIOCSIFNETMASK: Permission denied
Checking for default route...
/bin/netstat -nr |awk '{print $1;}' | grep '0.0.0.0' Match. Removing default route: /sbin/route del default SIOCDELRT: Operation not permitted
Setting default route...
/sbin/route add default gw 192.168.1.137 SIOCADDRT: Operation not permitted
Setting hostname...
/bin/hostname vera.itsits.com
hostname: you must be root to change the host name Setting up DNS...
Writing to /etc/resolv.conf...
Configuring /etc/hosts...
Writing to /etc/hosts...

Note: All those error messages are due to not being logged in as root.

-b: Backs up original files. (At the time of this writing, /etc/hosts and /etc/resolv.conf).

Using QuickSwitch in Commandline Mode

Using the commandline feature is great for one-time configs. Here's an example:

switchto -a ip:192.168.1.12 netmask:255.255.255.0 gw:192.168.1.51 \

dns1:192.168.1.51

The understood parameters are:

ip: Ip Address (eg. ip:192.168.1.12)
netmask: Subnet mask (if any)
gw: Default gateway
domain: Domain Name
dns1/dns2: Pri / sec DNS address
host: Hostname
essid: Wireless LAN ESSID
key: Wireless LAN key
fqhost: Fully Qualified hostname

Note: If you don't specify a hostname or Fully qualified hostname, the /etc/hosts file is left untouched.

Using the new kernel parameter feature

Quickswitch can select a profile based on a supplied kernel parameter. Eg., in the LILO prompt on startup, you can type "linux SWITCHTO=home".
Optionally you can add the following line to your lilo.conf append="SWITCHTO=home"
Some sample lilo.conf entries would be: image="/boot/vmlinuz-2.4.7-10"

        label="linux home"
        append="SWITCHTO=home"
        initrd="/boot/initrd-2.4.7-10.img"
        read-only
        root="/dev/hda2"

image="/boot/vmlinuz-2.4.7-10"

        label="linux work"
        append="SWITCHTO=work"
        initrd="/boot/initrd-2.4.7-10.img"
        read-only
        root="/dev/hda2"

To enable reading of the passed parameters, add the line "/usr/bin/switchto -s"
into your /etc/rc.d/rc.local or similar startup file. You may optionally pass the -d2 paramter to enable debugging and the -p2 parameter to pause for 2 seconds to view the status of the switch.

If no parameter is supplied during startup, quickswitch uses the last working configuraions. See "servicefilename" in switchto.conf for details on this.

It is suggested that you set ONBOOT=no in the config file for your device in /etc/sysconfig/network-scripts

And that's about it. If you spot any bugs, or are interested in porting it to BSD or Solaris mail me at bugs@muthanna.com.

Using the Dynamic file switching feature

With version 0.12 there is a new [files] section where you can add named of files you want dynamically switched. Here you can add the original names of the files you want switched in the following format:

[files]
samba=/etc/smb.conf
printcap=/etc/printcap

If inside a profile you want a file switched, simply enter the same informaion in the profile using the NEW file name, eg.,

[home]
ip=192.168.0.232
netmask=255.255.255.0
...
...
printcap=/etc/printcap.home

Only names entered in the profile will be switched with the original names in the files section.

Credits

Quickswitch core code - Mohit Muthanna
Kernel params hack - Stuart Menefy
Wireless LAN hack - NeilFred Picciotto
Core code modifications and enhancements - Paul Seamons

-fin-


Other Sites

Discussion Groups
  Beginners
  Distributions
  Networking / Security
  Software
  PDAs

About | FAQ | Privacy | Awards | Contact
Comments to the webmaster are welcome.
Copyright 2006 Sourcefiles.org All rights reserved.