check wan port status (plugged/unplugged)?

Discussion in 'Tomato Firmware' started by zecoj, Aug 31, 2008.

  1. zecoj

    zecoj Addicted to LI Member

    Hi all,

    I'm using the WHR-HP-G54 with Tomato v1.21. I want to use the bridge led (on the front) to act as the led on the wan port (on the back). So if the wan port is plugged in (or unplugged) and its led is on (or off), I want the bridge led to be on (or off) as well.

    I know this can be done with pinging the modem (where the wan port leads to) and turn the bridge led on/off depends on the ping responses. But I'm looking for a less resource-extensive solution. Maybe there's a variable or something that indicates the state of the wan port?

  2. pfoomer

    pfoomer LI Guru Member

    Led on WAN

    I use this, not sure if it will suit you.

    while sleep 2; do
    if [ -e /tmp/ppp/link ] ; then
    led white off
    led amber on
    led amber off
    led white on
  3. zecoj

    zecoj Addicted to LI Member

    pfoomer, thanks but that file doesn't exist in my system (i'm using v1.21). I hope though that there's a file or something...
  4. pfoomer

    pfoomer LI Guru Member


    its a script, cut and past in the startup script box, then save.

    (Administration -> Scripts -> Init)

    Or do you mean the /tmp/ppp/link file does not exist?
  5. humba

    humba Network Guru Member

    I think /tmp/ppp/link is only there if you use PPPoE.. if you're using DHCP (Cable, VDSL) the script isn't going to work (the path isn't here on my oldish Tomato either).
  6. pfoomer

    pfoomer LI Guru Member


    makes sense, I am on ADSL, not cable, so cannot check this, perhaps a cable based user can provide the equivalent file?

    This method is ok, but a bit slow in detecting disconnection/connection.

    Perhaps its better placed in the firmware, common to all modem types?

    Not sure what the WAN Up bit of the script menu is for, was not on the earlier versions AFAIK.
  7. zecoj

    zecoj Addicted to LI Member

    @humba: I thought so too
    @pfoomer: Sry, I meant "/tmp/ppp/link" does not exist. Also, the WAN UP script will be executed when WAN interface is up. But for my purpose, there should be a WAN DOWN script as well :p
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice