What's new

WANFailover Dual WAN Failover Script

  • 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!

Has anyone tried this script with a USB (cellular) Backup modem?
Yes, I have been testing this very config and @Ranger802004 has done some sterling work to accommodate the quirks. It’s been working really well for the last few betas. Still the odd minor niggle around “missing” notification emails sometimes, but the actual failover/fallback is very, very solid.
 
Last edited:
Yes, I have been testing this very config and @Ranger802004 has done some sterling work to accommodate the quirks. It’s been working really well for the last few betas. Still the odd minor niggle around “missing” notification emails sometimes, but the actual failover/fallback is very, very solid.
Which ones did you not get? This one is probably going to be a continuous improvement for awhile.
 
Which ones did you not get?
Latest one was some kind of glitch on the USB stick - I got the CONNECTED email when it came back online, but I never got the preceding DISCONNECTED email … I’ll pull you the log extract when I get back from my trip in a few days.
 
Good news!
@Ranger802004 looks like the cron for "wan-failover run" job appears to re-enabling the QoS on my faster WAN0 connection every hour (not respecting the conf file). I will do some digging to see if it's one of the other scripts but doubt it at this point.

Cheers!
 
@Ranger802004 looks like the cron for "wan-failover run" job appears to re-enabling the QoS on my faster WAN0 connection every hour (not respecting the conf file). I will do some digging to see if it's one of the other scripts but doubt it at this point.

Cheers!

If it were the cron job it would probably be doing it every 60 seconds since that is the interval it runs to make sure the script is running. When the script is actively running the cron job exits because the existing has the lock file locked preventing any further instances of the script to run while it is running.
 
If it were the cron job it would probably be doing it every 60 seconds since that is the interval it runs to make sure the script is running. When the script is actively running the cron job exits because the existing has the lock file locked preventing any further instances of the script to run while it is running.
k i will have a look at cake...
 
@Ranger802004

Just was reviewing your check for QoS and reset for QoS and I think we need to sync. For the CakeQoS script we check for QoS settings via

if [ "$(nvram get qos_enable)" != "1" ] || [ "$(nvram get qos_type)" != "9" ]; then
logger -t "$SCRIPT_NAME_FANCY" "Cake QoS not enabled in firmware. Skipping configuration."
return 1
fi
Is it possible for wan-failover to check for Cake QoS option as well and disable/enable as required?

Think your settings are here
[[ "$(nvram get qos_enable)" != "1" ]] && { nvram set qos_enable=1 && RESTARTSERVICESMODE=3 && logger -p 6 -t "${0##*/}" "Debug - QoS is Enabled" ;}

And
[[ "$(nvram get qos_enable)" != "0" ]] && { nvram set qos_enable=0 && STOPQOS=1 && logger -p 6 -t "${0##*/}" "Debug - QoS is Disabled" ;} || STOPQOS=0

I remember when @RMerlin added Cake, I think that check is required. @dave14305 should also be able to comment. I think when Cake checks this (which above wan-failover isn't checking/flipping)...
nvram get qos_type
still returns 9 and QoS gets re-enabled by Cake which has a hook in service-event

I might be wrong, so open to comments.
 
Last edited:
@Ranger802004

Just was reviewing your check for QoS and reset for QoS and I think we need to sync. For the CakeQoS script we check for QoS settings via


Is it possible for wan-failover to check for Cake QoS option as well and disable/enable as required?

Think your settings are here


And


I remember when @RMerlin added Cake, I think that check is required. @dave14305 should also be able to comment. I think when Cake checks this (which above wan-failover isn't checking/flipping)...

still returns 9 and QoS gets re-enabled by Cake which has a hook in service-event

I might be wrong, so open to comments.
Quite possible, so are you saying if Cake is selected type to not perform enable/disables?
 
Quite possible, so are you saying if Cake is selected type to not perform enable/disables?

Cake-QoS adds this to firewall-start

Code:
sh /jffs/addons/cake-qos/cake-qos startup # CakeQOS-Merlin

The code does this check first to see if QoS is disabled or Cake is not selected as QoS type.

Code:
    if [ "$(nvram get qos_enable)" != "1" ] || [ "$(nvram get qos_type)" != "9" ]; then
        Print_Output "true" "Cake QoS is not enabled. Skipping ${SCRIPT_NAME_FANCY} startup."
        return 1
    fi # Cake qos not enabled

If believe if wan-failover changes nvram get qos_type to something other than 9 would do the trick, If Cake QoS doesn't check for type then it could try running when FlexQoS is enabled and vice versa, so "type" of QoS becomes important.

I wonder if it is better to capture that as part of the individual WANx QoS settings in wan-failover?? QoS Type?? Cake, Flex, Traditional etc.

Cake here for reference: https://github.com/ttgapers/cakeqos-merlin/blob/master/cake-qos.sh

Thoughts?
 
Why would qos_type matter if it’s just enabling or disabling QoS? I don’t really understand the problem trying to be solved.
 
Why would qos_type matter if it’s just enabling or disabling QoS? I don’t really understand the problem trying to be solved.

@dave14305 - If I manually switch off QoS (toggle or via nvram set to 0), in less than one hour it is back on again. So trying to figure out "what" might be causing it. I know weird. Will have to spend some time to track it down. Just threw this out here for you primarily to comment on. Have you encountered this behaviour before? I was looking through all the possible hooks where cake-qos might restart QoS.

Thanks for chiming in, and hope my response helps. Will be able to dig a bit more over the (long) weekend.
 
Ok. Checked all my other custom scripts. Removed Cake, did some Flex cleanup and now QoS disabled. Will allow to sit before reinstalling Cake and setting to disabled sometime tomorrow.
 
Ok. Checked all my other custom scripts. Removed Cake, did some Flex cleanup and now QoS disabled. Will allow to sit before reinstalling Cake and setting to disabled sometime tomorrow.
Let us know the results
 
I published a minor revision to v1.5.7-beta2, you can run the update command to receive this revision.
 
Thanks for your work on this script. When running the update command I am getting "...wan-failover.sh is up to date - Version: v1.5.6". How do I get the latest bets version?
 
Thanks for your work on this script. When running the update command I am getting "...wan-failover.sh is up to date - Version: v1.5.6". How do I get the latest bets version?
DEVMODE was not incorporated into v1.5.6, it is the latest production release. You would have to manually upgrade to v1.5.7-beta which would create the new DEVMODE option to enable.
 

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

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