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!

PINGCOUNT=5
PINGTIMEOUT=1
WANDISABLEDSLEEPTIMER=5
BOOTDELAYTIMER=60
5 points. I understand you write that the detect failure time increases by the number of times the check is performed, I think it's even better!!
I'll set up 2 checks on all routers right now, it's more reliable, it's better to reduce the number of pings and the response time, but let it check 2 times better! Super Thanks!

Only I'll check tomorrow night, at the moment of maximum loading, when I have the most glitches. I'll write the results.
I may make the final iteration of this just utilize the ping count setting instead and work the same way as the recursive checks. That would make it more simple and it would be 1 setting to manage. But this is a beta so no harm no foul, I can create a cleanup function that can remove unused settings from testing.
 
I may make the final iteration of this just utilize the ping count setting instead and work the same way as the recursive checks. That would make it more simple and it would be 1 setting to manage. But this is a beta so no harm no foul, I can create a cleanup function that can remove unused settings from testing.
Do as you like, but this solution works! The main thing is not to break it ;)
 
Do as you like, but this solution works! The main thing is not to break it ;)
I can make it work the same way with just 1 setting and I prefer that to make it leaner and simpler to use.
 
I can make it work the same way with just 1 setting and I prefer that to make it leaner and simpler to use.
I checked right now, everything is OK, the solution works. I wrote yesterday that clients have no problems with ping, this is not true. The clients were behind the VPN. Without a VPN, clients also have problems with the first icmp packets. And in the same way, if you start ping, press CTRL-C and ping again, everything is ok. Something the provider has not configured correctly with ICMP packets.

I have a question. And at what moments is wan1 monitored? I am interested in this due to the fact that wan1 traffic is expensive for me. I understand wan0 pings almost always when it is active, when wan1 is active, and wan0 is also pinged for recovery. And when is the traffic spent via wan1?
 
Last edited:
You can configure it through the web interface of the "common" script, you can use the graphical interface of AMTM. But I do not know how it works, but it works flawlessly.
And how do you enter the web interface of email settings? I amtm found the email setup only via ssh
 
And how do you enter the web interface of email settings? I amtm found the email setup only via ssh
Initially, I configured via AMTM. After some time, about six months later, I installed addon "common" and found these settings in the GUI there. It's easier for you to communicate with me on here there and the native language I have two routers AX88U and AC86U I track the branch data.
 
Last edited:
A friend has problems. Everything works until you pull out the wan0 cable. If you pull out the wan0 cable, wan1 also stops working ;) As soon as you insert wan0 back, wan1 also continues to work ;)

And for some reason I stopped seeing the email amtm settings. Once I saw it normally, then I changed the settings a little and that's it, after that he writes Email Notifications are not configured. But the test email in amtm is normally sent
 
Last edited:
And for some reason I stopped seeing the email amtm settings. Once I saw it normally, then I changed the settings a little and that's it, after that he writes Email Notifications are not configured. But the test email in amtm is normally sent
Notifications also work every other time, but I think it's because of the settings as in the screenshot, but I don't know how to delete them, it gives the error "Please input the mail account!" when deleting the address and clicking apply.
 

Attachments

  • ASUS Wireless Router RT-AX88U - Network Protection - 192.168.1.1 - 18.07.2022_19_14_08.jpg
    ASUS Wireless Router RT-AX88U - Network Protection - 192.168.1.1 - 18.07.2022_19_14_08.jpg
    87.5 KB · Views: 63
I checked right now, everything is OK, the solution works. I wrote yesterday that clients have no problems with ping, this is not true. The clients were behind the VPN. Without a VPN, clients also have problems with the first icmp packets. And in the same way, if you start ping, press CTRL-C and ping again, everything is ok. Something the provider has not configured correctly with ICMP packets.

I have a question. And at what moments is wan1 monitored? I am interested in this due to the fact that wan1 traffic is expensive for me. I understand wan0 pings almost always when it is active, when wan1 is active, and wan0 is also pinged for recovery. And when is the traffic spent via wan1?
WAN0 and WAN1 are both actively monitored with ICMP Packets actively in both Failover and Load Balance Mode. In Failover Mode, it currently does not take any action on WAN1 having packet loss and that is something I'm going to expand in a later release.
 
A friend has problems. Everything works until you pull out the wan0 cable. If you pull out the wan0 cable, wan1 also stops working ;) As soon as you insert wan0 back, wan1 also continues to work ;)

And for some reason I stopped seeing the email amtm settings. Once I saw it normally, then I changed the settings a little and that's it, after that he writes Email Notifications are not configured. But the test email in amtm is normally sent
Read debug logs, amtm takes precedence over AIProtection Alerts. If amtm is not properly configured it will not be used and same for AIProtection Alerts which will send the not configured log.
 
A friend has problems. Everything works until you pull out the wan0 cable. If you pull out the wan0 cable, wan1 also stops working ;) As soon as you insert wan0 back, wan1 also continues to work ;)

