Title: RE: [speedtouch] Re: Probleme avec pppd
merci � tous ceux qui m'ont aid� � configurer ma connection avec le driver de Benoit. Tout marche parfaitement maintenant. Je voulais juste ajouter ma petite contribution � ce forum en fournissant les scripts qui me permettent de me connecter/deconnecter/reconnecter et incluant des scripts de reconnection automatique et de mise � jour de DNS dynamique (petite compilation de scripts existants) :
 
Il ne sont surement pas parfait, s'il y a des choses a rajouter ou enlever dit-le moi
 
Voila j'�sp�re que ces scripts aideront certains � mieux configurer leur connection adsl ;))
 
 
Le script principal ( /etc/rc.d/init.d/adsl venant de linux-sottises)
 
#!/bin/sh
#
# /etc/init.d/adsl This shell script takes care of starting and stopping
#                  ADSL connexion to the internet.
#
# By Thierry Nkaoua.
# All comments welcome to <[EMAIL PROTECTED]>.
#
# Script to start, restart or stop an ADSL connection with a PPTP client.
# It also launches the checkip script that restarts ADSL if ppp0 is down.
# It also launches the uddns script that updates a DNS adress if the IP has
# changed.
#daemon
#
# chkconfig: 2345 71 11
# description: This shell script launch the adsl connexion to the internet on
# your system
 
# Please modify the following file according to your configuration.
# Added by <[EMAIL PROTECTED]>.
. /etc/adsl.conf
 
# Check the IP from ifconfig.
getip() {
 IP=`$IFCONFIG/ifconfig ppp0 | fgrep "inet ad" | cut -f2 -d":" | cut -f1 -d" "`
}
 
# Determine what the user want us to do.
case "$1" in
 start)
  echo -------------------- >> $LOG
  echo `date` >> $LOG
  echo -n "Starting adsl: " >> $LOG
  echo -n "Starting adsl: "
  echo `date` >> $MODEM_LOG
  /etc/adsl/connect.sh >> $MODEM_LOG
  sleep $DELAY
  $CHECKIP/checkip &
  $CHECKIP/uddns &
  echo
 ;;
 stop)
  echo -------------------- >> $LOG
  echo `date` >> $LOG
  echo -n "Shutting down adsl: " >> $LOG
  echo -n "Shutting down adsl: "
  killall -w uddns > /dev/null 2>&1
  killall -w checkip > /dev/null 2>&1
  /etc/adsl/disconnect.sh > /dev/null 2>&1
  rm -fr /var/run/ppp0.pid /var/run/pppd/
  echo Shutting down OK >> $LOG
  echo
 ;;
 status)
  [ -f /var/run/ppp0.pid ] && echo "ppp0 is up (PID `cat /var/run/ppp0.pid`)"
  getip
  [ "$IP" ] && echo "Remote IP: $IP"
 ;;
 restart)
  echo -------------------- >> $LOG
  echo `date` >> $LOG
  echo "Restarting adsl: " >> $LOG
  $0 stop
  sleep $DELAY
  $0 start
  
 ;;
 *)
  echo "Usage: adsl {start|stop|status|restart}"
  exit 1
esac
exit 0
 
 
 
 
 
 
 
Le fichier /etc/adsl.conf (venant de linux-sottises)
 
MODPROBE=/sbin
ADSL=/etc/rc.d/init.d
CHECKIP=/usr/local/adsl
DDNS=/usr/local/adsl
DELAY=10
IFCONFIG=/sbin
IPDELAY=120
DDNSDELAY=10
LOG=/var/log/adsl
MODEM_LOG=/var/log/speedtouch
PPPD=/usr/sbin
 
 
 
 
Les scripts connect.sh et disconnect.sh (ceux de  Duncan Mcintosh avec quelques modifs)
 
 
 
connect.sh
 
#!/bin/bash
 
mount -t usbdevfs none /proc/bus/usb
insmod usb-uhci
insmod ppp_generic
insmod ppp_synctty
insmod ppp_async
insmod pppoatm
insmod n_hdlc
/usr/local/bin/modem_run -f /etc/adsl/mgmt.o -m &
sleep 35
pppd call adsl &
 
 
 
disconnect.sh
 
