diald
Using the scripts ppp-on
and ppp-off
can be a bit
tedious. One might forget to bring up the link before starting up the
browser, and find out that no sites are reachable. Or worse:
forgetting to shut down the link when done will keep your phone line
occupied, and rack up connect charges.
The solution to this is dial-on-demand networking. The idea is to run a daemon that will sense when you are using the network, and start up PPP itself. When the daemon detects that the net link is idle, it brings the link down again.
These tasks are handled by the
diald daemon.
If your distribution does not include diald
, its web pages
contain links to the diald source code, and instructions on how to
build it. When installed, diald can be started at boot time with the
following script. This script is a
SysV-style init.d script, and it can also be called by rc.net (after
the loopback interface is configured).
#! /bin/sh # # skeleton Example file to build /etc/init.d scripts. # # Version: @(#) /etc/init.d/skeleton 1.01 26-Oct-1993 # # Author: Miquel van Smoorenburg, <miquels@drinkel.nl.mugnet.org> # PIDFILE="diald.pid" FIFO="diald.ctl" ACCLOG="/var/log/diald" # See how we were called. case "$1" in start) cd /var/run rm $PIDFILE $FIFO 2>/dev/null mknod $FIFO p # # Uncomment the next lines & substitute the desired group for "dialout". # This restricts access to the diald control channel to root and the members # of the stated group. For a single-user system, this is unimportant. # # chown root.dialout $FIFO # chmod 660 $FIFO diald pidfile $PIDFILE fifo $FIFO accounting-log $ACCLOG \ connect "chat -v -f /etc/ppp/chat/das" \ local 192.168.42.3 remote 192.168.42.4 defaultroute ;; stop) kill `cat /var/run/diald*.pid` ;; *) # Oops someone made a typo. echo "Usage: /etc/init.d/diald {start|stop}" exit 1 esac exit 0