Draco - ppp config files


/usr/sbin/ppp-on

This file starts a 'normal' ppp session. I no longer use it, but it was neccessary to get ppp working in the first place.

The problems of connecting to the ISP are the same with either PPP or Diald, so get PPP working first.

#!/bin/sh
#
#	ppp-on
#
#	Set up a PPP link
#

LOCKDIR=/var/spool/uucp
DEVICE=cua3

. /usr/local/etc/PPP-private
# This file contains private info, in the following format:
#export PHONE=5551234
#export USER=spade
#export PASSWORD=CoolPWD
#export OUR_IP_ADDR=128.0.0.200

if [ -f $LOCKDIR/LCK..$DEVICE ]
then
    if ps `cat $LOCKDIR/LCK..$DEVICE`
    then
        echo "PPP device is locked"
        exit 1
    else
        /usr/sbin/unlock LCK..$DEVICE
    fi
fi

/usr/sbin/fix-cua $DEVICE

(
    stty 38400 -tostop

    if /usr/sbin/chat -v \
        ABORT  "NO CARRIER" ABORT BUSY  \
        "" ATZ OK ATS7=90L2V1\&C1E1Q0M0DT$PHONE CONNECT ""  \
        ogin: $USER ssword: \\q$PASSWORD
    then
	/usr/sbin/pppd \
            modem \
            crtscts \
            defaultroute \
            mru 1500 \
            $OUR_IP_ADDR: \
            /dev/$DEVICE
	sleep 10
	exit 0
    else
	echo "PPP call failed" 1>&2
	exit 1
    fi
) < /dev/$DEVICE > /dev/$DEVICE


/etc/ppp/ip-up

A program or script which is executed when the link is available for sending and receiving IP packets (that is, IPCP has come up). It is executed with the parameters:
interface-name tty-device speed local-IP-address remote-IP-address
and with its standard input, output and error streams redirected to /dev/null.

This program or script is executed with the same real and effective user-ID as pppd, that is, at least the effective user-ID and possibly the real user-ID will be root. This is so that it can be used to manipulate routes, run privileged daemons (e.g. sendmail), etc. Be careful that the contents of the /etc/ppp/ip-up and /etc/ppp/ip-down scripts do not compromise your system's security.


#! /bin/sh
echo ppp up `date` > /dev/console
# This might be a good place to invoke fetchmail to retreive
# mail from the ISP.
# This is also a good place to fix up routes.

/usr/sbin/ppp-off

This script is used to shut down the PPP link gracefully. It is usually unneeded, because the session will have failed long before you are ready to shut it down.

#!/bin/sh

# /usr/sbin/ppp-off

DEVICE=ppp0

#
# If the ppp0 pid file is present then the program is running. Stop it.
if [ -r /var/run/$DEVICE.pid ]; then
	kill -INT `cat /var/run/$DEVICE.pid`
#
# If unsuccessful, ensure that the pid file is removed.
#
	if [ ! "$?" = "0" ]; then
		echo "removing stale $DEVICE pid file."
		rm -f /var/run/$DEVICE.pid
		exit 1
	fi
#
# Success. Terminate with proper status.
#
	echo "$DEVICE link terminated"
	exit 0
fi
#
# The link is not active
#
echo "$DEVICE link is not active"
exit 1

/etc/ppp/ip-down

A program or script which is executed when the link is no longer available for sending and receiving IP packets. This script can be used for undoing the effects of the /etc/ppp/ip-up script. It is invoked with the same parameters as the ip-up script, and the same security considerations apply, since it is executed with the same effective and real user-IDs as pppd.
#! /bin/sh
/usr/local/sbin/unlock LCK..cua3 > /dev/console 2<&1


Index, Back On to Diald
Copyright ©, 1997, Ben Spade. Permission is given to copy or link to this document, as long as this notice remains intact.