Casema keep internet alive!

by Rik de Groot
© synotix


 






PPP setup



Installation for Slackware

     start pppsetup.
     choose telephonnumber 4
     use the PAP protocol.
 

Alter the /etc/resolv.conf

     search here
     nameserver 195.96.96.97

     The  /etc/ppp/pppscript should be almost the same as below:

     ABORT ERROR
     ABORT BUSY
     ABORT "NO CARRIER"
     ABORT "NO DIALTONE"
     ""
     "atdt4"
     CONNECT
 
 

Filename: /root/starti



ipfwadm -I -f
ipfwadm -O -f
ipfwadm -F -f
#ipfwadm -F deny
ipfwadm -F -a m -S 130.0.0.0/24 -D 0.0.0./0
ppp-go
 
 

Filename: /root/stopi



/usr/sbin/ppp-off
 

Filename: /root/keep-internet-alive



#!/bin/sh
#
# Keep internet alive by (C) Synotix 1999
#
# Ping casema and check if there was any package send.
#
set -x

# CheckLock
if [ ! -f /root/keep-internet-alive.lck ]
then
   touch  /root/keep-internet-alive.lck
   CONNECT=`ping -q -c 5 -i 2 195.96.96.97 | grep 'round-trip'`
   if [ "$CONNECT" = "" ]
   then
      /root/stopi
      sleep 10

      if [ -f /var/run/pppd0.pid ]
      then
         kill -9 'cat /var/run/ppp0.pid' &> /dev/null
      fi

      /root/starti
      sleep 30

      CONNECTCHECK=`ping -q -c 5 -i 2 195.96.96.97 | grep 'round-trip'`
      if [ "$CONNECTCHECK" != "" ]
      then
         /sbin/ifconfig | grep 195 > ipnummer
         mail -s "New ipnummer" user@provider.nl < ipnummer
      fi

   fi
   # Remove the lock
   rm -f /root/keep-internet-alive.lck
fi
 
 

Filename: /var/spool/crond/crontabs/root


# Run the 'atrun' program every 5 minutes
# This runs anything that's due to run from 'at'. See man 'at' or 'atrun'.
0,5,10,15,20,25,30,35,40,45,50,55 * * * *       /usr/lib/atrun 1> /dev/null 2> /dev/null

# Keep the internet alive
0,5,10,15,20,25,30,35,40,45,50,55 * * * *       /root/keep-internet-alive 1> /dev/null 2> /dev/null

# This touches a filename in the temp directory so that you can see cron is
# working if the timestamp is current. Comment it out if it bugs you. :^)
# * * * * *       touch /tmp/.crond_running