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!

Thanks and slapped this beta in for testing, specifically for this feature.

Observation
- QoS is only disabled on Failover and not reconfig/restart of the script. My expectation is that on reconfig/restart the QoS settings/toggle should be enabled/disabled based on configuration file. Thus, for WAN0 I had to manually disable QoS. Trending in the right direction as usual @Ranger802004
I didn’t incorporate it for syncing at start so good point, I’ll look into a revision for that.
 
An updated revision has been published for v1.5.7-beta1, if you have DEVMODE set to 1 (Enabled) in Configuration Mode you can run the update command to receive the revision.
Code:
wan-failover update

v1.5.7-beta1b
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.

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.

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.
 
An updated revision has been published for v1.5.7-beta1, if you have DEVMODE set to 1 (Enabled) in Configuration Mode you can run the update command to receive the revision.
Code:
wan-failover update

v1.5.7-beta1b
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.

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.

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.

Got an error on the upgrade although my devmode=1 (detected etc.), so did a manual upgrade and restart. It re-enabled QoS on my Disabled WAN0 connection. Manually switched off QoS on it, and all good again.
 
Got an error on the upgrade although my devmode=1 (detected etc.), so did a manual upgrade and restart. It re-enabled QoS on my Disabled WAN0 connection. Manually switched off QoS on it, and all good again.
What was the error?
 
How to configure CUSTOMLOGPATH= correctly, just write for example \opt\var\log\****.log? If yes, then for some reason it does not work.
 
How to configure CUSTOMLOGPATH= correctly, just write for example \opt\var\log\****.log? If yes, then for some reason it does not work.
This is only for Monitor Mode, you tested that, yes?
 

Attachments

  • monitor.png
    monitor.png
    73.6 KB · Views: 58
Last edited:
Yes, I checked, the log is empty, the monitor is silent. I wrote it like this CUSTOMLOGPATH=|opt|var|log|failover.log.
I found this on the router's log page https://pastebin.com/k5JsLwaC
Have you verified your logs are actually going to the file you specified?
 
Have you verified your logs are actually going to the file you specified?
I only made sure that they are not there in the specified file. Aug 24 09:29:08 router wan-failover.sh : Debug - Custom Log Path: |opt|var|log|failover.log only says that this setting is registered in the configuration, but not that logging is being conducted.
 

Attachments

  • 0.png
    0.png
    58.3 KB · Views: 64
I only made sure that they are not there in the specified file. Aug 24 09:29:08 router wan-failover.sh : Debug - Custom Log Path: |opt|var|log|failover.log only says that this setting is registered in the configuration, but not that logging is being conducted.
The setting doesn’t change where your logs go, you would do that in Scribe, it’s for those who have a custom log file set up for their script. They can specify the path for Monitor Mode
 
The setting doesn’t change where your logs go, you would do that in Scribe, it’s for those who have a custom log file set up for their script. They can specify the path for Monitor Mode
Well, then, roughly speaking, this is not a working functionality. I believe that this should work so that the log would be written to a separate file, and not to a general log (no matter which one). To open it at any time and copy what you need, and not look for it all in the general log. And so it's useless functionality, rolling back to stable 1.5.6.
 
Well, then, roughly speaking, this is not a working functionality. I believe that this should work so that the log would be written to a separate file, and not to a general log (no matter which one). To open it at any time and copy what you need, and not look for it all in the general log. And so it's useless functionality, rolling back to stable 1.5.6.
The script calls the system logger like it is suppose to and you can designate a custom log file for it using Scribe and then set that same log path in the config file for monitor mode.
 
The script calls the system logger like it is suppose to and you can designate a custom log file for it using Scribe and then set that same log path in the config file for monitor mode.
No, it doesn't work that way.
 

Attachments

  • System Log - enhanced by Scribe - 192.168.1.1 - 24.08.2022_13_16_35.jpg
    System Log - enhanced by Scribe - 192.168.1.1 - 24.08.2022_13_16_35.jpg
    38.6 KB · Views: 57
No, it doesn't work that way.
I don’t personally use Scribe but I have had others do what I just spoke of on having the wan-failover logs go to a custom file from Scribe (I believe) and used the new option to point the monitor to that specific file and confirmed it works.
 
I don’t personally use Scribe but I have had others do what I just spoke of on having the wan-failover logs go to a custom file from Scribe (I believe) and used the new option to point the monitor to that specific file and confirmed it works.
I confirm that it doesn't work that's all, I believe my eyes, what I see. I haven't seen any other evidence that it works at least somehow. At the level of what I see and that it doesn't work, I make a statement for myself that this is useless functionality (non-working). If something works, then it works, and at the same time I do not claim that workers are not workers, so in this case I speak as is, confirming with facts, and not with simple words. Therefore, it is fully working version 1.5.6.
 
I confirm that it doesn't work that's all, I believe my eyes, what I see. I haven't seen any other evidence that it works at least somehow. At the level of what I see and that it doesn't work, I make a statement for myself that this is useless functionality (non-working). If something works, then it works, and at the same time I do not claim that workers are not workers, so in this case I speak as is, confirming with facts, and not with simple words. Therefore, it is fully working version 1.5.6.
Have you set up a custom log path with Scribe and verified the logs are going to the file you specified?

- Custom Log Path can be specified for Monitor Mode using CUSTOMLOGPATH setting in Configuration Settings.
 
I confirm that it doesn't work that's all, I believe my eyes, what I see. I haven't seen any other evidence that it works at least somehow.
All works good for me …

It definitely DOES work IF you have scribe/uiscribe set up correctly, which may be your problem I think and is “outside the scope of this thread”.

Also your tone and attitude comes across, to me at least, as quite rude and disrespectful towards @Ranger802004 , who is attempting to assist you. I have found politeness goes a long way, is mostly reciprocated, and often reaps unexpected rewards.
 
All works good for me …

It definitely DOES work IF you have scribe/uiscribe set up correctly, which may be your problem I think and is “outside the scope of this thread”.

Also your tone and attitude comes across, to me at least, as quite rude and disrespectful towards @Ranger802004 , who is attempting to assist you. I have found politeness goes a long way, is mostly reciprocated, and often reaps unexpected rewards.
I pointed out how it really is and if you know how to read correctly, you could understand that I made it clear that I have a problem and maybe others don't have it. I respect any work, at the same time I provided all the evidence that it does not work for me (I specify it specifically for you), but in response I received only simple words without an evidence base. Therefore, all your vile insinuations against me can only be regarded as a provocation, and this is disrespect on your part.
 
@lbtboy have you verified that your custom log file in Scribe is sending your logs for wan-failover to it? That's the first step in diagnosing this. I will say that some of your verbiage does seem condescending but also I know you are using a translator to speak with us so it could be that what you are trying to say is being lost in translation.
 
@lbtboy have you verified that your custom log file in Scribe is sending your logs for wan-failover to it? That's the first step in diagnosing this. I will say that some of your verbiage does seem condescending but also I know you are using a translator to speak with us so it could be that what you are trying to say is being lost in translation.
Dear Ranger 802004, thank you for your help and an excellent script, I made a rollback to 1.5.6. I realized one thing that you can't talk about script errors here if someone works, but you don't, since it is perceived negatively by users, you need to speak only in a positive way even if something does not work as it should. Thanks again for your scripts, you are doing the right thing, good luck with new developments.
 

Similar 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