Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 4 Mar 2002 23:11:04 -0800
From:      "barazani" <bara_zani@yahoo.com>
To:        <freebsd-questions@freebsd.org>
Subject:   Fw: how to remove/delete tun0 ? 
Message-ID:  <018001c1c414$ebad2eb0$7d00a8c0@motil>

next in thread | raw e-mail | index | archive | help


 Ok ,
 eric this seems to work .
 here's the reasons to my question.
 I have a dsl connection at home ,i'm trying to achive maximum uptime BUT my
 dsl connection keeps dropping
 for no aparant reason .
 I have spoken to earthlink's support and there isn't any obvious problem .
 I know it's not my box !!!
 anyway , i wrote a little script that runs every 5 minutes and pings my
 default gateway .
 if it odes not get an naswer it kills ppp and restarts it .
 like so:
 --------------------------------
 #! /bin/sh
 ping -c 3 `netstat -rn |grep default |awk '{print $2}'` > /dev/null 2>&1
 STAT="$?"
 echo "`date +%d-%m-%Y/%H:%M` - $STAT" >> /var/log/ppp_alive.log
 if [ "$STAT" != 0 ] ;then
    sleep 10
    ping -c 3 `netstat -rn |grep default |awk '{print $2}'`
    if [ "$STAT" != 0 ] ;then
       echo

"+++++++++++++++++++++++++++++++++++++++++++++++++++++++">>/var/log/ppp_aliv
 e.err
       echo "ppp pid  is `ps -auxw |grep ppp` >> /var/log/ppp_alive.err
      echo "`date +%d-%m-%Y/%H:%M` - $STAT" >> /var/log/ppp_alive.err
      tail -50 /var/log/ppp.log >> /var/log/ppp_alive.err
    echo
"+++++++++++++++++++++++++++++++++++++++++++++++++++++++">>/var/log/ppp_aliv
 e.err
    ifconfig tun0 ip.add.re.ss delete #new addition thanks ,eric
    killall ppp
    sleep 20
    /usr/sbin/ppp -quiet -auto elink
    ifconfig |mail -s "ppp restarted" bara_zani@yahoo.com
   fi
 fi
 the script works well but sometimes when i restart ppp it opens another tun
 device tun1 and it uses that as the pppoe
 interface ( which screws up my ipf rules - which are all tun0 ....)
 so i'm hoping the ifconfig ip.add.re.ss will do the trick and i'll only
have
 one device .
 if anyone can think of a better way or has some improvements /suggestions
as
 to my problem , i will be more than happy to give it a try
 thanks
 barazani
>


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?018001c1c414$ebad2eb0$7d00a8c0>