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!

Could you please highlight the part of the code you change - not to make all the settings from the very beginning. Thanx!
There's only one setting, sending mail or not...
 
Doesn't Asuswrt have a C-code program wanduck to do the wan down up check, won't there be a conflict, or could your investigations fix it?
 
Doesn't Asuswrt have a C-code program wanduck to do the wan down up check, won't there be a conflict, or could your investigations fix it?
It sure does, and it's working more or less ok.
If it doesn't then this helper restarts the WAN service.
It does this by using the same settings plus extra timeout to check if ping to set domain works. If not, it will restart.

This is the idea behind it and why it's called helper.
 
Also @mstombs it can send a notification with the type of WAN up, the IP and more.
 
That's what I'm changing now. The high count prevents the WAN type change email for a long time until it reaches 0.
So you say you are using failback and failover timeouts with small numbers like 8 seconds? Don't you feel internet gaps when switching? I have satellite share which freezes every time when wan0 switches to wan1 and back. When wan0 is down - this switching takes more then 10 seconds with your numbers. And it repeats several times per minute. I think such internet connection is unusable. It would be great to set failback time to at least 30 minutes and failover time to 2-4 seconds. What's your opinion?
 
And still i don't understand one thing. For example failback time is 300 sec and failover time is 10 sec.
Wan0 goes down - router waits for 10 seconds - switches to wan1 - starts 300 sec countdown, pinging wan1. If wan1 goes down for some time - router switches back to wan0 even if it it down as well. For how many seconds will the router stay on wan0 before switching back to wan1? 300 seconds or 10 seconds?
Or 300 seconds is timeout when connection is pingable before changing wan type and 10 seconds is for timeout when connection is not pingable - for any type of wan?
 
I mean all email settings and email text compilation which i change for pushover application.
If you have AB-Solution installed I could include the email.cfg file, this would save the manual entering of the settings.
 
No, email script was the first i tried )
Then I'll separate the two so it does not have to be changed every time I make a change.
It'll look for the AB file first and if not found will include the separate file.
 
Then I'll separate the two so it does not have to be changed every time I make a change.
It'll look for the AB file first and if not found will include the separate file.
It's not the most important part, i updated settings within previous script 1.0-1.7 versions without any problem. The only problem i am facing right now - is the one we discussed yesterday. I am recieving emails only after failback timeout. Thanx!
 
Dual WAN helper beta 2 is now available

What's new
- email credentials are now moved to separate file
Fill in credentials in dual-wan-helper.cfg and place it as /jffs/dual-wan-helper.cfg
If you have AB-Solution installed and have set the email settings there, this file will be used if found, the dual-wan-helper.cfg is not required in this case.

- NTP timeout is now logged to syslog and the timeouts are derived from the WAN settings
- email is sent as soon as WAN type is up and confirmed after a maximum timeout of 110 seconds. This depends on the WAN settings.
- when run in verbose mode, output is more helpful
- progressive ping interval. When WAN type is steady, less pings are sent
- if the email cannot be sent for some reason, it will try to send it again
- requirement to only use even numbers eliminated, odd numbers are auto-rounded to the next higher even number.
 
Dual WAN helper beta 2 is now available
Thank you very much!
1. It still says beta1 and 30 july in the code.
2. I still don't get email notifications after router reboots. The last thing i see from the dual-wan-helper in logs is:
Aug 1 03:01:08 admin: dual-wan-helper: NTP not ready, cycle 14 of 32 via /jffs/scripts/dual-wan-helper
3. Same problem when i unplug primary wan cable - it switches perfectly, but doesn't send email. The only thing i see from the script is:
Aug 11 12:39:42 admin: dual-wan-helper: Prevented second instance of this script, lockfile exists. via /jffs/scripts/dual-wan-helper
And nothing about sending email.
 
What's new

Well .... failback started working really strange as well

/jffs/scripts$ /jffs/scripts/dual-wan-helper kill
Terminated
/jffs/scripts$ /jffs/scripts/dual-wan-helper

---------------------------------------------
Settings used for dual-wan-helper 1.0 beta 1

WANDOG_INTERVAL = 8 (real setting 8)
WANDOG_MAXFAIL = 2 (2)
WANDOG_FB_COUNT = 98 (98)

SLEEP_TIMEOUT = 8
PING_COUNT = 24
WAN_SUCCESSFUL = 92

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

