IFSwitch v1.0


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 home, at work, etc.


IFSwitch depends on the following: 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.


  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.


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:
# IFSwitchTarget should be the filename that ifup and ifdown use IFSwitchTarget /etc/network/interfaces # Supply one or more interface files # Format is: # <label><whitespace><filename> # label and filename can contain whitespace characters but # those in the filename must be escaped with a \ character # For example: # Home network /etc/network/interfaces\ for\ home\ network home ( /etc/network/interfaces.home work ( /etc/network/interfaces.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 netmask network broadcast gateway
# /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 netmask network broadcast gateway
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.


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.


None that are known. There are, however, a number of things that could be improved in later versions.



This program is free software; you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as published by the Free Software Foundation.
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.