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!

Cable inserted - 2
The cable is pulled out - 3
I inserted the cable, again all the time 2


I don't understand why it restores to the main wan 2 times
 
Last edited:
another router (the first ax88u. this ax86u), the one where I have more problems. The provider is the same, only the ip is not static, but for NAT.

The delay before the start helps a little

nvram set wan0_state_t all the time 2


p.s. Look, it says 180 delay (as in the config), but actually 90 ;)
 
I have a setup of 5 pings for 2 seconds. Why he reports after 6 seconds? Here I would like to insert the delay that WANDISABLEDSLEEPTIMER =60

Jun 26 13:15:00 wan-failover.sh: WAN Status - Added IP Rule for 1.1.1.1
Jun 26 13:15:06 wan-failover.sh: WAN Status - wan0 has 100% packet loss ***Verify 1.1.1.1 is a valid server for ICMP Echo Requests***

p.s. It seems that all timers are reduced by 2 times relative to the settings
 
After spending another day with this great scripts I have a feature suggestion:
Add a configurable parameter for an additional route entry for each WAN (or at least the standby WAN):
This route entry allows to check the status of a standby Modem while not in use.

In my case:
My Cablemodem is the standby and can be reached at 192.168.100.1 but not while the WAN is in standby.
I manually added a route using the same syntax as the route entry for the DNS probe on WAN1 - in my case with LAN4 on the RT-AX86U as the port this is the command I used - with x.x.x.x being the gateway IP that the DNS probe entry also uses and it seems to be working:
Code:
ip route add 192.168.100.1 via x.x.x.x dev eth1

Thanks again for a great script!
 
another router (the first ax88u. this ax86u), the one where I have more problems. The provider is the same, only the ip is not static, but for NAT.

The delay before the start helps a little

nvram set wan0_state_t all the time 2


p.s. Look, it says 180 delay (as in the config), but actually 90 ;)
The delay is based on system uptime, not 180 seconds from when the delay starts. So your setting is saying to wait until system uptime is atleast 180 seconds.
 
After spending another day with this great scripts I have a feature suggestion:
Add a configurable parameter for an additional route entry for each WAN (or at least the standby WAN):
This route entry allows to check the status of a standby Modem while not in use.

In my case:
My Cablemodem is the standby and can be reached at 192.168.100.1 but not while the WAN is in standby.
I manually added a route using the same syntax as the route entry for the DNS probe on WAN1 - in my case with LAN4 on the RT-AX86U as the port this is the command I used - with x.x.x.x being the gateway IP that the DNS probe entry also uses and it seems to be working:
Code:
ip route add 192.168.100.1 via x.x.x.x dev eth1

Thanks again for a great script!
I do that as well, but because there are too many variables to that and sometimes MASQUERADE rules are needed for that to work properly because of NAT, I feel it may be something that would have to be left for custom configuration. Not a bad idea just see a lot of potential for more issues because of everyone's configuration being so different. Maybe can add that to the readme, some basic instructions on how to configure that.
 
Last edited:
I have a setup of 5 pings for 2 seconds. Why he reports after 6 seconds? Here I would like to insert the delay that WANDISABLEDSLEEPTIMER =60

Jun 26 13:15:00 wan-failover.sh: WAN Status - Added IP Rule for 1.1.1.1
Jun 26 13:15:06 wan-failover.sh: WAN Status - wan0 has 100% packet loss ***Verify 1.1.1.1 is a valid server for ICMP Echo Requests***

p.s. It seems that all timers are reduced by 2 times relative to the settings
WAN Status doesn't adhere to "timers", only when you are in WAN0 Failover Monitor or WAN0 Failback Monitor. WAN Status is building the necessary IP Rules/routes and then testing functionality in which it does use the PINGTIMEOUT and PINGCOUNT variables. Also there can be delays of code execution during all of these functions, the Ping Timeout is the timeout for how long an individual ping will wait for a reply before it is considered a failed ping, the ping count is just how many ping attempts there will be. Also, if your WAN0 is staying in State 2 while it's not able to ping then there is something else going on that may need further testing. The router with the script keeps both interfaces connected with one as the active connection and one in Hot-standby, so there is no delay in getting an "IP" or anything like that. Is it possible this router has a fault somewhere? What firmware version are you running?
 
Cable inserted - 2
The cable is pulled out - 3
I inserted the cable, again all the time 2


