IFSwitch v1.0
 
About
IFSwitch is a small utility that allows one to dynamically choose the network settings of a Linux system. It is designed primarily for laptop users who want to easily change their network address depending on whether they are at work, at home, etc.The latest version of this program can be found on the IFSwitch homepage. Comments are welcome, please send email to ahajnal@interport.net.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to:
  Free Software Foundation, Inc.
59 Temple Place
Suite 330
Boston, MA 02111-1307, USA.

Copyright © 2001 Alexander Hajnal

 
Requirements
IFSwitch depends on the following:
  • GTK - Version 1.2
  • Perl - Version 5.005
  • libgtk-perl - Version 0.7002
  • ifup,ifdown,ifconfig
The program was developed on a Debian Linux 2.4.5 system using the libraries listed above. Earlier version of the libraries will probably work as well.
 
Installation
  1. Make sure that the libraries listed above are installed on the system
  2. Copy ifswitch to /bin, /sbin, /usr/bin, or /usr/sbin, and copy ifswitch.conf to /etc.
  3. Set the permissions for the ifswitch program, modify the /etc/ifswitch.conf file to the correct settings for your system and create a /etc/network/interface* file apm for each location you want to connect from. (see the Configuration section below)
  4. When the installation is complete, you can run the program by typing ifswitch at the command line.
 
Configuration
IFSwitch looks for a configuration file /etc/ifswitch.conf that contains all the user-configurable options. The file consists of multiple options, one per line and must contain the following:

IFSwitchTarget filename
This option specifies the file that ifup and ifdown use. The default filename (/etc/network/interfaces) should be fine for most systems.

label filename
This line should be present once for each configuration that you want to support. The label parameter can be any text string (including spaces), while filename should be the full path and filename of the corresponding configuration file (spaces in the filename must be escaped by placing a \ character before them). The actual configuration files should be of the form used by ifup and ifdown (see the man pages for these files for details).

To include comments within the configuration file, place a # at the beginning of each comment line.

A sample configuration appears below:
/etc/ifswitch.conf

# IFSwitchTarget should be the filename that ifup and ifdown use
IFSwitchTarget				/etc/network/interfaces

# Supply one or more interface files
# Format is:
# 

/etc/network/interface.home

# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)

# The loopback interface
iface lo inet loopback

# The first network card
iface eth0 inet static
	address 192.168.10.2
	netmask 255.255.255.0
	network 192.168.10.0
	broadcast 192.168.10.255
	gateway 192.168.10.1

/etc/network/interface.work

# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)

# The loopback interface
iface lo inet loopback

# The first network card
iface eth0 inet static
	address 192.168.11.9
	netmask 255.255.255.0
	network 192.168.11.0
	broadcast 192.168.11.255
	gateway 192.168.11.1
In addition, /etc/network/interfaces must to be a symbolic link to one of the /etc/network/interfaces* files. The ifswitch program needs to be owned by root, be suid/sgid root, and not be world-writable. A good set permissions is 6755 (suid root, sgid root, writable by root, readable and executable by all). The configuration files (e.g. /etc/network/interface* and /etc/ifswitch.conf) should be readable and writable by root but not be readable or writable by others.

 
Usage
Start the program by typing ifswitch from the command line. Assuming there were no problems with the configuration, the program's window will be displayed. IFSwitch will attempt to determine which configuration is current and will automatically select the current one. Select the configuration you want to use and then click one the GO button to switch to that configuration. That's all there is to it! While choosing a configuration, the text area at the bottom of the screen shows details of the currently selected one. When the configuration is switched, the text area shows the actual commands that are being issued. When done, close the window to exit.
 
Bugs
None that are known. There are, however, a number of things that could be improved in later versions.
 
History
  • v1.0 - First public release (June 18, 2001)