Ranger802004
Very Senior Member
WAN Failover is designed to replace the factory ASUS WAN Failover functionality, this script will monitor the WAN Interfaces using a Target IP Address and pinging these targets to determine when a failure occurs. When a failure is detected in Failover Mode, the script will switch to the Secondary WAN interface automatically and then monitor for failback conditions. When the Primary WAN interface connection is restored based on the Target IP Address, the script will perform the failback condition and switch back to Primary WAN. When a failure is detected in Load Balancing Mode, the script will remove the down WAN interface from Load Balancing and restore it when it is active again.
Requirements:
- ASUS Merlin Firmware v386.9 or higher
- JFFS custom scripts and configs Enabled
- Dual WAN Enabled
- ASUS Factory Failover Disabled (Network Monitoring Options, Allow Failback Option under WAN > Dual WAN)
Installation:
amtm
or
Command Line:
Updating:
Use Menu Option 6 or Run the Following Command
Uninstallation:
Use Menu Option 4 or Run the Following Command
Link to Script:
https://raw.githubusercontent.com/Ranger802004/asusmerlin/main/wan-failover.sh
Readme:
https://raw.githubusercontent.com/Ranger802004/asusmerlin/main/wan-failover-readme.txt
Release Notes:
v2.1.2:
Enhancements:
- General optimization
- Added 388.7 to supported firmware list
- Added 388.8 to supported firmware list
- Cron Job will now dynamically be created / removed to prevent continous attempts at running WAN Failover while it is active. When WAN Failover is killed and SCHEDULECRONJOB is set to Enabled it will be recreated on exit.
- Capture mode will output the capture file created when exited.
Fixes:
- General bug fixes
v2.1.1:
Enhancements:
- Added 388.5 to supported firmware list.
- Added 388.6 to supported firmware list.
- Added configuration option to perform a conntrack flush during failover.
Fixes:
- Updated logic for IPv6 Address data collection.
- The default rules created by the firmware will be deleted if a custom load balancing rule priority is configured.
- OpenVPN Clients will be restarted during failover events.
- Null values for WAN Web GUI IP Addresses are now valid.
v2.1.0:
Enhancements:
- Added WAN0 and WAN1 Web GUI configuration options to create routes for the device portals for each WAN interface.
- Added Reset Default Configuration to Configuration Menu, additionally the command argument resetconfig can be used.
- Enhanced uninstallation prompt for verifying to uninstall.
Fixes:
- Fixed an issue where update would hang if WAN Failover wasn't running.
- Fixed an issue that would allow Load Balance FWMarks and Masks to be non-hexidecimal values in console.
- Added function to verify reverse path filtering is disabled after restarting WAN interfaces and when performing initial WAN Status checks. This is already disabled by the firmware by default but automatically re-enables when an interface is restarted and can cause issues with the target IP rules.
v2.0.7:
Enhancements:
- Added metric values to IP Routes created for target IPs.
- Added additional debug logging to WAN Switch function.
- Added 386.12 to supported firmware list.
- Minor optimizations to increase performance.
- Added CRLF argument to email.
- Added restart option to Status Console.
- Major performance optimization for NVRAM Check function.
- Parent PID is now displayed on Status Console with Dev Mode enabled.
- Added error message if an invalid run argument is specified.
- Added Failover timeout setting. Default is 30 seconds
Fixes:
- Minor visual bug when WAN Failover kill command is being executed.
- WAN Failover will go to disabled state now if DNS Query or Failback are checked under Dual WAN Settings.
- Fixed issue causing PID File not to be deleted under /var/run/wan-failover.pid
- Failover will now properly timeout when the 30 second timeout timer has been reached.
Install:
- Warnings for DNS Query or Failback being enabled will now alert and log during installation
Deprecated:
- WAN0 Route Table and WAN1 Route Table configuration options have been deprecated and are now pulled directly from the Route Table file.
v2.0.6:
Enhancements:
- Added 388.4 to Support List
- General Optimization
- WireGuard clients will restart during failover to recreate the default routes in each WireGuard Route Table.
Fixes:
- Corrected issue where having no OpenVPN Server Instances configured caused WAN Failover to hang.
v2.0.5:
Fixes:
- Corrected minor issue when retrieving WAN NVRAM Parameters
- Corrected issue if WAN Failover would be stuck in a continuous loop if a router didn't have WAN USB capability.
- Corrected issue that causes WAN Failover to exit in Load Balance mode during failover events.
- Corrected issue where DDNS Hostname being blank would cause the script to hang in a loop while collecting System Settings.
- Corrected issue during install where the existing monitor target value was a domain and being used as the WAN0 Target IP default value.
v2.0.4:
Enhancements:
- Added 3rd DNS Server from Automatic Settings to be factored into WAN Failover events.
- The checkiprules function will now be checked at the beginning of WAN Status checks to ensure NAT rules are created if necessary prior to performing packet loss checks.
- Added 386.10 and 386.11 to supported firmware list
- Removed 386.5 and 386.7 from supported firmware list.
Fixes:
- Corrected issue during uninstall when logic was reversed for retaining configuration file or to delete.
v2.0.3:
Fixes:
- Corrected syntax bug in Debug Logging function.
v2.0.2:
Fixes:
- Fixed minor issue with install mode getting stuck on WANDOGTARGET variable.
v2.0.1:
Enhancements:
- Added Process Priority (Real Time, High, Normal, Low, Lowest) for WAN Failover. Configuration Option: Process Priority
- General Optimization.
- CHECKNVRAM is Enabled by Default for the RT-AC86U and GT-AC2900 models on new installations.
- Status Console now shows more descriptions for each WAN interface status.
- Status Console will now passively check for updates every 4 hours while running.
- Status Console will now show WAN Failover status as "Initializing" for start up of the script.
- Added new option to block IPv6 in Failover Mode from traversing Secondary WAN. Configuration Option: Failover Block IPv6
Fixes:
- Corrected issues preventing Failback in v2.0.0.
- Corrected issues with acquiring WAN Interface MAC Addresses.
- Corrected issues with Email Notifications not properly disabling.
- Restart WAN functions will now start interface if already stopped instead of executing restart command.
New Status Console Example:
Note: To change the refresh interval, go to the Configuration Menu and modify the Status Check Setting
Requirements:
- ASUS Merlin Firmware v386.9 or higher
- JFFS custom scripts and configs Enabled
- Dual WAN Enabled
- ASUS Factory Failover Disabled (Network Monitoring Options, Allow Failback Option under WAN > Dual WAN)
Installation:
amtm
or
Command Line:
Code:
/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
Updating:
Use Menu Option 6 or Run the Following Command
Code:
/jffs/scripts/wan-failover.sh update
Uninstallation:
Use Menu Option 4 or Run the Following Command
Code:
/jffs/scripts/wan-failover.sh uninstall
Link to Script:
https://raw.githubusercontent.com/Ranger802004/asusmerlin/main/wan-failover.sh
Readme:
https://raw.githubusercontent.com/Ranger802004/asusmerlin/main/wan-failover-readme.txt
Release Notes:
v2.1.2:
Enhancements:
- General optimization
- Added 388.7 to supported firmware list
- Added 388.8 to supported firmware list
- Cron Job will now dynamically be created / removed to prevent continous attempts at running WAN Failover while it is active. When WAN Failover is killed and SCHEDULECRONJOB is set to Enabled it will be recreated on exit.
- Capture mode will output the capture file created when exited.
Fixes:
- General bug fixes
v2.1.1:
Enhancements:
- Added 388.5 to supported firmware list.
- Added 388.6 to supported firmware list.
- Added configuration option to perform a conntrack flush during failover.
Fixes:
- Updated logic for IPv6 Address data collection.
- The default rules created by the firmware will be deleted if a custom load balancing rule priority is configured.
- OpenVPN Clients will be restarted during failover events.
- Null values for WAN Web GUI IP Addresses are now valid.
v2.1.0:
Enhancements:
- Added WAN0 and WAN1 Web GUI configuration options to create routes for the device portals for each WAN interface.
- Added Reset Default Configuration to Configuration Menu, additionally the command argument resetconfig can be used.
- Enhanced uninstallation prompt for verifying to uninstall.
Fixes:
- Fixed an issue where update would hang if WAN Failover wasn't running.
- Fixed an issue that would allow Load Balance FWMarks and Masks to be non-hexidecimal values in console.
- Added function to verify reverse path filtering is disabled after restarting WAN interfaces and when performing initial WAN Status checks. This is already disabled by the firmware by default but automatically re-enables when an interface is restarted and can cause issues with the target IP rules.
v2.0.7:
Enhancements:
- Added metric values to IP Routes created for target IPs.
- Added additional debug logging to WAN Switch function.
- Added 386.12 to supported firmware list.
- Minor optimizations to increase performance.
- Added CRLF argument to email.
- Added restart option to Status Console.
- Major performance optimization for NVRAM Check function.
- Parent PID is now displayed on Status Console with Dev Mode enabled.
- Added error message if an invalid run argument is specified.
- Added Failover timeout setting. Default is 30 seconds
Fixes:
- Minor visual bug when WAN Failover kill command is being executed.
- WAN Failover will go to disabled state now if DNS Query or Failback are checked under Dual WAN Settings.
- Fixed issue causing PID File not to be deleted under /var/run/wan-failover.pid
- Failover will now properly timeout when the 30 second timeout timer has been reached.
Install:
- Warnings for DNS Query or Failback being enabled will now alert and log during installation
Deprecated:
- WAN0 Route Table and WAN1 Route Table configuration options have been deprecated and are now pulled directly from the Route Table file.
v2.0.6:
Enhancements:
- Added 388.4 to Support List
- General Optimization
- WireGuard clients will restart during failover to recreate the default routes in each WireGuard Route Table.
Fixes:
- Corrected issue where having no OpenVPN Server Instances configured caused WAN Failover to hang.
v2.0.5:
Fixes:
- Corrected minor issue when retrieving WAN NVRAM Parameters
- Corrected issue if WAN Failover would be stuck in a continuous loop if a router didn't have WAN USB capability.
- Corrected issue that causes WAN Failover to exit in Load Balance mode during failover events.
- Corrected issue where DDNS Hostname being blank would cause the script to hang in a loop while collecting System Settings.
- Corrected issue during install where the existing monitor target value was a domain and being used as the WAN0 Target IP default value.
v2.0.4:
Enhancements:
- Added 3rd DNS Server from Automatic Settings to be factored into WAN Failover events.
- The checkiprules function will now be checked at the beginning of WAN Status checks to ensure NAT rules are created if necessary prior to performing packet loss checks.
- Added 386.10 and 386.11 to supported firmware list
- Removed 386.5 and 386.7 from supported firmware list.
Fixes:
- Corrected issue during uninstall when logic was reversed for retaining configuration file or to delete.
v2.0.3:
Fixes:
- Corrected syntax bug in Debug Logging function.
v2.0.2:
Fixes:
- Fixed minor issue with install mode getting stuck on WANDOGTARGET variable.
v2.0.1:
Enhancements:
- Added Process Priority (Real Time, High, Normal, Low, Lowest) for WAN Failover. Configuration Option: Process Priority
- General Optimization.
- CHECKNVRAM is Enabled by Default for the RT-AC86U and GT-AC2900 models on new installations.
- Status Console now shows more descriptions for each WAN interface status.
- Status Console will now passively check for updates every 4 hours while running.
- Status Console will now show WAN Failover status as "Initializing" for start up of the script.
- Added new option to block IPv6 in Failover Mode from traversing Secondary WAN. Configuration Option: Failover Block IPv6
Fixes:
- Corrected issues preventing Failback in v2.0.0.
- Corrected issues with acquiring WAN Interface MAC Addresses.
- Corrected issues with Email Notifications not properly disabling.
- Restart WAN functions will now start interface if already stopped instead of executing restart command.
New Status Console Example:
Note: To change the refresh interval, go to the Configuration Menu and modify the Status Check Setting
Last edited: