How to deactivate WiFi when internet connection is down?

Discussion in 'Tomato Firmware' started by Luke T, Apr 10, 2018.

  1. Luke T

    Luke T New Member Member

    I want to know how to set the Advanced Tomato router to turn off its WiFi when it looses internet connectivity? (and then turn it back on after connectivity is restored)

    Is there any way to do this? We need this desperately for a workaround to defective iOS firmware with broken WiFi Assist.

    Our main internet connection goes down fairly frequently, but all 21 iPads we have on the network all have LTE connectivity. However, iPads will NOT switch to cellular data if the WiFi network is still on, despite no connectivity (yes we have iOS WiFi Assist on, but if the Tomato is broadcasting a strong signal it won't use LTE regardless of whether there's no connectivity.... Apple hasn't fixed this bug yet). Our LTE internet plan is metered and fairly expensive, so I don't want to use it 100% of the time. Just the 1% time the main network is down.

    This seems pretty basic... wifi looses connectivity, tablet uses its LTE, right???!!!!

    Apple support says my router should stop broadcasting WiFi when internet connection goes down, but I never saw a router do this by default, or at all frankly. It's what I need though.

    And before someone says "just turn off the router or disable the WiFi when the internet goes down", these devices are used by a team of unskilled workers, and they would never remember to do this if the internet went down, let alone turn WiFi back on when the connection came back!

    And NO.... WiFi assist does not enable for a WiFi with no connection to the internet, unless you're in a Facetime call when the WiFi goes out, and it switches you to Cellular. Apple has not yet fixed this in iOS firmware.
  2. Sean B.

    Sean B. LI Guru Member

    There's no direct option for this designed into Tomato. However, the system scheduler combined with a simple custom script can do the job. Put this in the Custom 1 box under Administration->Scheduler, check the box for "Everyday" and select how often you want it to check for an internet down condition using the drop down "Time" box, which can be as frequent as every minute:

    RSTATE="$(wl -i eth1 radio)"
    WAN_TEST1="$(ping -qc 1 >/dev/null 2>&1; echo $?)"
    WAN_TEST2="$(ping -qc 1 >/dev/null 2>&1; echo $?)"
    if [ $RSTATE == 0x0000 ]
        if [ $WAN_TEST1 == 1 ] && [ $WAN_TEST2 == 1 ]
            logger "WAN connectivity checks failed! Disabling 2.4ghz WiFi radio."
            wl -i eth1 radio off
              elif [ $RSTATE == 0x0001 ]
                  if [ $WAN_TEST1 == 0 ] && [ $WAN_TEST2 == 0 ]
                      logger "WAN connectivity checks passed! Enabling 2.4ghz WiFi radio."
                      wl -i eth1 radio on
    At the time interval you chose in scheduler this script will: ping google, and if that fails it will ping amazon, if that also fails it will consider the WAN connection dead and shut off the 2.4ghz WiFi radio. It will then reverse its logic and ping google, if that succeeds it will ping amazon, if that also succeeds it will consider the WAN connection alive and turn the 2.4ghz WiFi radio back on.
  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