What's new

[beta] Dual WAN helper script (discontinued)

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

Is "Enable Ping to Internet" enabled?
Sure! I made no changes to the router's settings for many weeks. It worked ok with beta1.
As far as i understand from my updated log - failback works but after many minus numbers..
I guess it's your walkaround for my problem with email sending only after long timeout passes.
Then the problem is with:
ping: sendto: Network is unreachable
 
I remember that there were no numbers with minuses in beta1 for sure.
That really should not happen...
ping: sendto: Network is unreachable
I see this on Merlin as well as john's LTS when I pull the cable on the router.
If I test it with real world problem (one of the WAN's is down) then not, I'm not pulling the cable, just block access to WAN to test it..
 
That really should not happen...
So all the numbers should be positive?
If I test it with real world problem (one of the WAN's is down)
Unfortunately it is real world problem for me because when 220 goes down - my router switches to UPS and main isp's line "unplugs" itself without 220V.
In beta1 emails were perfectly sent at least after huge timeout. Which is a bit better then not getting emails at all lol.
 
Hmmm
ping OK, Primary-WAN, 10.13.70.222, WAN test in 92, Progressive timeout 0
...
ping OK, Primary-WAN, 10.13.70.222, WAN test in -1092, Progressive timeout 0

It gives more then 1100 together and it is not going to stop. Where dows it get such a huge timeout number when ~980 is maximum?
 
So all the numbers should be positive?
Absolutely, once it gets to:
ping OK, Secondary-WAN, 192.168.0.111, WAN test in 12, Progressive timeout 0
ping OK, Secondary-WAN, 192.168.0.111, WAN test in 4, Progressive timeout 0
It should trigger it, but it jumps over the 0 mark because the step is 8.
I may have made a mistake, I just used your settings and receive no mail. Let me run it in verbose to be sure.
Thanks for reporting and testing!
 
Thanks for reporting and testing!
No problem, i like the process :)

It would be perfect in future releases to be able to set for example
failover: 2 times, 2 seconds = 4 seconds
failback: 5 times, 360 seconds = 30 minutes.
It means that router will switch to primary just for 4sec to check if it is still down. If so - than switch to secondary for 30 minutes.
I think it is not such a big problem to do so, the same way you did with even numbers. Script can calculate its own multiplicators to use numbers from router's ui and change them to numbers set in additional script settings for failover and failback count and timeout.
 
It gives more then 1100 together and it is not going to stop. Where dows it get such a huge timeout number when ~980 is maximum?
The timeout is capped at 100/110 maximum hard coded with this:
Code:
[ "$PING_COUNT" -gt "100" ] && PING_COUNT=$((100 + $WANDOG_INTERVAL))
WAN_SUCCESSFUL=$(($WANDOG_INTERVAL * $WANDOG_FB_COUNT - $WANDOG_INTERVAL))
[ "$WAN_SUCCESSFUL" -gt "100" ] && WAN_SUCCESSFUL=$((100 - $WANDOG_INTERVAL))

But it gets into the minus range because it jumps over the trigger when it reaches 0.
Let me check...
 
The timeout is capped at 100/110 maximum hard coded with this:
ping OK, Primary-WAN, 10.13.70.222, WAN test in -1748, Progressive timeout 0
lol
may be it is easier not to fix beta2 but to make customizable settings for failback and failover like i wrote in previous message?
 
It would be perfect in future releases to be able to set for example
failover: 2 times, 2 seconds = 4 seconds
failback: 5 times, 360 seconds = 30 minutes.
Until I fix this minor bug, can you set:
9 / 8 / 98
This will trigger the email for sure.
 
Until I fix this minor bug, can you set:
9 / 8 / 98
This will trigger the email for sure.
or
9/6/99

WANDOG_INTERVAL = 10 (real setting 9)
WANDOG_MAXFAIL = 6 (6)
WANDOG_FB_COUNT = 100 (99)


like you said before?

is it possible to set maxfail to smth less then 8? Because it will give at least 80 seconds without internet if primary wan is down..
 
or
9/6/99

WANDOG_INTERVAL = 10 (real setting 9)
WANDOG_MAXFAIL = 6 (6)
WANDOG_FB_COUNT = 100 (99)


like you said before?

is it possible to set maxfail to smth less then 8? Because it will give at least 80 seconds without internet if primary wan is down..
Whatever triggers the WAN test is good for now.
If it goes into the minus range it will not work.
The minimum setting will be 2 for all of them since I make all the numbers even, so 1 becomes a 2, 99 becomes 100.
This is for simplicity on my side. But 2 seconds will work once I work out how to trigger the WAN test correctly.
It may even work with uneven numbers then, we'll see.
 
This is what it looks like if all runs well:
Code:
 ---------------------------------------------
 Settings used for dual-wan-helper 1.0 beta 2

 WANDOG_INTERVAL = 10 (real setting 9)
 WANDOG_MAXFAIL  = 8 (8)
 WANDOG_FB_COUNT = 98 (98)

 SLEEP_TIMEOUT   = 10
 PING_COUNT      = 90
 WAN_SUCCESSFUL  = 90

 SEND_MAIL       = on
 ---------------------------------------------

 Primary-WAN reported
 ping OK, Primary-WAN, 3.3.3.100, WAN test in 90, Progressive timeout 0
 ping OK, Primary-WAN, 3.3.3.100, WAN test in 80, Progressive timeout 0
 ping OK, Primary-WAN, 3.3.3.100, WAN test in 70, Progressive timeout 0
 ping OK, Primary-WAN, 3.3.3.100, WAN test in 60, Progressive timeout 0
 ping OK, Primary-WAN, 3.3.3.100, WAN test in 50, Progressive timeout 0
 ping OK, Primary-WAN, 3.3.3.100, WAN test in 40, Progressive timeout 0
 ping OK, Primary-WAN, 3.3.3.100, WAN test in 30, Progressive timeout 0
 ping OK, Primary-WAN, 3.3.3.100, WAN test in 20, Progressive timeout 0
 ping OK, Primary-WAN, 3.3.3.100, WAN test in 10, Progressive timeout 0

 WAN type change on Fri, 11 Aug 2017 12:36:23 +0200
 WAN type = Primary-WAN, sending WAN change mail

 AB-Solution email.cfg file found but settings are incomplete.
 Use AB-Solution 'rs' option 6 to complete the settings.

 dual-wan-helper.cfg found and verified, using it as source

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   552    0     0  100   552      0    477  0:00:01  0:00:01 --:--:--   486

 ping OK, Primary-WAN, 3.3.3.100, WAN test in 90, Progressive timeout 0
 ping OK, Primary-WAN, 3.3.3.100, WAN test in 80, Progressive timeout 0
 ping OK, Primary-WAN, 3.3.3.100, WAN test in 70, Progressive timeout 0
 ping OK, Primary-WAN, 3.3.3.100, WAN test in 60, Progressive timeout 0
 ping OK, Primary-WAN, 3.3.3.100, WAN test in 50, Progressive timeout 0
 ping OK, Primary-WAN, 3.3.3.100, WAN test in 40, Progressive timeout 0
 ping OK, Primary-WAN, 3.3.3.100, WAN test in 30, Progressive timeout 0
 ping OK, Primary-WAN, 3.3.3.100, WAN test in 20, Progressive timeout 0
 ping OK, Primary-WAN, 3.3.3.100, WAN test in 10, Progressive timeout 0
 No WAN type change to report
 ping OK, Primary-WAN, 3.3.3.100, WAN test in 100, Progressive timeout 10
 ping OK, Primary-WAN, 3.3.3.100, WAN test in 90, Progressive timeout 10
 ping OK, Primary-WAN, 3.3.3.100, WAN test in 80, Progressive timeout 10
 ping OK, Primary-WAN, 3.3.3.100, WAN test in 70, Progressive timeout 10
 ping OK, Primary-WAN, 3.3.3.100, WAN test in 60, Progressive timeout 10
 ping OK, Primary-WAN, 3.3.3.100, WAN test in 50, Progressive timeout 10
 ping OK, Primary-WAN, 3.3.3.100, WAN test in 40, Progressive timeout 10
 ping OK, Primary-WAN, 3.3.3.100, WAN test in 30, Progressive timeout 10
 ping OK, Primary-WAN, 3.3.3.100, WAN test in 20, Progressive timeout 10
 No WAN type change to report
 ping OK, Primary-WAN, 3.3.3.100, WAN test in 110, Progressive timeout 20
 ping OK, Primary-WAN, 3.3.3.100, WAN test in 100, Progressive timeout 20
 ping OK, Primary-WAN, 3.3.3.100, WAN test in 90, Progressive timeout 20
 ping OK, Primary-WAN, 3.3.3.100, WAN test in 80, Progressive timeout 20
 ping OK, Primary-WAN, 3.3.3.100, WAN test in 70, Progressive timeout 20
Never mind the AB-Solution error, this is intended for testing...
 
This is what it looks like if all runs well:
Now it works ok with 9/2/99
So for now the only problem is that first number should be NOT 8 (and not 7 as well)?
And i see a second bug that it takes almost 2 minutes to send email notification when primary wan is physically disconnected (with previous email notification script it took 5-10 seconds):
Aug 11 13:49:00 WAN(0)_Connection: WAN was exceptionally disconnected.
...
Aug 11 13:50:47 admin: dual-wan-helper: WAN type change detected, WAN type = Secondary-WAN, via /jffs/scripts/dual-wan-helper
Aug 11 13:50:50 admin: dual-wan-helper: WAN type change detected, notification sent to avoronkov@gmail.com via /jffs/scripts/dual-wan-helper
 
Now it works ok with 9/2/99
So for now the only problem is that first number should be NOT 8 (and not 7 as well)?
And i see a second bug that it takes almost 2 minutes to send email notification when primary wan is physically disconnected (with previous email notification script it took 5-10 seconds):
Aug 11 13:49:00 WAN(0)_Connection: WAN was exceptionally disconnected.
...
Aug 11 13:50:47 admin: dual-wan-helper: WAN type change detected, WAN type = Secondary-WAN, via /jffs/scripts/dual-wan-helper
Aug 11 13:50:50 admin: dual-wan-helper: WAN type change detected, notification sent to avoronkov@gmail.com via /jffs/scripts/dual-wan-helper
The timeout setting determines how long it takes to send the mail.
The lower, the sooner. Let me fix this minus thing first, then you can change it back to your preferred setting.
 
Let me fix this minus thing first, then you can change it back to your preferred setting.
9/2/99 is ok for me for now because i need maximum failback timeout and minimum failover time. To have at least 12-15 minutes of proper internet before stupid asus switches back to primary which is down and breaks connection for almost 25-30 seconds.
Custom failback and failover counts and timeouts in script's code would be perfect.
The timeout setting determines how long it takes to send the mail.
Don't quite understand how these two things are connected. Why does the email part of the script need to wait for some timeout when is switches from primary to secondary? Switching takes less then 25 seconds (failover timeout 18 sec and switching itself) - but it sends email only after almost 2 minutes.
 
By the way! When being connected to secondary WAN - Asus 100% sees the state of primary wan cable. As soon as i unplug cable - UI says cable not connected. When i plug cable back - it says smth like standby - but still stays on secondary. I think this standby status after "cable not connected" can somehow be used as a trigger in your script to switch back to primary before failback timer runs out. Didn't think a lot about it - but it is still a status that is changed even when router is connected via secondary wan.
UPD. No i am wrong. Standby status appears right after "Cable disconnected" - even if cable is still disconnected.
UPD2. Is says "cable disconnected" after "standby" and after "cable disconnected". While cable is disconnected all that time. So this trigger cannot be used for any script because it is not reliable.
 
By the way! When being connected to secondary WAN - Asus 100% sees the state of primary wan cable. As soon as i unplug cable - UI says cable not connected. When i plug cable back - it says smth like standby - but still stays on secondary. I think this standby status after "cable not connected" can somehow be used as a trigger in your script to switch back to primary before failback timer runs out. Didn't think a lot about it - but it is still a status that is changed even when router is connected via secondary wan.
UPD. No i am wrong. Standby status appears right after "Cable disconnected" - even if cable is still disconnected.
It only looks at the port state, not the actual connection to WAN for the non-active WAN port. Hence Asus switches back to the inactive primary WAN to see if WAN has come up.
When the port is down this is noticed immediately, which is not of interest to my script and unhelpful until the WAN state changes in nvram to me.
 
Dual WAN helper beta 3 is now available

What's new
- removed odd-to-even-number settings conversion, settings are used as is now
- (should) send email sooner and every time now and not fall into negative numbers
- max timeout is now lowered to 80 if above and NTP is auto-increased if lower than 2 for a reasonable timeout
- additional info in start screen when run in verbose mode, NTP timeouts and ping domain added
 
Dual WAN helper beta 3 is now available
seems to work ok. Didn't try in verbose mode - not much time for testing now.
And it takes almost 2 minutes for the notification when i unplug wan cable.

Aug 11 19:19:42 WAN(0)_Connection: WAN was exceptionally disconnected.
Aug 11 19:19:46 WAN(0)_Connection: Ethernet link down.
....
Aug 11 19:21:25 admin: dual-wan-helper: WAN type change detected, WAN type = Secondary-WAN, via /jffs/scripts/dual-wan-helper
Aug 11 19:21:28 admin: dual-wan-helper: WAN type change detected, notification sent to avoronkov@gmail.com via /jffs/scripts/dual-wan-helper

Thank you very much. Will be waiting for custom failback and failover count and timers in future releases.
 
Hmmm i was to fast.
Failback is not working.

Aug 11 19:20:54 WAN(1)_Connection: WAN was restored.

dual wan settings are 9 / 2 / 99

now it is 19:43 - but failback didn't happen.
 

Latest threads

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