[LUGOS] pppoe povezava

Rok Krajnc rok.krajnc at sklab.org
Wed Nov 17 14:15:45 CET 2004


Nejc Novak wrote:

>Dan!
>
>Torej, pppoe client se poskusa rekonektat kaksne 3 minute. Potem pa umre.
>Povezava pride nazaj cez 10 minut, jaz moram pa domov laufat natipkat ppp
>start :)
>
>A obstaja kaksna skripta ki bi preverjala ali je masina povezana in jo
>povezala ce ni?
>
>Hvala in lp!!
>
>  
>
Srečno.
Tudi jaz sem imel probleme s tem adsl-jem (neka stara verzija rp-pppoe), 
ki se nikakor ni hotel ponovno konektat, čeprav sem to eksplicitno 
nastavil v konfiguracijski datoteki.

Mislim, da zdaj teh problemov ni več, vendar še vseeno (za vsak slučaj 
:) uporabljam spodnjo skripto, ki je sicer malo na hitro napisana, 
deluje pa.
Daj jo v cron in naj se požene vsakih nekaj minut.

lp, Rok

##########################################################

#!/bin/sh
# This script finds out if the IP on the WAN interface has changed or 
the peer
# is not reachable and acts accordingly

# Current time & date:
CURTIME=$(date +%Y-%m-%d--%H:%M)

# WAN interface is ppp0:
#IFCONFIG="/sbin/ifconfig"
EXTIF="ppp0"

# Current IP of the WAN interface:
CUREXTIP="`ifconfig $EXTIF | awk \
/$EXTIF/'{next}//{split($0,a,":");split(a[2],a," ");print a[1];exit}'`"

# IP of the ppp0 P-t-P:
PTPIP="`ifconfig $EXTIF | awk \
/$EXTIF/'{next}//{split($0,a,":");split(a[3],a," ");print a[1];exit}'`"

# IP of the WAN interface on_connect:
EXTIP=`cat /var/adm/current_ip`

#echo $EXTIP
#echo $CUREXTIP

# Test if the IPs are the same:
if [ $EXTIP != $CUREXTIP ]; then
echo "$CURTIME IPs are not the same! Re-running firewall ..." >> 
/var/adm/ppp0_errors
. /etc/ppp/ip-up
fi

sleep 2

# Another case might be that the current IP is not reachable:
ping -c 1 $PTPIP 1> /dev/null
#sleep 11
if [ "$?" -ne 0 ]; then
echo "$CURTIME PTPIP is not reachable! Restarting ADSL ..." >> 
/var/adm/ppp0_errors
adsl-stop 1> /dev/null
sleep 10
adsl-start 1> /dev/null
fi

echo "$CURTIME No other error" >> /var/adm/ppp0_errors


#END OF SCRIPT

##########################################################





More information about the lugos-list mailing list