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

wan status

Discussion in 'Tomato Firmware' started by azeari, Mar 9, 2007.

  1. azeari

    azeari LI Guru Member

    just wondering is it possible to retrieve the wan status over the command line, like in a script or something. I've tried digging through the nvram variables but don't think any of em offers and inkling of the wan status. In fact, the wan ip remains the same even after i disconnected my ppoe. any clues?

    What i'm actually trying to do is overcome this stupid problem with my isp's modem. Whenever it experiences a line desync, the connection is just simply dropped(appears disconnected in the overview page) but there is no sign of reconnecting in the logs. i just get a series of -mark- (the usual) long after its been disconnected. no wan down, redialing as i'd expect. I've tried fiddling around with keep alive but no luck.

    When the connection drops normally though, like my isp dropping it every 11pm, it'll redial automatically.

    edit: oh nvm.. i found my wan_get_dns changes. still.. is there any more elegant way of finding out?
     
  2. azeari

    azeari LI Guru Member

    so far after ripping off other scripts i found in the forum, i got myself this

    and

    What this does is check for the isp's dns server every minute and restart the wan service if its not found, irregardless of whether you've pressed the disconnect button in the webui. (this probably solves someone's complaint i saw last time)

    I still believe there's a more elegant solution though :) something that doesn't rely on the dns
     
  3. bogderpirat

    bogderpirat Network Guru Member

    when online:
    Code:
    # cat /proc/net/pppoe
    Id       Address              Device
    00002E1F 00:90:XX:XX:XX:XX    vlan1
    when offline:
    Code:
    # cat /proc/net/pppoe
    Id       Address              Device
    depending on what you use for dialup, i'm sure you can replace pppoe with something else. just stumble around in the proc directory. hooray! right?
     
  4. psychowood

    psychowood LI Guru Member

    I use "ifconfig ppp0" and checkinf for the errorlevel (if $? is 0 ppp0 is up, otherwise is down), but I'm not sure if it could work in your case.

    What about just pinging your WAN gateway and redialing if not responds?

    Btw, you don't really need using a while loop if the check is cronned, or you'll risk to have more than one script running at the same time (with consequent random behaviour :) ).

    I'd also put cron every 3 or 5 mins, just to avoid pinging continuosly your gateway :)

    PS.Edit led commands as you wish ;)
     
  5. roadkill

    roadkill Super Moderator Staff Member Member

    you can simply activate this in your init script with a & afterwards...
     
  6. azeari

    azeari LI Guru Member

    hey thanks for e help =)

    here's what i ended up doing

    - Used ifconfig to check the wan status
    - Changed from cron to a script in jffs. (don't really like long messy startup scripts :) a short and sweet sh /jffs/check.sh looks cleaner)
    - Chucked the whole thing into a 10sec loop for checks

    This way, i don't have to ping my gateway, and i don't get my logs flooded with messages from crond.
     
  7. azeari

    azeari LI Guru Member

    this is strange.. whenever i run this
    ps | awk '/'"test.sh"'/ {++x}; END {print x+0}'

    if the process is not running, most of the time i get 1, yet sometimes i get 0.. and its screwing up my shell scripts at the moment! >_< any ideas?
     

Share This Page