INSTALATION ----------- Only manual installation of this script is supported. You must know, what you are doing. Here is little HOWTO: Copy files 'switchconfig' into /etc/init.d/ directory: ------------------------%<------------------------ cp switchconfig /etc/init.d/ mkdir /etc/default/ cp default-switchconfig /etc/default/switchconfig ------------------------%<------------------------ Create symlink in /etc/rcS.d/ directory: ---------------------%<--------------------- cd /etc/rcS.d/ ln -s ../init.d/switchconfig S46switchconfig ---------------------%<--------------------- Maybe, you must change "S46" number of start script into right value. I have renamed standard Debian symlinks (I'm using Debian unstable), because there was no place for firewall and switchconfig script. A situation in my /etc/rcS.d/ now is: --------------------------------------%<-------------------------------------- # root@twinky: ls -la /etc/rcS.d/ total 8 drwxr-xr-x 2 root root 4096 Mar 3 17:06 . drwxr-xr-x 12 root root 155 Feb 25 23:17 .. -rw-r--r-- 1 root root 701 Sep 10 17:00 README lrwxrwxrwx 1 root root 21 Feb 26 22:02 S00mountall.sh -> ../init.d/mountall.sh lrwxrwxrwx 1 root root 21 Feb 26 22:02 S02mountvirtfs -> ../init.d/mountvirtfs lrwxrwxrwx 1 root root 18 Feb 26 22:02 S05bootlogd -> ../init.d/bootlogd lrwxrwxrwx 1 root root 25 Feb 27 02:30 S05initrd-tools.sh -> ../init.d/initrd-tools.sh lrwxrwxrwx 1 root root 19 Feb 26 22:02 S05keymap.sh -> ../init.d/keymap.sh lrwxrwxrwx 1 root root 16 Feb 26 22:02 S07hdparm -> ../init.d/hdparm lrwxrwxrwx 1 root root 22 Feb 26 22:02 S10checkroot.sh -> ../init.d/checkroot.sh lrwxrwxrwx 1 root root 25 Mar 3 17:06 S18hwclockfirst.sh -> ../init.d/hwclockfirst.sh lrwxrwxrwx 1 root root 24 Feb 26 22:02 S18ifupdown-clean -> ../init.d/ifupdown-clean lrwxrwxrwx 1 root root 27 Feb 26 22:02 S20module-init-tools -> ../init.d/module-init-tools lrwxrwxrwx 1 root root 18 Feb 26 22:02 S20modutils -> ../init.d/modutils lrwxrwxrwx 1 root root 26 Feb 26 22:02 S25libdevmapper1.00 -> ../init.d/libdevmapper1.00 lrwxrwxrwx 1 root root 20 Feb 26 22:02 S28cryptdisks -> ../init.d/cryptdisks lrwxrwxrwx 1 root root 20 Feb 26 22:02 S30checkfs.sh -> ../init.d/checkfs.sh lrwxrwxrwx 1 root root 19 Feb 26 22:02 S30procps.sh -> ../init.d/procps.sh lrwxrwxrwx 1 root root 15 Feb 26 22:02 S35quota -> ../init.d/quota lrwxrwxrwx 1 root root 20 Feb 26 22:02 S36lm-sensors -> ../init.d/lm-sensors lrwxrwxrwx 1 root root 18 Feb 26 22:02 S38pppd-dns -> ../init.d/pppd-dns lrwxrwxrwx 1 root root 20 Feb 26 23:46 S38resolvconf -> ../init.d/resolvconf lrwxrwxrwx 1 root root 19 Feb 26 22:02 S39dns-clean -> ../init.d/dns-clean lrwxrwxrwx 1 root root 18 Feb 26 22:02 S39ifupdown -> ../init.d/ifupdown lrwxrwxrwx 1 root root 21 Feb 26 22:02 S40hostname.sh -> ../init.d/hostname.sh lrwxrwxrwx 1 root root 17 Feb 26 22:02 S40hotplug -> ../init.d/hotplug lrwxrwxrwx 1 root root 20 Feb 26 22:02 S40networking -> ../init.d/networking lrwxrwxrwx 1 root root 18 Feb 26 22:02 S43firewall -> ../init.d/firewall lrwxrwxrwx 1 root root 22 Feb 26 22:02 S46switchconfig -> ../init.d/switchconfig lrwxrwxrwx 1 root root 20 Mar 3 17:06 S50hwclock.sh -> ../init.d/hwclock.sh lrwxrwxrwx 1 root root 17 Feb 26 22:02 S54portmap -> ../init.d/portmap lrwxrwxrwx 1 root root 21 Feb 26 22:02 S57mountnfs.sh -> ../init.d/mountnfs.sh lrwxrwxrwx 1 root root 27 Feb 26 22:02 S63console-screen.sh -> ../init.d/console-screen.sh lrwxrwxrwx 1 root root 17 Feb 26 22:02 S70ntpdate -> ../init.d/ntpdate lrwxrwxrwx 1 root root 21 Feb 26 22:02 S75bootmisc.sh -> ../init.d/bootmisc.sh lrwxrwxrwx 1 root root 14 Feb 26 22:02 S75sudo -> ../init.d/sudo lrwxrwxrwx 1 root root 17 Feb 26 22:02 S80urandom -> ../init.d/urandom lrwxrwxrwx 1 root root 24 Feb 26 22:02 S85screen-cleanup -> ../init.d/screen-cleanup lrwxrwxrwx 1 root root 24 Feb 26 22:02 S85xfree86-common -> ../init.d/xfree86-common --------------------------------------%<-------------------------------------- Yes, switchconfig script must be started after networking script and it is good start also firewalling script between networking and switchconfig script. Please, think about this. ;-) Now you can configure your networks. If you wish configure 2 networks, e.g. budkova.zoznam.sk and intranet.sk, create following directories: ----------------------%<---------------------- mkdir -p /etc/switchconfig/_default/ mkdir -p /etc/switchconfig/budkova.zoznam.sk/ mkdir -p /etc/switchconfig/intranet.sk/ ----------------------%<---------------------- Note: /etc/switchconfig/_default/ directory is required and is contains config files, if no networks was detected. These directories are now root directories for your config files, which needs to be different in your networks. Assume, you will change configuration of your apache webserver. In home network you will allow access to your holliday photos, but not in your comapny network. Simply type: -------------------------%<------------------------- /etc/init.d/switchconfig add /etc/apache/httpd.conf -------------------------%<------------------------- and your config file will be placed into /etc/switchconfig/*/ directories. On startup, correct symlink from /etc/apache/httpd.conf to /etc/switchconfig//etc/apache/httpd.conf will be created. Now you can configure your apache webserver for home and company network in these files: ----------------------------%<---------------------------- /etc/switchconfig/intranet.sk/etc/apache/httpd.conf /etc/switchconfig/budkova.zoznam.sk/etc/apache/httpd.conf ----------------------------%<---------------------------- You can add also other config files. It depends only on your fantasy. ;-) WARNING: make backup of your config files, because you can damage these files during your experiments !!! Now you must configure network detecion algoritmus. This can be configured in /etc/default/switchconfig config file. Example: ---------------------%<--------------------- DOMAIN_ORDER="budkova.zoznam.sk intranet.sk" SERVER_budkova_zoznam_sk="192.168.0.107" SERVER_intranet_sk="192.168.0.1" ---------------------%<--------------------- Domains (networks) are detected in order, as specified in DOMAIN_ORDER variable. In this example I have choosen IP address 192.168.0.107 for domain 'budkova.zoznam.sk', because this IP address is not available in my home network 'intranet.sk'. Therefore 'budkova.zoznam.sk' domain is detected first. If you wish add next network, create variable as follows: --------------------%<-------------------- SERVER_your_next_domain_com="192.168.0.60" --------------------%<-------------------- for domain 'your.next.domain.com'. TODO: better explanation in English -- Developed by Lubomir Host 'rajo' Copyright (c) 2004-2005 Platon SDG, http://platon.sk/ Comments, suggestions, bug reports and patches are always welcome. Please e-mail them to the address or use bugtracking system at http://platon.sk/projects/switchconfig/ The latest official release of switchconfig is available from: http://platon.sk/projects/switchconfig/ This document was written by Lubomir Host 'rajo' in 10th March 2005. vim: tw=78