Many times, one standalone computer does not only connect to just one network. It is common to connect to different networks or to the Internet using some different service providers. In this case, changing configuration files each time you want to connect to a different site can be annoying.
The solution i propose here consist in using different sets of configuration files for each different connection. You can find here some scripts to automate changing from one to another.
If your email client program uses a local Message Transfer Agent with a
smtp relay host to send all messages, or if you use a email client
program that sends the messages directly to your provider's
server, changing where you are connecting means you need to reconfigure
this option for the
smtp relay server. This is because the providers
usually check if the receipt mailbox is local or to any domain directly
maintained by this provider or if the origin ip address is from the range
of ip addresses that this provider assigns, to avoid having an open relay
server that can be used to send spam, anonymous message and so on.
In the following examples, you will find how to change this parameter in
the Smail configuration files in a simple configuration where all
external messages are sent to a
smtp relay server. If you use another
Message Transfer Agent (MTA) in your system, you can send me what you must
change in your MTA to include it here. If you use an email client program
that directly sends to the external
smtp server (Kmail, Netscape,
etc.) send me your changes too.
First of all, create a subdirectory of
providers where you store your scripts to automatically change from
one to another provider and the subdirectories with the set of files to
configure each of the providers connections.
With the next script this directory is created and filled with the current configuration files from Diald, chat, pppd and Smail, that will be treated as a template for the next configurations.
#!/bin/sh #File /etc/diald/providers/setupdialdmultiprovider mkdir /etc/diald/providers mkdir /etc/diald/providers/setup cp /etc/ppp/pap-secrets /etc/diald/providers/setup cp /etc/ppp/chap-secrets /etc/diald/providers/setup cp /etc/resolv.conf /etc/diald/providers/setup cp /etc/diald/diald.options /etc/diald/providers/setup cp /etc/diald/standard.filter /etc/diald/providers/setup cp /etc/diald/personal.filter /etc/diald/providers/setup cp /etc/diald/diald.connect /etc/diald/providers/setup cp /etc/chatscripts/provider /etc/diald/providers/setup cp /etc/diald/ip-up /etc/diald/providers/setup cp /etc/diald/ip-down /etc/diald/providers/setup cp /etc/smail/routers /etc/diald/providers/setup
With the next script the template configuration will be copied to a new
directory to prepare it for a new provider connection or a new net
connection. This script (
will need a parameter with the provider or net name.
#!/bin/sh #File /etc/diald/providers/newdialdprovider mkdir /etc/diald/providers/$1 cp /etc/diald/providers/setup/* /etc/diald/providers/$1
Now, you will modify as you need the new files in
the parameter passed to
At the end, with this script you will change all your configuration files
related to Diald to connect to another provider or net. I use
symbolic links to avoid using duplicate files. Using symbolic links, if
you change any config file in its original location like
/etc/resolv.conf, the change is really made in the
#!/bin/sh #File /etc/diald/providers/setdialdprovider /etc/init.d/diald stop #wait for Diald to stop. sleep 4 ln -sf /etc/diald/providers/$1/pap-secrets /etc/ppp ln -sf /etc/diald/providers/$1/chap-secrets /etc/ppp ln -sf /etc/diald/providers/$1/resolv.conf /etc ln -sf /etc/diald/providers/$1/diald.options /etc/diald ln -sf /etc/diald/providers/$1/standard.filter /etc/diald ln -sf /etc/diald/providers/$1/personal.filter /etc/diald ln -sf /etc/diald/providers/$1/diald.connect /etc/diald ln -sf /etc/diald/providers/$1/provider /etc/chatscripts ln -sf /etc/diald/providers/$1/ip-up /etc/diald ln -sf /etc/diald/providers/$1/ip-down /etc/diald ln -sf /etc/diald/providers/$1/routers /etc/smail /etc/init.d/diald start