What's new

WANFailover Dual WAN Failover ***v2 Release***

  • 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!

I figured out a workaround. I'm a novice with linux scripts, but appears it expects the vpn_server states to be something other null?
Since I don't have VPN enabled, I added the below two lines at the top of the script and it installs and runs now.

nvram set vpn_server1_state=0
nvram set vpn_server2_state=0
I’ll address this in a future release.
 
***v2.0.6 Released***

Release Notes:
v2.0.6 - 8/25/2023
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.
 
Really like this script. I updated to 2.0.6 and have another suggestion for next release. Can you add --crlf to the curl call?

I was trying to figure out why email notices using AMTM settings wasn't working. After some research online, I discovered the Qmail mail transfer agent rejects it as bare LFs are against 822bis section 2.3 which requires a carriage return before the linefeed (LF).

Adding the -crlf in the curl call resolves the email send failure for those with hosts using qmail transfer agents.

Code:
    $(/usr/sbin/curl --connect-timeout $EMAILTIMEOUT --max-time $EMAILTIMEOUT --url $PROTOCOL://$SMTP:$PORT \
        --mail-from "$FROM_ADDRESS" --mail-rcpt "$TO_ADDRESS" \
        --upload-file "$TMPEMAILFILE" \
        --ssl-reqd \
        --crlf \
        --user "$USERNAME:$(/usr/sbin/openssl aes-256-cbc $emailPwEnc -d -in "$AMTM_EMAIL_DIR/emailpw.enc" -pass pass:ditbabot,isoi)" $SSL_FLAG 2>/dev/null) \
 
Last edited:
Really like this script. I updated to 2.0.6 and have another suggestion for next release. Can you add --crlf to the curl call?

I was trying to figure out why email notices using AMTM settings wasn't working. After some research online, I discovered the Qmail mail transfer agent rejects it as bare LFs are against 822bis section 2.3 which requires a carriage return before the linefeed (LF).

Adding the -crlf in the curl call resolves the email send failure for those with hosts using qmail transfer agents.

Code:
    $(/usr/sbin/curl --connect-timeout $EMAILTIMEOUT --max-time $EMAILTIMEOUT --url $PROTOCOL://$SMTP:$PORT \
        --mail-from "$FROM_ADDRESS" --mail-rcpt "$TO_ADDRESS" \
        --upload-file "$TMPEMAILFILE" \
        --ssl-reqd \
        --crlf \
        --user "$USERNAME:$(/usr/sbin/openssl aes-256-cbc $emailPwEnc -d -in "$AMTM_EMAIL_DIR/emailpw.enc" -pass pass:ditbabot,isoi)" $SSL_FLAG 2>/dev/null) \
I will look into this
 
So, I have an primary ISP with IPv4 & IPv6 and a backup ISP with IPv4 only. Should I enable the advanced option:

Added new option to block IPv6 in Failover Mode from traversing Secondary WAN. Configuration Option: Failover Block IPv6 --> enable ?

Will it cause problems if I run these two in load share mode?

Thanks in advance.
 
Hi, thanks for making this script. I am new to this and I am trying to figure things out.

1. Do I keep the failover option disabled in the ASUS router view? The script will take over right?

2. I want to turn on QOS while using dual WAN in load balance mode. I see that I can do so in PuttY. May I ask what QOS mode is used by the script? Is there a way to use CAKE (as it really reduces the bufferbloat for me)?

Thanks for reading this!
 
Hi, thanks for making this script. I am new to this and I am trying to figure things out.

1. Do I keep the failover option disabled in the ASUS router view? The script will take over right?

2. I want to turn on QOS while using dual WAN in load balance mode. I see that I can do so in PuttY. May I ask what QOS mode is used by the script? Is there a way to use CAKE (as it really reduces the bufferbloat for me)?

Thanks for reading this!
1. Yes that is correct.
2. The firmware will keep the QoS engine from running even if you enable it via console while in Load Balance Mode.
 
1. Yes that is correct.
2. The firmware will keep the QoS engine from running even if you enable it via console while in Load Balance Mode.

Oh, so QOS is not working at all in load balance mode?

Hmm, maybe I need to look into an ER-X. Even the ER605 does not have QOS in load balance mode.
 
