Le Samedi 13 Septembre 2003 21:38, Francois BERGERET a �crit :
> Dear Leaf Users and developpers,
>
> Always searching how to resolve this problem...
> We are several to have it and not read any solution to correct it.
> For now, I can say that when this problem occures, the "manual" solution,
> excepting a complete reboot of my Soekris/Bering card, is to delete the
> default route, which have switched curiously from ppp0 to ipsec0, and to
> add a new default route assigning ppp0 again ! And Bering works again,
> always alive !
>
> So, how can I do that automaticaly ?
> May be this occures with a little drop of my IPS link ?
> If yes, just to survey the up/down of ppp0 and del/add default route
> systematicaly when ppp0 is up again could resolve this ? But, to do that
> correctly, how to assign the IP address of mu ISP gateway which is not
> always the same at each PPPoE connection ? I have tempt an idiot command
> with %defaultroute, but, this variable seems to be not authorized at this
> place... What could be the correct solution ?
>
> Any idea guys ?
Fran�ois:
For what it is worth this little script will check every IPDELAY seconds 
(default 60) if ppp is up and if the IP address has changed. Commands can 
then be executed.
Jacques

!/bin/sh
#
# Check every IPDELAY seconds that IP exists for ppp0 (better than ping...);
# and that IP has not changed
# this is obtained by scanning "ip addr show ppp0" return (function getip()).
# if ppp0 is down or IP has changed, then a script can be executed.

# Adapted by J. Nilo from a script by T. Nkaoua

IPDELAY=60

# Check IPs from ip
getip() {
  IP=`ip addr show ppp0 | grep inet | cut -f1 -d"p" | cut -f2 -d"t" |  \
    cut -f1-d"/"`  
}
logger "Starting checkip: "

OPLDIP=$IP

while true; do
        sleep $IPDELAY
        getip
        if ! [ "$IP" ]; then
                logger "Checkip connection broken detection"
#
# Put any command here that you want to activate if ppp is down
#
#
                break
        else
        if [ "$OLDIP" != "$IP" ]; then
                logger IP has changed: new IP is $IP - old IP was $OLDIP
                OLDIP=$IP
#
# Put any command here that you want to activate if IP has changed
#
#
        fi
done



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
------------------------------------------------------------------------
leaf-user mailing list: [EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/leaf-user
SR FAQ: http://leaf-project.org/pub/doc/docmanager/docid_1891.html

Reply via email to