Dual WAN Failover Script

Ranger802004

Very Senior Member
I think, I found an issue during install:
My primary WAN0 is a PPPoE connection, my secondary WAN1 is a LTE USB-Stick.

WAN1 is in Cold-Standby:
View attachment 44334

During install, I see, that the script thinks WAN1 has 0.0.0.0

Code:
ASUSWRT-Merlin RT-AC86U 386.7_2 Sun Jul 24 21:39:14 UTC 2022
[email protected]:/tmp/home/root# /usr/sbin/curl -s "https://raw.githubusercontent.com/Ranger802004/asusmerlin/main/wan-failover.sh" -o "/jffs/scripts/wan-failover.sh" && chmod 755 /jffs/scripts/wan-failover.sh && sh /jffs/scripts/wan-
failover.sh install
wan-failover.sh - Install Mode
Press any key to continue to install...Administration > System > Enable JFFS custom scripts and configs is enabled...
Creating /jffs/configs/wan-failover.conf...
/jffs/configs/wan-failover.conf created.
Setting Custom Variables...
***WAN Target IP Addresses will be routed via WAN Gateway dev WAN Interface***
Configure WAN0 Target IP Address - Will be routed via 88.116.190.96 dev ppp0: 8.8.8.8
Configure WAN1 Target IP Address - Will be routed via 0.0.0.0 dev eth7:

WAN1 should have 192.168.8.1 in Hot-Standby.
Is it possible, that the script fires up WAN1 before install?
The script should put WAN1 in hot-standby in order to get the correct route-IP.
This will be included in v1.5.7-beta3 for testing, I have the code written and will update soon.
 

Ranger802004

Very Senior Member
this is my system messages log from dual wan enable restart.
I pulled the modem phone cable until desync and the script switched to wan1, plugged it in again.. after a while it reconnected but the script never switched back, i guess because it reports 100% packet loss.

Interestingly, this time around I'm able to reach the modem web-interface....

Let me know if you need anything else.



thank you.
It's doing everything right however the router cannot ping out of ppp0 for some reason even though it is adding the rule and routes correctly. Do this for me, put your router into this same condition again and when it appears "stuck" on not failing back issue the following command to the router.

Code:
service "restart_wan_if 0"
 

Ranger802004

Very Senior Member
v1.5.7-beta3 has been published to Beta Channel:

v1.5.7-beta3
Installation:
- Fixed during Uninstallation where Cleanup would error out due to not having configuration items loaded prior to deletion of configuration file.
- Fixed text formatting for debug logging during installation when selecting WAN IP Address Targets.
- If QoS is Disabled QoS Settings will Default to 0 instead of prompting for configuration.
- WAN Interface will now be restarted before configuration if it doesn't have a valid IP Address or Gateway IP.

Enhancements:
- Configuration Mode will instantly kill script and wait for it to be relaunched by Cron Job.
- WAN0 and WAN1 can be specified to have QoS Enabled or Disabled during Failovers.
- WAN0 and WAN1 Packet Size can be specified seperately in Configuration File.
- Custom Log Path can be specified for Monitor Mode using CUSTOMLOGPATH setting in Configuration Settings.
- Added Dev Mode to update to beta releases using Update Command
- Service Restarts triggered by USB Modem failure events when it is not the Primary WAN will only restart OpenVPN Server instances.
- Added Configuration Option CHECKNVRAM to Enable or Disable NVRAM Checks due to only certain routers needing this check such as the RT-AC86U.
- New Status UNPLUGGED for when a WAN interface connection is not physically present.
- Added Cron Job Mode Lock File to ensure only one instance of the cron job function can run at a time to help prevent duplication creations of the cron job.

Fixes:
- Configuration Mode will no longer delete new or current IP rules/routes and will delete old ones before restarting script.
- Switch WAN function will now properly check Default IP Routes for deletion and creation.
- Load Balance Mode will now properly get default WAN Status before performing checks
- Emails not generating when some scenarios of Secondary WAN failure occur in Failover Mode.
- Fixed issue where missing configuration items weren't checked with option name exact matches as well as for removing deprecated options.
- WAN Interface restart will occur in WAN Status if a previously configured Ping Path has been established and Packet Loss is not 0%
 

Ubimo

Senior Member
How do I clean install to latest beta? Is this the correct link/command:
Code:
/usr/sbin/curl -s "https://raw.githubusercontent.com/Ranger802004/asusmerlin/main/wan-failover-beta.sh" -o "/jffs/scripts/wan-failover.sh" && chmod 755 /jffs/scripts/wan-failover.sh && sh /jffs/scripts/wan-failover.sh install

@Ranger802004
Thanks, the latest beta fixed my problem.
 
Last edited:

Ubimo

Senior Member
Another issue I noticed:
When I manually run the command "service restart_wan", my WAN1 (LTE USB stick) switches from hot standby to cold standby. Can you please make it stay in hot standby after a wan restart?
 

Similar threads

Latest threads

Sign Up For SNBForums Daily Digest

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