And for some reason I stopped seeing the email amtm settings. Once I saw it normally, then I changed the settings a little and that's it, after that he writes Email Notifications are not configured. But the test email in amtm is normally sent
This is why, for some reason the router is losing its IP for both interfaces when 1 cable is unplugged. WAN Failover script is doing what it is suppose to do in this situation when both interfaces are reporting a WAN IP or Gateway IP as 0.0.0.0. This is something being caused by the router outside of the script.

Code:
    Строка  499: Jul 18 16:34:56 wan-failover.sh: WAN Failover Disabled - wan0 does not have a valid IP: 0.0.0.0 or Gateway IP Address: 0.0.0.0
    Строка  500: Jul 18 16:34:56 wan-failover.sh: WAN Failover Disabled - wan1 does not have a valid IP: 0.0.0.0 or Gateway IP Address: 0.0.0.0
 
This is why, for some reason the router is losing its IP for both interfaces when 1 cable is unplugged. WAN Failover script is doing what it is suppose to do in this situation when both interfaces are reporting a WAN IP or Gateway IP as 0.0.0.0. This is something being caused by the router outside of the script.

Code:
    Строка  499: Jul 18 16:34:56 wan-failover.sh: WAN Failover Disabled - wan0 does not have a valid IP: 0.0.0.0 or Gateway IP Address: 0.0.0.0
    Строка  500: Jul 18 16:34:56 wan-failover.sh: WAN Failover Disabled - wan1 does not have a valid IP: 0.0.0.0 or Gateway IP Address: 0.0.0.0

The second test worked for us. Testing. And according to my router: email seems to have turned out. Right now I pulled out the cable and this happened: all vpn clients turned off. (the on button has turned gray) Aren't they supposed to start over again?

But it returned from wan1 to wan0 normally, vpn clients all reconnected. In short, I have an opinion that everything is so poorly implemented at asus that even a good script is unlikely to fix it all:(
 
The second test worked for us. Testing. And according to my router: email seems to have turned out. Right now I pulled out the cable and this happened: all vpn clients turned off. (the on button has turned gray) Aren't they supposed to start over again?

But it returned from wan1 to wan0 normally, vpn clients all reconnected. In short, I have an opinion that everything is so poorly implemented at asus that even a good script is unlikely to fix it all:(
Something doesn't seem right with it losing both DHCP leases when 1 cable is unplugged, I haven't seen that on any other router I've been working on for developing this script. That is definitely strange.
 
That is my and @Ranger802004 goal which we already discussed briefly. Be patient, good things take time to perfect.
Just to add on here we’ve already discussed implementation steps and it is planned for down the road for a later release to come but right now i am focusing on operational issues with the script and optimizing performance and then I will shift gears towards our goal of amtm integration, please be patient it is in the works.
 
Not sure who sent me a donation tonight but just wanted to say thank you!
 
I can make it work the same way with just 1 setting and I prefer that to make it leaner and simpler to use.
After all, I couldn't stand it and bought a static ip from a provider for the test. The problem is gone :) https://drive.google.com/file/d/1SYV00wbt80EnCtp_8XfsZQ_qpB6rQnwx/view?usp=sharing
After 20 days I will check another provider :)

I came up with another function for the script. It would be good if the email notification contained an external ip received through the service myip.com or something similar.
 
Last edited:
I came up with another function for the script. It would be good if the email notification contained an external ip received through the service myip.com or something similar.
Shows not only the IP, but also the domain name.

***WAN Failback Notification***
----------------------------------------------------------------------------------------
Hostname: sinema.asuscomm.com
Event Time: Jul 19 15:21:23
Active ISP:
WAN IPv4 Address: 178.249.55.33
WAN Gateway IP Address: 178.249.55.254
WAN Interface: eth0
DNS: Managed by AdGuardHome
QoS Status: Enabled
QoS Mode: Manual Settings
QoS Download Bandwidth: 100Mbps
QoS Upload Bandwidth: 100Mbps
QoS WAN Packet Overhead: 48

***WAN Load Balancing Notification***
----------------------------------------------------------------------------------------
Hostname:sinema.asuscomm.com
Event Time: Jul 19 20:57:52
WAN0 IPv4 Address: 178.249.55.33
WAN0 Status: DISCONNECTED
WAN1 IPv4 Address: 192.168.199.100
WAN1 Status: CONNECTED
 
Last edited:
After all, I couldn't stand it and bought a static ip from a provider for the test. The problem is gone :) https://drive.google.com/file/d/1SYV00wbt80EnCtp_8XfsZQ_qpB6rQnwx/view?usp=sharing
After 20 days I will check another provider :)

I came up with another function for the script. It would be good if the email notification contained an external ip received through the service myip.com or something similar.
Ah good point, because of double NAT or CGNAT you aren’t able to see your actual IP. I like that and will look into it. I’m debating on leaving the recursive checks feature in place or not. Thoughts?
 

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