Hats Off to you Ranger802004!!! I just installed your script via AMTM and power cycled the cable modem as a test. My session with my job was not interrupted! Seamless. I was trying to find out if it would fail back or I needed to do something (must not have seen it in the release notes) and next thing I knew it was back on primary. LTE dropping a few packets I guess.

Great job!

Where is the logic conditions set for failback, and how can I get an email when the primary comes back online?
 
Hats Off to you Ranger802004!!! I just installed your script via AMTM and power cycled the cable modem as a test. My session with my job was not interrupted! Seamless. I was trying to find out if it would fail back or I needed to do something (must not have seen it in the release notes) and next thing I knew it was back on primary. LTE dropping a few packets I guess.

Great job!

Where is the logic conditions set for failback, and how can I get an email when the primary comes back online?
You should get a notification if you have AMTM email alerts configured or AIProtection email alerts configured in addition to having Email Alerts enabled within the WAN Failover Configuration. Failback should occur whenever there is 0% packet loss detected on WAN0 (No missed pings) in the period (ping count) specified. Thank you for the feedback.
 
Published some minor revisions to v2.0.0-beta4
Hi @Ranger802004 hope you're doing well ,

i am on v2.0.6 , when i try to manually switch Primary WAN the script goes haywire :


Code:
Make a selection:
14
Are you sure you want to switch Primary WAN? ***Enter Y for Yes or N for No***
> y
wan-failover: Failback - Switching wan0 to Primary WAN
wan-failover: Failback - WAN IP Address: 10.187.253.9
wan-failover: Failback - WAN Gateway IP: 10.185.0.1
wan-failover: Failback - WAN Gateway Interface: ppp0
wan-failover: Failback - WAN Interface: eth0
wan-failover: Failback - Deleting default route via 192.168.3.1 dev eth4
wan-failover: Failback - Deleted default route via 192.168.3.1 dev eth4
wan-failover: Failback - Adding default route via 10.185.0.1 dev ppp0
wan-failover: Failback - Added default route via 10.185.0.1 dev ppp0
wan-failover: Failback - Switching wan0 to Primary WAN
wan-failover: Failback - WAN IP Address: 10.187.253.9
wan-failover: Failback - WAN Gateway IP: 10.185.0.1
wan-failover: Failback - WAN Gateway Interface: ppp0
wan-failover: Failback - WAN Interface: eth0
wan-failover: Failback - Deleting default route via 192.168.3.1 dev eth4
wan-failover: Failback - Deleted default route via 192.168.3.1 dev eth4
wan-failover: Failback - Adding default route via 10.185.0.1 dev ppp0
wan-failover: Failback - Added default route via 10.185.0.1 dev ppp0
wan-failover: Failback - Switching wan0 to Primary WAN
wan-failover: Failback - WAN IP Address: 10.187.253.9
wan-failover: Failback - WAN Gateway IP: 10.185.0.1
wan-failover: Failback - WAN Gateway Interface: ppp0
wan-failover: Failback - WAN Interface: eth0
wan-failover: Failback - Deleting default route via 192.168.3.1 dev eth4
wan-failover: Failback - Deleted default route via 192.168.3.1 dev eth4
wan-failover: Failback - Adding default route via 10.185.0.1 dev ppp0
wan-failover: Failback - Added default route via 10.185.0.1 dev ppp0
wan-failover: Failback - Switching wan0 to Primary WAN
wan-failover: Failback - WAN IP Address: 10.187.253.9
wan-failover: Failback - WAN Gateway IP: 10.185.0.1
wan-failover: Failback - WAN Gateway Interface: ppp0
wan-failover: Failback - WAN Interface: eth0
wan-failover: Failback - Deleting default route via 192.168.3.1 dev eth4
wan-failover: Failback - Deleted default route via 192.168.3.1 dev eth4
wan-failover: Failback - Adding default route via 10.185.0.1 dev ppp0
wan-failover: Failback - Added default route via 10.185.0.1 dev ppp0
wan-failover: Failback - Switching wan0 to Primary WAN
wan-failover: Failback - WAN IP Address: 10.187.253.9
wan-failover: Failback - WAN Gateway IP: 10.185.0.1
wan-failover: Failback - WAN Gateway Interface: ppp0
wan-failover: Failback - WAN Interface: eth0
wan-failover: Failback - Deleting default route via 192.168.3.1 dev eth4
wan-failover: Failback - Deleted default route via 192.168.3.1 dev eth4
wan-failover: Failback - Adding default route via 10.185.0.1 dev ppp0
wan-failover: Failback - Added default route via 10.185.0.1 dev ppp0
wan-failover: Failback - Switching wan0 to Primary WAN
wan-failover: Failback - WAN IP Address: 10.187.253.9
wan-failover: Failback - WAN Gateway IP: 10.185.0.1
wan-failover: Failback - WAN Gateway Interface: ppp0
wan-failover: Failback - WAN Interface: eth0
wan-failover: Failback - Deleting default route via 192.168.3.1 dev eth4
wan-failover: Failback - Deleted default route via 192.168.3.1 dev eth4
wan-failover: Failback - Adding default route via 10.185.0.1 dev ppp0
wan-failover: Failback - Added default route via 10.185.0.1 dev ppp0
wan-failover: Failback - Switching wan0 to Primary WAN
wan-failover: Failback - WAN IP Address: 10.187.253.9
wan-failover: Failback - WAN Gateway IP: 10.185.0.1