#!/bin/bash
 
killall -9 pppd > /dev/null 2>&1
killall -9 modem_run> /dev/null 2>&1
killall -9 pppoa2> /dev/null 2>&1
rmmod n_hdlc> /dev/null 2>&1
rmmod ppp_async> /dev/null 2>&1
rmmod ppp_synctty> /dev/null 2>&1
rmmod pppoatm> /dev/null 2>&1
umount /proc/bus/usb> /dev/null 2>&1
rmmod ppp_generic> /dev/null 2>&1
sleep 5
rmmod ppp_generic> /dev/null 2>&1
rmmod usb-uhci > /dev/null 2>&1
 
 
 
 
 
Le fichier /usr/local/adsl/checkip (venant de linux-sottises)
 
#!/bin/sh
 
# By Thierry Nkaoua.
# All comments welcome to <[EMAIL PROTECTED]>.
#
# Check every IPDELAY minutes that IP exists for ppp0 (better than ping...);
# this is obtained by scanning "ifconfig ppp0" return (function getip()). If
# ppp0 is down, then the adsl script is restarted to get a new connection.
 
# Please modify the following file according to your configuration.
# Added by <[EMAIL PROTECTED]>.
. /etc/adsl.conf
 
# Check IPs from ifconfig and savefile.
getip() {
 IP=`$IFCONFIG/ifconfig ppp0 | fgrep "inet ad" | cut -f2 -d":" | cut -f1 -d" "`
}
echo "Starting checkip: " >> $LOG
 
# Check if ppp0 is up; if it is not, restart the connection.
while true; do
 sleep $IPDELAY
 getip
 if ! [ "$IP" ]; then
  $ADSL/adsl restart &
  break
 fi
done
 
 
 
Le fichier /usr/local/adsl/uddns (venant de linux-sottises) permettant de mettre � jour la base de DynDNS
 
#! /bin/sh
 
# by Thierry Nkaoua
# all comments welcome to [EMAIL PROTECTED]
 
# sript to update dns name at www.dyndns.org
# It keeps trying to update IP at www.dyndns.org till il gets a zero return code (update OK)
# ipcheck.py from http://ipcheck.sourceforge.net/ is used and deals with
# abuse (no update id done if ip is the same) and update after 28 days with same ip
 
# Please modify the following file according to your configuration.
# Added by <[EMAIL PROTECTED]>.
. /etc/adsl.conf
 
# getip gets and ppp0 IP by scanning "ifconfig ppp0" return
# IP is stored
 
# Check IPs from ifconfig and savefile.
 
getip() {
  IP=`$IFCONFIG/ifconfig ppp0 | fgrep "inet ad" | cut -f2 -d":" | cut -f1 -d" "`
                 OLDIP=`cat $CHECKIP/pppd.ip`
        }
#
 
RETVAL=1
while [ $RETVAL -ne 0 ];do
 echo  Starting ddns >> $LOG
 getip
 
 if [ "$IP" ]; then
  if [ "$OLDIP" != "$IP" ]; then
   echo -n "old IP: " >> $LOG
                 echo $OLDIP >> $LOG
                 echo -n "new IP: " >> $LOG
                echo $IP >> $LOG
          else
                 echo same IP >> $LOG
          fi
 
  python $DDNS/ipcheck.py -a $IP -d $DDNS ltesnork twingo lte.homeip.net,clan-lte.homeip.net,vblweb.homeip.net,lte-private.homeip.net >>$LOG
#  python $DDNS/ipcheck.py -a $IP test test test.dyndns.org >> $LOG
  RETVAL=$?
  [ $RETVAL -eq 0 ] && echo -n "$IP" > $CHECKIP/pppd.ip
  [ $RETVAL -ne 0 ] && rm $DDNS/ipcheck.err > /dev/null
         else
                echo panic ddns: no IP available >> $LOG
  sleep $DDNSDELAY
         fi
done
 
 
Le fichier ipcheck.py de Kal ([EMAIL PROTECTED]) est trop gros pour le mettre dans ce mail mais vous pouvez le recuperer sur http://support.dyndns.org/dyndns/clients/unix.shtml apr�s avoir cr�� un compte sur dyndns
 
 

 
 

Reply via email to