![]() | |||||||
|
|
|
|
|
|
|
| |
1. Die ppp-on file: |
#!/bin/sh # # file: /etc/ppp/ppp-on # # This script is based on the script "ppp-on" found at # ftp://sunsite.unc.edu/pub/Linux/system/Network/serial/ppp/ppp-2.2.0f.tar.gz # # Script to initiate a ppp connection. This is the first part of the # pair of scripts. This is not a secure pair of scripts as the codes # are visible with the 'ps' command. However, it is simple. # # These are the parameters. Change as needed. LOCAL_IP=0.0.0.0 # Local IP address if known. Dynamic = 0.0.0.0 REMOTE_IP=0.0.0.0 # Remote IP address if desired. Normally 0.0.0.0 DEVICE=/dev/modem #NETMASK=255.255.255.0 # The proper netmask if needed # # export current tty to enable output in dialer script # export TERMINAL=`tty` # # This is the location of the script which dials the phone and logs # in. Please use the absolute file name as the $PATH variable is not # used on the connect option. (To do so on a 'root' account would be # a security hole so don't ask.) # DIALER_SCRIPT=/etc/ppp/redialer # # Initiate the connection # # I put most of the common options on this command. Please, don't # forget the 'lock' option or some programs such as mgetty will not # work. The asyncmap and escape will permit the PPP link to work with # a telnet or rlogin connection. You are welcome to make any changes # as desired. Don't use the 'defaultroute' option if you currently # have a default route to an ethernet gateway. # #Die geschwindigkeit ist evtl. auf Ihre Serielle Schnittstelle anzupassen! Achtung wenn Sie diesen Wert ändern, müssen Sie auch in redialer den zu erwartenden Rückwert ändern SPEED=115200 # Set baud stty $SPEED -tostop PPP_FLAGS="mru 1524 modem defaultroute crtscts noipdefault" /usr/sbin/pppd lock connect $DIALER_SCRIPT $DEVICE $SPEED $PPP_FLAGS \ $LOCAL_IP:$REMOTE_IP +ua /etc/ppp/account |
2. Die ppp-off file: |
#!/bin/sh
#
# file: /etc/ppp/ppp-off
#
######################################################################
#
# Determine the device to be terminated.
#
if [ "$1" = "" ]; then
DEVICE=ppp0
else
DEVICE=$1
fi
######################################################################
#
# 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 the kill did not work then there is no process running for this
# pid. It may also mean that the lock file will be left. You may wish
# to delete the lock file at the same time.
if [ ! "$?" = "0" ]; then
rm -f /var/run/$DEVICE.pid
echo "ERROR: Removed stale pid file"
exit 1
fi
#
# Success. Let pppd clean up its own junk.
echo "PPP link to $DEVICE terminated."
exit 0
fi
#
# The ppp process is not running for ppp0
echo "ERROR: PPP link is not active on $DEVICE"
exit 1
|
3. Die redialer file: |
#!/bin/sh # # file: /etc/ppp/redialer # # This script is based on the script "redialer" found at # ftp://sunsite.unc.edu/pub/Linux/system/Network/serial/ppp/ppp-2.2.0f.tar.gz # It should work with previous versions of chat too # ################################################################### # # These parameters control the attack dialing sequence. # # Maximum number of attempts to reach the telephone number(s) MAX_ATTEMPTS=5 # Delay between each of the attempts (in seconds). SLEEP_DELAY=5 # Terminal to echo output, exported from "ppp-on" if [ "w$TERMINAL" = "w" ]; then TERMINAL=/dev/console fi ################################################################### # # This is a list of telephone numbers. PHONE1=Wenn Sie in ppp-on den Wert der Variabel SPEED geändert haben, müssen Sie hier die Zeile Connect 115200 auf den neuen Wert einstellen!
#
# decide what to do depending on exitcode of chat
#
case $? in
0) echo Connection established > $TERMINAL; exit 0;;
1) echo chat: exit 1, see manpage for details. > $TERMINAL; exit 1;;
2) echo chat: exit 2, see manpage for details. > $TERMINAL; exit 2;;
3) echo chat: exit 3, see manpage for details. > $TERMINAL; exit 3;;
4) echo Line busy. > $TERMINAL;;
5) echo No Carrier. > $TERMINAL;;
6) echo A call is coming. Exiting! > $TERMINAL; exit 1;;
7) echo No dialtone. > $TERMINAL;;
8) echo An error occured. Exiting! > $TERMINAL; exit 1;;
esac
return
}
###################################################################
#
# Function, that displays the rest of time before the next number
# is dialed
function sleeping
{
REST=$SLEEP_DELAY
while [ $REST -ne 0 ]; do
echo -ne Next trial in $REST seconds. "\r" > $TERMINAL
sleep 1s
REST=`expr $REST - 1`
done
echo "Next trial now. " "\r" > $TERMINAL
return
}
###################################################################
#
# Dial telephone numbers until one answers
attempt=0
while : ; do
echo -e "\n" > $TERMINAL
attempt=`expr $attempt + 1`
echo "Dialing attempt number: $attempt" > $TERMINAL
n=`expr $attempt % $numbers`
if [ $n -eq 0 ]; then
n=$numbers
fi
NUMBER=`eval echo '$PHONE'$n`
callnumber $NUMBER
if [ $attempt -eq $MAX_ATTEMPTS ]; then
exit 1
fi
sleeping
done
|
4. Die account file: |
Diese Datei enthält die Benutzer-Kennung des Bürgernetzes in der Form zweier Zeilen: |
5. Die options file: |
Die options-Datei enthält einige Befehlsargumente für den pppd, und kann hier, da bereits alle Optionen im ppp-on script angeben sind, leer sein. Wenns Probleme gibt schreiben Sie in die Datei ein Lock, mehr nicht! |
written by Alexander Thomas (10.05.1998)
|
|