Could you please check on this , however once i reboot it works fine , till i do the switch again


Before reboot:
1693633667364.png


After reboot:
1693633905989.png
 
Hi @Ranger802004 hope you're doing well ,

i am on v2.0.6 , when i try to manually switch Primary WAN the script goes haywire :


Code:
Make a selection:
14
Are you sure you want to switch Primary WAN? ***Enter Y for Yes or N for No***
> y
wan-failover: Failback - Switching wan0 to Primary WAN
wan-failover: Failback - WAN IP Address: 10.187.253.9
wan-failover: Failback - WAN Gateway IP: 10.185.0.1
wan-failover: Failback - WAN Gateway Interface: ppp0
wan-failover: Failback - WAN Interface: eth0
wan-failover: Failback - Deleting default route via 192.168.3.1 dev eth4
wan-failover: Failback - Deleted default route via 192.168.3.1 dev eth4
wan-failover: Failback - Adding default route via 10.185.0.1 dev ppp0
wan-failover: Failback - Added default route via 10.185.0.1 dev ppp0
wan-failover: Failback - Switching wan0 to Primary WAN
wan-failover: Failback - WAN IP Address: 10.187.253.9
wan-failover: Failback - WAN Gateway IP: 10.185.0.1
wan-failover: Failback - WAN Gateway Interface: ppp0
wan-failover: Failback - WAN Interface: eth0
wan-failover: Failback - Deleting default route via 192.168.3.1 dev eth4
wan-failover: Failback - Deleted default route via 192.168.3.1 dev eth4
wan-failover: Failback - Adding default route via 10.185.0.1 dev ppp0
wan-failover: Failback - Added default route via 10.185.0.1 dev ppp0
wan-failover: Failback - Switching wan0 to Primary WAN
wan-failover: Failback - WAN IP Address: 10.187.253.9
wan-failover: Failback - WAN Gateway IP: 10.185.0.1
wan-failover: Failback - WAN Gateway Interface: ppp0
wan-failover: Failback - WAN Interface: eth0
wan-failover: Failback - Deleting default route via 192.168.3.1 dev eth4
wan-failover: Failback - Deleted default route via 192.168.3.1 dev eth4
wan-failover: Failback - Adding default route via 10.185.0.1 dev ppp0
wan-failover: Failback - Added default route via 10.185.0.1 dev ppp0
wan-failover: Failback - Switching wan0 to Primary WAN
wan-failover: Failback - WAN IP Address: 10.187.253.9
wan-failover: Failback - WAN Gateway IP: 10.185.0.1
wan-failover: Failback - WAN Gateway Interface: ppp0
wan-failover: Failback - WAN Interface: eth0
wan-failover: Failback - Deleting default route via 192.168.3.1 dev eth4
wan-failover: Failback - Deleted default route via 192.168.3.1 dev eth4
wan-failover: Failback - Adding default route via 10.185.0.1 dev ppp0
wan-failover: Failback - Added default route via 10.185.0.1 dev ppp0
wan-failover: Failback - Switching wan0 to Primary WAN
wan-failover: Failback - WAN IP Address: 10.187.253.9
wan-failover: Failback - WAN Gateway IP: 10.185.0.1
wan-failover: Failback - WAN Gateway Interface: ppp0
wan-failover: Failback - WAN Interface: eth0
wan-failover: Failback - Deleting default route via 192.168.3.1 dev eth4
wan-failover: Failback - Deleted default route via 192.168.3.1 dev eth4
wan-failover: Failback - Adding default route via 10.185.0.1 dev ppp0
wan-failover: Failback - Added default route via 10.185.0.1 dev ppp0
wan-failover: Failback - Switching wan0 to Primary WAN
wan-failover: Failback - WAN IP Address: 10.187.253.9
wan-failover: Failback - WAN Gateway IP: 10.185.0.1
wan-failover: Failback - WAN Gateway Interface: ppp0
wan-failover: Failback - WAN Interface: eth0
wan-failover: Failback - Deleting default route via 192.168.3.1 dev eth4
wan-failover: Failback - Deleted default route via 192.168.3.1 dev eth4
wan-failover: Failback - Adding default route via 10.185.0.1 dev ppp0
wan-failover: Failback - Added default route via 10.185.0.1 dev ppp0
wan-failover: Failback - Switching wan0 to Primary WAN
wan-failover: Failback - WAN IP Address: 10.187.253.9
wan-failover: Failback - WAN Gateway IP: 10.185.0.1

