What's new

RT-AC88U Script to check connection and dual wan optimize

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

tester83

Occasional Visitor
Hi all,

with the different firmware, often i have problem with dual wan. With some firmware failback doesn't work, with other firmware router skips the primary connection and it connects directly with the backup wan.
My settings is PRIMARY WAN: adsl (bridge router) and SECONDARY WAN (Backup): huawei e3372 lte.

I have tested all firmware, the best is 3.0.0.4.380_1354 (stock firmware asus), but now i'm testing Nerlin 380.60_beta2 and it seems to work.

I'm testing also a script that check with ping the connection and if the "ppp0" is found means that adsl is ready, if not adsl is down.
Generically i fix:
- the failback bug with a interface eth3 down
- the adsl in stand by (router show me primary wan with "connected" but i cannot reach anything via ping ) with a interface eth0 down and up
- if above commends doen't work i use service restart_wan

This is the script, executed every 5 minutes with cron. When i plug and unplug line cable of the modem to force to change to backup wan the router reboots. Why? Anyone can help me to optimize the script?

Code:
#!/bin/sh
if  ! ping -w 10 -c 10 www.google.it > /dev/null  &&  ! "`ifconfig | grep ppp0`" = "" ; then
    ifconfig eth3 down
    if  ! ping -w 10 -c 10 www.google.it > /dev/null  &&  ! "`ifconfig | grep ppp0`" = "" ; then
        ifconfig eth0 down
        sleep 10
        ifconfig eth0 up

        if ! ping -w 10 -c 10 www.google.it > /dev/null; then
            service restart_wan
           
            if ! ping -w 10 -c 10 www.google.it > /dev/null; then
                reboot
            fi
        fi
    fi
else
    if  ! ping -w 10 -c 10 www.google.it > /dev/null  &&  "`ifconfig | grep ppp0`" = "" ; then
        ifconfig eth0 down
    fi
fi
 

Latest threads

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top