1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Automatic Disconnections

Discussion in 'Tomato Firmware' started by morpheouss, Jul 19, 2007.

  1. morpheouss

    morpheouss LI Guru Member

    Hey,

    I have PPPoE connection (DSL) and session expires every 48h there, so i decided to restart internet connection every 5:00am. So i typed cru a reconnect "00 05 * * * service wan restart"

    However tomatoforces me to enter this sequence every router restart so i added this into init script.

    Today morning i have poweron computer and internet wasn't working...
    I looked at logs and i see wan restart at 5am, but:

    Code:
    Jul 18 05:00:01 unknown cron.notice crond[164]: USER root pid 5522 cmd service wan restart #reconnect#
    Jul 18 05:00:01 unknown daemon.info dnsmasq[5443]: exiting on receipt of SIGTERM
    Jul 18 05:00:02 unknown daemon.notice pppd[5530]: pppd 2.4.1 started by root, uid 0
    Jul 18 05:00:02 unknown daemon.info dnsmasq[5531]: started, version 2.39 cachesize 150
    Jul 18 05:00:02 unknown daemon.info dnsmasq[5531]: compile time options: no-IPv6 GNU-getopt no-RTC no-ISC-leasefile no-DBus no-I18N no-TFTP
    Jul 18 05:00:02 unknown daemon.warn dnsmasq[5531]: no servers found in /etc/resolv.dnsmasq, will retry
    Jul 18 05:00:02 unknown daemon.info dnsmasq[5531]: read /etc/hosts - 0 addresses
    Jul 18 05:00:02 unknown daemon.info dnsmasq[5531]: read /etc/hosts.dnsmasq - 1 addresses
    Jul 18 05:00:04 unknown daemon.info pppd[5434]: Exit.
    Jul 18 05:00:08 unknown user.debug kernel: PPPIOCDETACH file->f_count=3
    Jul 18 05:00:08 unknown user.info ppp_event[5537]: notice: Authentication failed
    Jul 18 05:04:40 unknown daemon.info pppd[5530]: Exit.
    Jul 18 05:10:43 unknown syslog.info -- MARK --
    Jul 18 06:10:43 unknown syslog.info -- MARK --
    Jul 18 07:10:43 unknown syslog.info -- MARK --
    What i see? Authentication failed! Why and how? Why didn't it tried again?
    Why pppd exited? Did it segfault? Why tomato haven't launched it again? :|


    Please help!
     
  2. morpheouss

    morpheouss LI Guru Member

    anyone?
     
  3. digitalgeek

    digitalgeek Network Guru Member

    Try using this...

    cru a PPPoE_Restart "00 5 * * * service wan restart"
     
  4. morpheouss

    morpheouss LI Guru Member

    but... that's what i have already done...
    what's the difference how do i name this task?

    In both commands it executes 'service wan restart' at 5am...

    i wonder why does it not reconnects automatically after failed authentication, and just exits?

    Should i change tomato to sth else?
    Orr maybe i should do force it to:

    1) just disconnect at 5am
    2) again connect at eg 5:10am?

    would this help?
    how do You think?
    how to do that?
     
  5. digitalgeek

    digitalgeek Network Guru Member

    are you using connect on demand or keep alive?

    and "restart" is not the same as "killall ppoed"
     
  6. morpheouss

    morpheouss LI Guru Member

    1) I use keep alive, and restarts connection everyday at 5am using 'cru a reconnect "00 05 * * * service wan restart"' command

    2) You tols i should try 'cru a PPPoE_Restart "00 5 * * * service wan restart"' ...

    Both, mine and your command are the same - service wan restart...

    And it does not work... Look at logs in first post...

    I can't stand why does authentication failed and why it kills pppd then, instead of retrying to connect? :|


    I thought about killing pppd at 5am instead of restarting WAN, and starting it again at eg. 5:05am... but
    a) dunno how
    b) dunno if this might help...
     
  7. Odin-60

    Odin-60 LI Guru Member

    'service wan restart' is known to be evil.
    Instead, I have the following line in my init script,
    and it works perfectly:

    cru a reconnect "00 05 * * * killall -hup pppoecd"
     
  8. digitalgeek

    digitalgeek Network Guru Member

    Thanks... I couldn't find the thread in the FAQ with this script... but is what I meant to post above. (sorry for the confusion)

    I beleive the wan restart would work better for a cable isp were the wan service is managing the connection. But with PPPoE the conneaction is mannaged by the PPPoEd service (daemon)
     
  9. morpheouss

    morpheouss LI Guru Member

    look.. i think i've found solution.

    it disconnects at 05:00:01 and connects again at 05:00:08 ...
    7secs difference... but i can be still logged on server then...
    I have read that PPP connections needs at least 15secs betweet disconencting and connecting...

    Now i would like to know what should i add to cron to:
    1) disconnect at 05:00am
    2) connect at 05:05am

    5 minutes is enought i guess...
     
  10. yaqui

    yaqui LI Guru Member

    Try this:
    Code:
    sleep 5
    if [ $? == 1 ] ; then
         echo -e "#!/bin/sh\n service wan stop" > /tmp/wanrestart.sh
         echo -e "logger \'service wan stop successful\'" >> /tmp/wanrestart.sh
         echo -e "sleep 300" >> /tmp/wanrestart.sh
         echo -e "logger \'5 minute wait successful\'" >> /tmp/wanrestart.sh
         echo -e "service wan start" >> /tmp/wanrestart.sh
         echo -e "logger \'wanrestart successful\'" >> /tmp/wanrestart.sh
         chmod 755 /tmp/wanrestart.sh
         sleep 5
    fi
    cru a wanrestart "00 05 * * * /tmp/wanrestart.sh"
     

Share This Page