Could you please check on this , however once i reboot it works fine , till i do the switch again


Before reboot:
View attachment 52803

After reboot:
View attachment 52804
I will need you to give me the details of your QoS Settings for each WAN Interface and also try this again with debug logging enabled on your router (shouldn't require a restart of router or WAN Failover). Also keep in mind the switchwan function will go back to Primary if monitoring is running, the switchwan function was intended for manual use cases or "stuck" conditions.
 
I will need you to give me the details of your QoS Settings for each WAN Interface and also try this again with debug logging enabled on your router (shouldn't require a restart of router or WAN Failover). Also keep in mind the switchwan function will go back to Primary if monitoring is running, the switchwan function was intended for manual use cases or "stuck" conditions.
Qos is disabled for both WAN

1693668533111.png




Here is the debug log : https://pastebin.com/1RuwtF4K

This function is very useful for me to switch between my both ISPs as i am limited to 3.3Tb/Month on both
 
Qos is disabled for both WAN

View attachment 52812



Here is the debug log : https://pastebin.com/1RuwtF4K

This function is very useful for me to switch between my both ISPs as i am limited to 3.3Tb/Month on both
For a longer term switch of your primary WAN I would recommend to switch this via the Dual WAN configuration page, WAN Failover will then reload and see the WAN interfaces accordingly.
 
For a longer term switch of your primary WAN I would recommend to switch this via the Dual WAN configuration page, WAN Failover will then reload and see the WAN interfaces accordingly.
Idealy this would have been my first option but doing so takes the network down for almost 60-120 sec , DW Failover script could do it better, faster switching , if it works properly . Hope it does . If you could fix this
 
I gave this script a try and I am having an issue where the secondary WAN can never ping out so failback never works per say.

For example if I do option 14 which allows me to manually failover the WAN the now new primary is able to ping no problem, but the previously primary WAN is now unable to ping.

What happens essentially is when the network flaps, I am Stuck on WAN2 which is the slower ISP, when I want it to go back to WAN1.

ASUS wan failback works as expected. AM I doing something wrong?
 
I figured out a workaround. I'm a novice with linux scripts, but appears it expects the vpn_server states to be something other null?
Since I don't have VPN enabled, I added the below two lines at the top of the script and it installs and runs now.

nvram set vpn_server1_state=0
nvram set vpn_server2_state=0
For whatever reason mine went into a loop doing this same thing yesterday, luckily I remembered this post so it was a easy work around. Thanks.
 
For whatever reason mine went into a loop doing this same thing yesterday, luckily I remembered this post so it was a easy work around. Thanks.
FYI. I don't know what version you are using, but this was fixed for me in version 2.0.6.
 

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