Previous Next Contents

8. Automatic setup for dialup connections.

This section explains how I have set things up to automate everything. My way might not suit you at all, but you might get a idea from something I've done. Also, I use ppp for dialup, while many use slip or cslip, so almost everything in your setup can be different from mine. But slip's dip program should be able to do many of the things I do.

Normally, when I'm not connected to the net I have a resolv.conf file simply containing the line

domain uio.no

This ensures I don't have to wait for the host name resolving library to try to connect to a nameserver that can't help me. But when I connect I want to start my named and have a resolv.conf looking like the one described above. I have solved this by keeping two resolv.conf 'template' files named resolv.conf.local and resolv.conf.connected. The latter looks like the resolv.conf described before in this document.

To automatically connect to the net I run a script called 'ppp-on':


#!/bin/sh
echo calling...
pppd

pppd has a file called options that tells it the particulars of how to get connected. Once my ppp connection is up the pppd starts a script called ip-up (this is described in the pppd man page). This is parts of the script:


#!/bin/sh
interface="$1"
device="$2"
speed="$3"
myip="$4"
upip="$5"
 ...
cp -v /etc/resolv.conf.connected /etc/resolv.conf
 ...
/usr/sbin/named

I.e. I start my named there. When ppp is disconnected pppd runs a script called ip-down:


#!/bin/sh
cp /etc/resolv.conf.local /etc/resolv.conf
read namedpid </var/run/named.pid
kill $namedpid

So this gets things configured and up when connecting and Dis-configured and down when disconnecting.

Some programs, irc and talk come to mind, make a few too many assumptions, and for irc the dcc features and talk to work right you have to fix your hosts file. I insert have this in my ip-up script:


cp /etc/hosts.ppp /etc/hosts
echo $myip      roke >>/etc/hosts

hosts.ppp simply contains


127.0.0.1       localhost

and the echo thing inserts the ip# i have received for my host name (roke). You should use the name your host knows itself by instead. This can be found with the hostname command.

It is probably not smart to run named when you are not connected to the net, this is because named will try to send queries to the net and it has a long timeout, and you have to wait for this timeout every time some program tries to resolve a name. If you're using dialup you should start named when connecting and kill it when disconnecting. But please see the FAQ section for a tip.

Some people like to use a forwarders directive on slow connections. If your internet provider has DNS servers at 1.2.3.4 and 1.2.3.5 you can insert the line


forwarders 1.2.3.4 1.2.3.5

in the named.boot file. That will decrease the amount of IP traffic your host originates, any possibly speed things up. This especially important if you're paying pr. byte that goes over the wire. This has the added value of letting you off the one maintenance duty you have as a caching named maintainer; you don't have to update a empty root.cache file.


Previous Next Contents