I don't understand why it restores to the main wan 2 times
Because when it returned to WAN Status it received 20% Packet Loss and the script marks that as DISCONNECTED while in WAN Status which is not the same as Failover Monitor/Failback Monitor, they log this information but don't change the links. So When the 20% packet loss occurs, WAN Status makes WAN1 Primary and sets script into Failback Monitor Mode and then when WAN0 gets 0% packet loss it switches it back. Again, root cause here is the packet loss issue you are experiencing.
 
i had installed this script a week ago on my AX11000 and went on a trip , when i came back wifey kept saying net is getting disconnected some times, i thought it would be the wan switching happening but today experienced it for myself . When their is a fail back the whole router goes down for some time their is nothing in the logs , during that time lan goes down , wifi goes down, don't know what was happening, so tried uninstalling and it crashed the router .Script still not uninstalled .


1656325184289.png





Had to manually reboot the router every time . Please help

syslog :https://drive.google.com/file/d/1-EAsEupD7vYLBdq7knY4ufOEGPeBW62s/view?usp=sharing
 
Last edited:
i tried to reenable asus failback and the router went for a restart and never came back up , no other option other than a factory reset
 
i had installed this script a week ago on my AX11000 and went on a trip , when i came back wifey kept saying net is getting disconnected some times, i thought it would be the wan switching happening but today experienced it for myself . When their is a fail back the whole router goes down for some time their is nothing in the logs , during that time lan goes down , wifi goes down, don't know what was happening, so tried uninstalling and it crashed the router .Script still not uninstalled .


View attachment 42228




Had to manually reboot the router every time . Please help

syslog :https://drive.google.com/file/d/1-EAsEupD7vYLBdq7knY4ufOEGPeBW62s/view?usp=sharing

I’m trying to figure out what is causing your issue. You have the same exact router I use to write and test the script. There’s nothing in system log during these crashes? At least at the time you tried to uninstall it appears it cannot read the file system on the router, I wonder if you have a flash failure occurring?
 
I’m trying to figure out what is causing your issue. You have the same exact router I use to write and test the script. There’s nothing in system log during these crashes? At least at the time you tried to uninstall it appears it cannot read the file system on the router, I wonder if you have a flash failure occurring?

not sure , i just did a reset, my backup was too old so had to start from scratch , too tired to try anything now , will let you know once i try
 
not sure , i just did a reset, my backup was too old so had to start from scratch , too tired to try anything now , will let you know once i try
No worries just let me know, perhaps try the 1.5.3-beta when you reinstall fail over. You definitely had some weird issues going on with your router but I don’t think the root cause was the script. Hopefully it was resolved in the factory reset.
 
No worries just let me know, perhaps try the 1.5.3-beta when you reinstall fail over. You definitely had some weird issues going on with your router but I don’t think the root cause was the script. Hopefully it was resolved in the factory reset.
Fresh install working fine till now , I'm gona let it run like this for couple of days and see
 
Fresh install working fine till now , I'm gona let it run like this for couple of days and see
Did the fresh install resolve your issues?
 
I wanted to give an update on my v1.5.3

So far eveything is working fine. I even enabled AiProtection and setup email notification in it using my “notification” gmail account. I setup an app password in gmail, entered those parameters in AiProtection and now I get email notifications from the script when there is a failover/fallback event.

Works great!
 
I wanted to give an update on my v1.5.3

So far eveything is working fine. I even enabled AiProtection and setup email notification in it using my “notification” gmail account. I setup an app password in gmail, entered those parameters in AiProtection and now I get email notifications from the script when there is a failover/fallback event.

Works great!

I have a minor thing I added for the next release where it won’t email for the first failback that occurs at boot up because of the firmware. Basically just won’t alert for failback for the first 60 seconds of up time.
 
У меня есть небольшая вещь, которую я добавил для следующего выпуска: он не будет отправлять электронную почту для первого восстановления после сбоя, которое происходит при загрузке из-за прошивки. В основном просто не будет предупреждать о отказе в течение первых 60 секунд времени безотказной работы.
Hello. Is there no way to make email notification settings from amtm and through it, and not through Ai Protection? Ai Protection notifications have never worked for me, even on a router with clean firmware.
 

Attachments

  • email.png
    email.png
    157.5 KB · Views: 51

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