Secondary-WAN reported
ping OK, Secondary-WAN, 192.168.0.111, WAN test in 92, Progressive timeout 0
ping OK, Secondary-WAN, 192.168.0.111, WAN test in 84, Progressive timeout 0
ping OK, Secondary-WAN, 192.168.0.111, WAN test in 76, Progressive timeout 0
ping OK, Secondary-WAN, 192.168.0.111, WAN test in 68, Progressive timeout 0
ping OK, Secondary-WAN, 192.168.0.111, WAN test in 60, Progressive timeout 0
ping OK, Secondary-WAN, 192.168.0.111, WAN test in 52, Progressive timeout 0
ping OK, Secondary-WAN, 192.168.0.111, WAN test in 44, Progressive timeout 0
ping OK, Secondary-WAN, 192.168.0.111, WAN test in 36, Progressive timeout 0
ping OK, Secondary-WAN, 192.168.0.111, WAN test in 28, Progressive timeout 0
ping OK, Secondary-WAN, 192.168.0.111, WAN test in 20, Progressive timeout 0
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
ping OK, Secondary-WAN, 192.168.0.111, WAN test in -4, Progressive timeout 0
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 -20, Progressive timeout 0
ping OK, Secondary-WAN, 192.168.0.111, WAN test in -28, Progressive timeout 0
ping OK, Secondary-WAN, 192.168.0.111, WAN test in -36, Progressive timeout 0
ping OK, Secondary-WAN, 192.168.0.111, WAN test in -44, Progressive timeout 0
ping OK, Secondary-WAN, 192.168.0.111, WAN test in -52, Progressive timeout 0
ping OK, Secondary-WAN, 192.168.0.111, WAN test in -60, Progressive timeout 0
ping OK, Secondary-WAN, 192.168.0.111, WAN test in -68, Progressive timeout 0
ping OK, Secondary-WAN, 192.168.0.111, WAN test in -76, Progressive timeout 0
ping OK, Secondary-WAN, 192.168.0.111, WAN test in -84, Progressive timeout 0
ping OK, Secondary-WAN, 192.168.0.111, WAN test in -92, Progressive timeout 0
ping OK, Secondary-WAN, 192.168.0.111, WAN test in -100, Progressive timeout 0
ping OK, Secondary-WAN, 192.168.0.111, WAN test in -108, Progressive timeout 0
ping OK, Secondary-WAN, 192.168.0.111, WAN test in -116, Progressive timeout 0
ping OK, Secondary-WAN, 192.168.0.111, WAN test in -124, Progressive timeout 0
ping OK, Secondary-WAN, 192.168.0.111, WAN test in -132, Progressive timeout 0
ping NOK, restarting WAN in 24
ping NOK, restarting WAN in 16
ping: sendto: Network is unreachable
Primary-WAN reported
ping NOK, restarting WAN in 8

restarting WAN now!

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 84, Progressive timeout 0
ping OK, Primary-WAN, 10.13.70.222, WAN test in 76, Progressive timeout 0
ping OK, Primary-WAN, 10.13.70.222, WAN test in 68, Progressive timeout 0
ping OK, Primary-WAN, 10.13.70.222, WAN test in 60, Progressive timeout 0
 
Well .... failback stopped working as well..

/jffs/scripts$ /jffs/scripts/dual-wan-helper kill
Terminated
/jffs/scripts$ /jffs/scripts/dual-wan-helper

---------------------------------------------
Settings used for dual-wan-helper 1.0 beta 1

WANDOG_INTERVAL = 8 (real setting 8)
WANDOG_MAXFAIL = 2 (2)
WANDOG_FB_COUNT = 98 (98)

SLEEP_TIMEOUT = 8
PING_COUNT = 24
WAN_SUCCESSFUL = 92

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

Secondary-WAN reported
ping OK, Secondary-WAN, 192.168.0.111, WAN test in 92, Progressive timeout 0
ping OK, Secondary-WAN, 192.168.0.111, WAN test in 84, Progressive timeout 0
ping OK, Secondary-WAN, 192.168.0.111, WAN test in 76, Progressive timeout 0
ping OK, Secondary-WAN, 192.168.0.111, WAN test in 68, Progressive timeout 0
ping OK, Secondary-WAN, 192.168.0.111, WAN test in 60, Progressive timeout 0
ping OK, Secondary-WAN, 192.168.0.111, WAN test in 52, Progressive timeout 0
ping OK, Secondary-WAN, 192.168.0.111, WAN test in 44, Progressive timeout 0
ping OK, Secondary-WAN, 192.168.0.111, WAN test in 36, Progressive timeout 0
ping OK, Secondary-WAN, 192.168.0.111, WAN test in 28, Progressive timeout 0
ping OK, Secondary-WAN, 192.168.0.111, WAN test in 20, Progressive timeout 0
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
ping OK, Secondary-WAN, 192.168.0.111, WAN test in -4, Progressive timeout 0
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 -20, Progressive timeout 0
ping OK, Secondary-WAN, 192.168.0.111, WAN test in -28, Progressive timeout 0
ping OK, Secondary-WAN, 192.168.0.111, WAN test in -36, Progressive timeout 0
ping OK, Secondary-WAN, 192.168.0.111, WAN test in -44, Progressive timeout 0
ping OK, Secondary-WAN, 192.168.0.111, WAN test in -52, Progressive timeout 0
The release date and beta 2 changes are done and uploaded, no other changes made to file.

Let me test it with your settings on my router, I usually have these set:
WANDOG_INTERVAL = 10 (real setting 9)
WANDOG_MAXFAIL = 6 (6)
WANDOG_FB_COUNT = 100 (99)
 
Let me test it with your settings on my router, I usually have these set:
Plz see my updated post with full log. I remember that there were no numbers with minuses in beta1 for sure. And now i see
ping: sendto: Network is unreachable
That is new for sure..
 

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