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!

Any issues for the following message on an RT-AX88U with latest RMerlin version?

Code:
Aug 27 16:44:00 wan-failover.sh: System Check - ***386.8 is not supported, issues may occur from running this version***

Just switched over to V1.5.7-beta1c, wish I would of had it for Friday August 26th with debug logs on (only notice logs), as I had my ISP01 go down for real, and with V1.5.6 Final, it switched automatically to ISP02, and all services worked great.

ISP01(1GB Symmetrical) was down for almost 8 hours, but ISP02(650DL/100UL) just kept chugging along. When ISP01 finally came back, it did switch back over to ISP01 from ISP02, but the weird thing is ISP02 was then considered in a down state for almost 8 hours before my RT-AX88U sent out this message in the V1.5.6 Final notice logs:

Code:
Aug 27 03:12:42 kernel: CPU: 0 PID: 19540 Comm: wan-failover.sh Tainted: P           O    4.1.51 #2
Aug 27 03:12:42 kernel: Hardware name: Broadcom-v8A (DT)
Aug 27 03:12:42 kernel: task: ffffffc02c4f4100 ti: ffffffc0277ec000 task.ti: ffffffc0277ec000
Aug 27 03:12:42 kernel: PC is at 0x3b4e0
Aug 27 03:12:42 kernel: LR is at 0x391f8
Aug 27 03:12:42 kernel: pc : [<000000000003b4e0>] lr : [<00000000000391f8>] pstate: 20010010
Aug 27 03:12:42 kernel: sp : 00000000ffbdc018
Aug 27 03:12:42 kernel: x12: 00000000ffbdc0a0
Aug 27 03:12:42 kernel: x11: 000000000051b4f4 x10: 0000000000000001
Aug 27 03:12:42 kernel: x9 : 00000000004eef44 x8 : 00000000ffffffff
Aug 27 03:12:42 kernel: x7 : 00000000004b9150 x6 : 0000000000000000
Aug 27 03:12:42 kernel: x5 : 00000000004b9540 x4 : 0000000000000002
Aug 27 03:12:42 kernel: x3 : 000000000003b4e0 x2 : 0000000000000000
Aug 27 03:12:42 kernel: x1 : 0000000000000002 x0 : 00000000004f3e14
Aug 27 03:12:42 ovpn-server1[21236]: event_wait : Interrupted system call (code=4)
Aug 27 03:12:42 ovpn-server1[21236]: PLUGIN AUTH-PAM: Error signaling background process to exit: Connection refused (errno=111)
Aug 27 03:12:42 YazFi: Firewall restarted - sleeping 10s before running YazFi
Aug 27 03:12:42 FlexQoS: /jffs/addons/flexqos/flexqos.sh (pid=31711) called in unattended mode with 1 args: -start
Aug 27 03:12:42 ovpn-server1[31884]: NOTE: the current --script-security setting may allow this configuration to call user-defined scripts
Aug 27 03:12:42 FlexQoS: iptables rules already present
Aug 27 03:12:43 FlexQoS: No TC modifications necessary
Aug 27 03:12:52 YazFi: YazFi v4.4.2 starting up
Aug 27 03:12:53 YazFi: wl0.1 (SSID: xxxxxxx) - sending all interface internet traffic over WAN interface
Aug 27 03:12:55 YazFi: wl0.2 (SSID: xxxxx) - sending all interface internet traffic over WAN interface
Aug 27 03:12:59 YazFi: Forcing YazFi Guest WiFi clients to reauthenticate
Aug 27 03:13:00 wan-failover.sh: System Check - ***386.8 is not supported, issues may occur from running this version***
Aug 27 03:13:00 wan-failover.sh: System Check - ***386.8 is not supported, issues may occur from running this version***
Aug 27 03:13:00 wan-failover.sh: WAN Status - Added default route for wan0 Routing Table via X.X.X.X dev eth0
Aug 27 03:13:00 wan-failover.sh: WAN Status - Added IP Rule for 8.8.8.8 to monitor wan0
Aug 27 03:13:04 wan-failover.sh: WAN Status - Added default route for wan1 Routing Table via X.X.X.X dev eth4
Aug 27 03:13:05 wan-failover.sh: WAN Status - Added IP Rule for 8.8.4.4 to monitor wan1
Aug 27 03:13:15 wan-failover.sh: WAN Status - Added IP Rule for 8.8.4.4 to monitor wan1 without specifying Outbound Interface
Aug 27 03:13:15 YazFi: YazFi v4.4.2 completed successfully
Aug 27 03:13:19 wan-failover.sh: WAN Status - ***Warning*** Compatibility issues with 8.8.4.4 may occur without specifying Outbound Interface
Aug 27 03:13:19 wan-failover.sh: DNS Switch - Removed wan1 DNS1 Server: X.X.X.X
Aug 27 03:13:19 wan-failover.sh: DNS Switch - Removed wan1 DNS2 Server: X.X.X.X
Aug 27 03:13:19 wan-failover.sh: WAN0 Failover Monitor - Monitoring wan0 via 8.8.8.8 for Failure
Aug 27 03:13:19 wan-failover.sh: WAN0 Failover Monitor - Monitoring wan1 via 8.8.4.4 for Failure

Otherwise it failed over like it should and failed back like it should. Unfortunately no WFH was going on at the time, streaming, gaming, or VPN connections, to see any real time disconnects/reconnects.
 
Last edited:
Do you have logs you can forward for me?

Here is a run where:

1. Disabled QoS manually prior to update (as I noticed QoS was on again)

Code:
Aug 28 13:51:30 myrouter wan-failover.sh: WAN0 Failover Monitor - Monitoring wan0 via 8.8.8.8 for Failure
Aug 28 13:51:30 myrouter wan-failover.sh: WAN0 Failover Monitor - Monitoring wan1 via 8.8.4.4 for Failure
Aug 28 13:54:21 myrouter rc_service: cfg_server 2480:notify_rc restart_qos;restart_firewall;
Aug 28 13:54:21 myrouter custom_script: Running /jffs/scripts/service-event (args: restart qos)
Aug 28 13:54:21 myrouter CakeQOS-Merlin: Cake QoS not enabled in firmware. Skipping configuration.
Aug 28 13:54:21 myrouter kernel: Initialized Runner Unicast Layer
Aug 28 13:54:21 myrouter kernel: Initialized Runner Multicast Layer
Aug 28 13:54:21 myrouter kernel: [0;36;44mBroadcom Packet Flow Cache HW acceleration enabled.[0m
Aug 28 13:54:21 myrouter kernel: Enabled Runner binding to Flow Cache
Aug 28 13:54:21 myrouter kernel: Initialized Runner Protocol Layer (800)
Aug 28 13:54:21 myrouter kernel: Broadcom Runner Blog Driver Char Driver v0.1 Registered <3009>
Aug 28 13:54:22 myrouter custom_script: Running /jffs/scripts/service-event-end (args: restart qos)
Aug 28 13:54:22 myrouter custom_script: Running /jffs/scripts/service-event (args: restart firewall)
Aug 28 13:54:22 myrouter custom_script: Running /jffs/scripts/nat-start
Aug 28 13:54:22 myrouter custom_script: Running /jffs/scripts/firewall-start (args: eth0)
Aug 28 13:54:22 myrouter custom_script: Running /jffs/scripts/service-event-end (args: restart firewall)
Aug 28 13:55:03 myrouter CakeQOS-Merlin: /jffs/addons/cake-qos/cake-qos (pid=24970) called in unattended mode with 1 args: startup
Aug 28 13:55:03 myrouter CakeQOS-Merlin: Cake QoS is not enabled. Skipping CakeQOS-Merlin startup.

2. Ran the update
Code:
Aug 28 13:57:59 myrouter wan-failover.sh: Debug - Script Mode: update
Aug 28 13:57:59 myrouter wan-failover.sh: Debug - Function: update
Aug 28 13:58:05 myrouter wan-failover.sh: Debug - Function: killscript
Aug 28 13:58:05 myrouter wan-failover.sh: Debug - Selecting PIDs to kill
Aug 28 13:58:05 myrouter wan-failover.sh: Debug - Calling CronJob to be rescheduled
Aug 28 13:58:05 myrouter wan-failover.sh: Debug - Function: cronjob
Aug 28 13:58:05 myrouter wan-failover.sh: Debug - ***Checking if PIDs array is null*** Process ID: 12658 12660 29595 29596
Aug 28 13:58:05 myrouter wan-failover.sh: Restart - Restarting wan-failover.sh ***This can take up to approximately 1 minute***
Aug 28 13:58:05 myrouter wan-failover.sh: Debug - Waiting to kill script until seconds into the minute are above 40 seconds or below 45 seconds
Aug 28 13:58:06 myrouter wan-failover.sh: Restart - Killing wan-failover.sh Process ID: 12658
Aug 28 13:58:06 myrouter wan-failover.sh: Restart - Killed wan-failover.sh Process ID: 12658
Aug 28 13:58:06 myrouter wan-failover.sh: Restart - Killing wan-failover.sh Process ID: 12660
Aug 28 13:58:06 myrouter wan-failover.sh: Restart - Killed wan-failover.sh Process ID: 12660
Aug 28 13:58:06 myrouter wan-failover.sh: Restart - Killing wan-failover.sh Process ID: 29595
Aug 28 13:58:06 myrouter wan-failover.sh: Restart - Killed wan-failover.sh Process ID: 29595
Aug 28 13:58:06 myrouter wan-failover.sh: Restart - Killing wan-failover.sh Process ID: 29596
Aug 28 13:58:06 myrouter wan-failover.sh: Restart - Killed wan-failover.sh Process ID: 29596
Aug 28 13:58:06 myrouter wan-failover.sh: Debug - Function: cleanup
Aug 28 13:58:06 myrouter wan-failover.sh: Debug - Setting parameters for wan0
Aug 28 13:58:06 myrouter wan-failover.sh: Debug - Checking wan0 for IP Rule to 8.8.8.8
Aug 28 13:58:06 myrouter wan-failover.sh: Cleanup - Deleting IP Rule for 8.8.8.8 to monitor wan0
Aug 28 13:58:06 myrouter wan-failover.sh: Cleanup - Deleted IP Rule for 8.8.8.8 to monitor wan0
Aug 28 13:58:06 myrouter wan-failover.sh: Debug - Checking wan0 for Default Route in 100
Aug 28 13:58:06 myrouter wan-failover.sh: Debug - Checking for /tmp/wan0packetloss.tmp
Aug 28 13:58:06 myrouter wan-failover.sh: Cleanup - Deleting /tmp/wan0packetloss.tmp
Aug 28 13:58:06 myrouter wan-failover.sh: Cleanup - Deleted /tmp/wan0packetloss.tmp
Aug 28 13:58:06 myrouter wan-failover.sh: Debug - Setting parameters for wan1
Aug 28 13:58:06 myrouter wan-failover.sh: Debug - Checking wan1 for IP Rule to 8.8.4.4
Aug 28 13:58:06 myrouter wan-failover.sh: Cleanup - Deleting IP Rule for 8.8.4.4 to monitor wan1
Aug 28 13:58:06 myrouter wan-failover.sh: Cleanup - Deleted IP Rule for 8.8.4.4 to monitor wan1
Aug 28 13:58:06 myrouter wan-failover.sh: Debug - Checking wan1 for Default Route in 200
Aug 28 13:58:06 myrouter wan-failover.sh: Debug - Checking for /tmp/wan1packetloss.tmp
Aug 28 13:58:06 myrouter wan-failover.sh: Cleanup - Deleting /tmp/wan1packetloss.tmp
Aug 28 13:58:06 myrouter wan-failover.sh: Cleanup - Deleted /tmp/wan1packetloss.tmp
Aug 28 13:58:06 myrouter wan-failover.sh: Debug - Checking for Lock File: /var/lock/wan-failover.lock
Aug 28 13:58:06 myrouter wan-failover.sh: Cleanup - Deleting /var/lock/wan-failover.lock
Aug 28 13:58:06 myrouter wan-failover.sh: Cleanup - Deleted /var/lock/wan-failover.lock
Aug 28 13:58:06 myrouter wan-failover.sh: Restart - Waiting for wan-failover.sh to restart from Cron Job
Aug 28 13:58:06 myrouter wan-failover.sh: Debug - System Uptime: 509 Seconds
Aug 28 13:58:06 myrouter wan-failover.sh: Debug - Restart Timeout is in 120 Seconds
Aug 28 13:59:00 myrouter wan-failover.sh: Debug - Locked File: /var/lock/wan-failover.lock
Aug 28 13:59:00 myrouter wan-failover.sh: Debug - Trap set to remove /var/lock/wan-failover.lock on exit
Aug 28 13:59:00 myrouter wan-failover.sh: Debug - Script Mode: run
Aug 28 13:59:00 myrouter wan-failover.sh: Debug - Function: systemcheck
Aug 28 13:59:00 myrouter wan-failover.sh: Debug - Log Level: 6
Aug 28 13:59:00 myrouter wan-failover.sh: System Check - Process ID: 30779
Aug 28 13:59:00 myrouter wan-failover.sh: Debug - Function: nvramcheck
Aug 28 13:59:00 myrouter wan-failover.sh: Debug - ***NVRAM Check Passed***
Aug 28 13:59:00 myrouter wan-failover.sh: System Check - Version: v1.5.7-beta1c
Aug 28 13:59:00 myrouter wan-failover.sh: Debug - Firmware: 386.7
Aug 28 13:59:00 myrouter wan-failover.sh: System Check - IPRoute Version: 5.11.0
Aug 28 13:59:00 myrouter wan-failover.sh: Debug - JFFS custom scripts and configs: 1
Aug 28 13:59:00 myrouter wan-failover.sh: Debug - Checking Alias in /jffs/configs/profile.add
Aug 28 13:59:00 myrouter wan-failover.sh: Debug - Checking for Configuration File: /jffs/configs/wan-failover.conf
Aug 28 13:59:00 myrouter wan-failover.sh: Debug - Function: setvariables
Aug 28 13:59:00 myrouter wan-failover.sh: Debug - Reading /jffs/configs/wan-failover.conf
Aug 28 13:59:00 myrouter wan-failover.sh: Debug - Checking for missing configuration options
Aug 28 13:59:00 myrouter wan-failover.sh: Debug - Removing deprecated option: PACKETSIZE from /jffs/configs/wan-failover.conf
Aug 28 13:59:00 myrouter wan-failover.sh: Debug - Reading /jffs/configs/wan-failover.conf
Aug 28 13:59:00 myrouter wan-failover.sh: Debug - Function: debuglog
Aug 28 13:59:00 myrouter wan-failover.sh: Debug - Function: nvramcheck
Aug 28 13:59:00 myrouter wan-failover.sh: Debug - ***NVRAM Check Passed***
Aug 28 13:59:00 myrouter wan-failover.sh: Debug - Function: wanstatus
Aug 28 13:59:00 myrouter wan-failover.sh: Debug - Function: nvramcheck
Aug 28 13:59:00 myrouter wan-failover.sh: Debug - ***NVRAM Check Passed***
Aug 28 13:59:00 myrouter wan-failover.sh: Debug - System Uptime: 564 Seconds
Aug 28 13:59:00 myrouter wan-failover.sh: Debug - Boot Delay Timer: 5 Seconds
Aug 28 13:59:01 myrouter wan-failover.sh: Debug - Function: getwanparameters
Aug 28 13:59:01 myrouter wan-failover.sh: Debug - Setting parameters for wan0
Aug 28 13:59:01 myrouter wan-failover.sh: WAN Status - wan0 enabled
Aug 28 13:59:01 myrouter wan-failover.sh: Debug - Checking wan0 State
Aug 28 13:59:01 myrouter wan-failover.sh: Debug - Checking wan0 for null IP or Gateway
Aug 28 13:59:01 myrouter wan-failover.sh: Debug - Checking wan0 for Default Route in 100
Aug 28 13:59:01 myrouter wan-failover.sh: Debug - Recursive Ping Check: 1
Aug 28 13:59:01 myrouter wan-failover.sh: Debug - Checking wan0 for IP Rule to 8.8.8.8
Aug 28 13:59:01 myrouter wan-failover.sh: WAN Status - Adding IP Rule for 8.8.8.8 to monitor wan0
Aug 28 13:59:01 myrouter wan-failover.sh: WAN Status - Added IP Rule for 8.8.8.8 to monitor wan0
Aug 28 13:59:01 myrouter wan-failover.sh: Debug - Checking wan0 for packet loss via 8.8.8.8 - Attempt: 1
Aug 28 13:59:01 myrouter wan-failover.sh: Debug - System Uptime: 564 Seconds
Aug 28 13:59:01 myrouter wan-failover.sh: Debug - Checking if wan-failover.sh restarted
Aug 28 13:59:01 myrouter wan-failover.sh: Debug - ***Checking if PIDs array is null*** Process ID(s): 30776 30779 31452
Aug 28 13:59:01 myrouter wan-failover.sh: Restart - Successfully Restarted wan-failover.sh Process ID(s): 30776 30779 31452
Aug 28 13:59:04 myrouter wan-failover.sh: Debug - wan0 Packet Loss: 0%
Aug 28 13:59:04 myrouter wan-failover.sh: Debug - Checking wan0 for Default Route in 100
Aug 28 13:59:04 myrouter wan-failover.sh: Debug - wan0 Ping Path: 1
Aug 28 13:59:04 myrouter wan-failover.sh: WAN Status - wan0 has 0% packet loss
Aug 28 13:59:04 myrouter wan-failover.sh: Debug - wan0 Status: CONNECTED
Aug 28 13:59:04 myrouter wan-failover.sh: Debug - Function: setwanstatus
Aug 28 13:59:04 myrouter wan-failover.sh: Debug - WAN Status Mode: 1
Aug 28 13:59:04 myrouter wan-failover.sh: Debug - WAN0 Status: CONNECTED
Aug 28 13:59:04 myrouter wan-failover.sh: Debug - Function: getwanparameters
Aug 28 13:59:04 myrouter wan-failover.sh: Debug - Setting parameters for wan1
 
Continued..

Weird no debug logs about QoS enable/disable from the script. Perhaps it isn't reading my conf file correctly?

3. Noticed QoS was enabled again, so manually disabled it. Will check the code to see how you are calling it and when.
Code:
Aug 28 14:00:11 myrouter kernel: Init chrdev /dev/idp with major 190
Aug 28 14:00:11 myrouter kernel: tdts: tcp_conn_max = 8000
Aug 28 14:00:11 myrouter kernel: tdts: tcp_conn_timeout = 300 sec
Aug 28 14:00:11 myrouter CakeQOS-Merlin: Enable Cake QoS scheduler in the firmware...
Aug 28 14:00:11 myrouter kernel: [0;33;45mBroadcom Packet Flow Cache HW acceleration disabled.[0m
Aug 28 14:00:11 myrouter kernel: Disabled Runner binding to Flow Cache
Aug 28 14:00:14 myrouter kernel: SHN Release Version: 2.0.2 90120f9
Aug 28 14:00:14 myrouter kernel: UDB Core Version: 0.2.20
Aug 28 14:00:14 myrouter kernel: Init chrdev /dev/idpfw with major 191
Aug 28 14:00:14 myrouter kernel: IDPfw: flush fc
Aug 28 14:00:14 myrouter kernel: IDPfw: IDPfw is ready
Aug 28 14:00:14 myrouter kernel: sizeof forward pkt param = 280
Aug 28 14:00:14 myrouter BWDPI: fun bitmap = 3
Aug 28 14:00:15 myrouter rc_service: service 5421:notify_rc restart_qos;restart_firewall
Aug 28 14:00:15 myrouter custom_script: Running /jffs/scripts/service-event (args: restart qos)
Aug 28 14:00:15 myrouter CakeQOS-Merlin: Configuring Cake options...
Aug 28 14:00:15 myrouter kernel: IDPfw: Exit IDPfw
Aug 28 14:00:15 myrouter kernel: mod epilog takes 0 jiffies
Aug 28 14:00:15 myrouter kernel: IDPfw: Exit IDPfw
Aug 28 14:00:16 myrouter kernel: Exit chrdev /dev/idpfw with major 191
Aug 28 14:00:16 myrouter kernel: Exit chrdev /dev/idp with major 190
Aug 28 14:00:16 myrouter custom_config: Appending content of /jffs/configs/cake-qos.conf.add.
Aug 28 14:00:16 myrouter custom_script: Running /jffs/scripts/qos-start (args: init)
Aug 28 14:00:16 myrouter custom_script: Running /jffs/scripts/service-event-end (args: restart qos)
Aug 28 14:00:16 myrouter custom_script: Running /jffs/scripts/service-event (args: restart firewall)
Aug 28 14:00:16 myrouter custom_script: Running /jffs/scripts/nat-start
Aug 28 14:00:16 myrouter custom_script: Running /jffs/scripts/firewall-start (args: eth0)
Aug 28 14:00:16 myrouter custom_script: Running /jffs/scripts/service-event-end (args: restart firewall)
Aug 28 14:00:17 myrouter kernel: Init chrdev /dev/idp with major 190
Aug 28 14:00:17 myrouter kernel: tdts: tcp_conn_max = 8000
Aug 28 14:00:17 myrouter kernel: tdts: tcp_conn_timeout = 300 sec
Aug 28 14:00:20 myrouter kernel: SHN Release Version: 2.0.2 90120f9
Aug 28 14:00:20 myrouter kernel: UDB Core Version: 0.2.20
Aug 28 14:00:20 myrouter kernel: Init chrdev /dev/idpfw with major 191
Aug 28 14:00:20 myrouter kernel: IDPfw: flush fc
Aug 28 14:00:20 myrouter kernel: IDPfw: IDPfw is ready
Aug 28 14:00:20 myrouter kernel: sizeof forward pkt param = 280
Aug 28 14:00:20 myrouter BWDPI: fun bitmap = 3
Aug 28 14:00:27 myrouter kernel: IDPfw: Exit IDPfw
Aug 28 14:00:27 myrouter kernel: mod epilog takes 0 jiffies
Aug 28 14:00:27 myrouter kernel: IDPfw: Exit IDPfw
Aug 28 14:00:27 myrouter rc_service: cfg_server 2480:notify_rc restart_qos;restart_firewall;
Aug 28 14:00:27 myrouter custom_script: Running /jffs/scripts/service-event (args: restart qos)
Aug 28 14:00:27 myrouter CakeQOS-Merlin: Cake QoS not enabled in firmware. Skipping configuration.
Aug 28 14:00:27 myrouter kernel: Exit chrdev /dev/idpfw with major 191
Aug 28 14:00:27 myrouter kernel: Initialized Runner Unicast Layer
Aug 28 14:00:27 myrouter kernel: Initialized Runner Multicast Layer
Aug 28 14:00:27 myrouter kernel: [0;36;44mBroadcom Packet Flow Cache HW acceleration enabled.[0m
Aug 28 14:00:27 myrouter kernel: Enabled Runner binding to Flow Cache
Aug 28 14:00:27 myrouter kernel: Exit chrdev /dev/idp with major 190
Aug 28 14:00:27 myrouter kernel: Initialized Runner Protocol Layer (800)
Aug 28 14:00:27 myrouter kernel: Broadcom Runner Blog Driver Char Driver v0.1 Registered <3009>
Aug 28 14:00:27 myrouter custom_script: Running /jffs/scripts/service-event-end (args: restart qos)
Aug 28 14:00:27 myrouter custom_script: Running /jffs/scripts/service-event (args: restart firewall)
Aug 28 14:00:28 myrouter custom_script: Running /jffs/scripts/nat-start
Aug 28 14:00:28 myrouter custom_script: Running /jffs/scripts/firewall-start (args: eth0)
Aug 28 14:00:28 myrouter custom_script: Running /jffs/scripts/service-event-end (args: restart firewall)
Aug 28 14:00:28 myrouter custom_script: Running /jffs/scripts/nat-start
Aug 28 14:00:28 myrouter custom_script: Running /jffs/scripts/firewall-start (args: eth0)
Aug 28 14:00:28 myrouter CakeQOS-Merlin: /jffs/addons/cake-qos/cake-qos (pid=7131) called in unattended mode with 1 args: startup
Aug 28 14:00:28 myrouter CakeQOS-Merlin: Cake QoS is not enabled. Skipping CakeQOS-Merlin startup.
Aug 28 14:00:28 myrouter CakeQOS-Merlin: /jffs/addons/cake-qos/cake-qos (pid=7221) called in unattended mode with 1 args: startup
Aug 28 14:00:28 myrouter CakeQOS-Merlin: Cake QoS is not enabled. Skipping CakeQOS-Merlin startup.
 
Last edited:
I have a question on QoS. How well would this script handle Cake QoS?
 
That would be great, as my two connections have different upload rates. Also, how would this affect my vpn client connection? It stays online 24/7.
 
That would be great, as my two connections have different upload rates. Also, how would this affect my vpn client connection? It stays online 24/7.

Should re-establish once failover/failback is successful. I run 2x VPN servers on my router, and clients have no issue connecting (assuming DDNS updates correctly). I expect the reverse to be true unless your VPN server is looking for specific IPs to accept connections from (hardly likely).
 
I know I have covered this before but I can’t remember the answer. I show 3 identical cron jobs for this script. I just rebooted the router and the results are the same.


*/1 * * * * /jffs/scripts/wan-failover.sh run #setup_wan_failover_run#
*/1 * * * * /jffs/scripts/wan-failover.sh run #setup_wan_failover_run#
*/1 * * * * /jffs/scripts/wan-failover.sh run #setup_wan_failover_run#
5 0 * * * /opt/sbin/logrotate /opt/etc/logrotate.conf >> /opt/tmp/logrotate.daily 2>&1 #logrotate#
*/2 * * * * /etc/openvpn/server1/vpn-watchdog1.sh #CheckVPNServer1#
25 20 * * * sh /jffs/scripts/firewall banmalware #Skynet_banmalware#
23 1 * * Mon sh /jffs/scripts/firewall update #Skynet_autoupdate#
0 * * * * sh /jffs/scripts/firewall save #Skynet_save#
37 */12 * * * sh /jffs/scripts/firewall debug genstats #Skynet_genstats#
 
I cleared it up by issuing the following commands. Now it only shows 1 cron instance for the script. I have no idea why it happens, but not a big deal since I now know how to correct it if it happens in the future.

I am sure it’s something I am doing that’s causing this anomoly. :)

sh /jffs/scripts/wan-failover.sh kill

sh /jffs/scripts/wan-failover.sh restart
 
I cleared it up by issuing the following commands. Now it only shows 1 cron instance for the script. I have no idea why it happens, but not a big deal since I now know how to correct it if it happens in the future.

I am sure it’s something I am doing that’s causing this anomoly. :)

sh /jffs/scripts/wan-failover.sh kill

sh /jffs/scripts/wan-failover.sh restart

I think if you just do "restart" it will do the kill and restart for you. @Ranger802004 would be able to confirm.
 
Sorry for the delays guy, was a busy weekend for me so I am going to work on this tonight and hopefully get another beta out this week.
 
I think if you just do "restart" it will do the kill and restart for you. @Ranger802004 would be able to confirm.

I tried that but it did not clear out the extra cron jobs. I am running the released version of the script, not any of the beta versions.
 
I think if you just do "restart" it will do the kill and restart for you. @Ranger802004 would be able to confirm.
Restart won't delete the cron jobs but "kill" will, run it a few times to get all of them deleted. I may make that do a for loop to keep removing until it is empty of cron jobs. Not sure how the duplicates are getting in there since it's a check for it existing before adding a new one. Rerun "cron" to reschedule a new cron job after they are deleted. Also this won't technically hurt anything having multiple entries for the cron job, once the script is launched and locks the lock file, no other instances will run until that one is closed.
 
Not sure how the duplicates are getting in there since it's a check for it existing before adding a new one.
Just noting that I’ve also seen “doubles” of your cron job quite a few times, though only after reboots, over the last few weeks of my testing across many betas - so there are definitely cases where your “check for duplicates” is not catching them.
 
Just noting that I’ve also seen “doubles” of your cron job quite a few times, though only after reboots, over the last few weeks of my testing across many betas - so there are definitely cases where your “check for duplicates” is not catching them.
Hmmm I wonder if multiple wan-events simultaneously is causing that to happen where they both query null returns and issue the add command. I will come up with a locking method for that and see if that helps remedy the issue.
 
v1.5.7-beta2 has been published, enable DEVMODE and run update.

This beta fixed the following issues with v1.5.7-beta1.
- Fixed issue with QoS settings not being applied at start up
- Fixed issue where multiple cron job instances were being ran potentially creating multiple Cron Jobs
- Continuous improvement in email functionality
- Fixed issue were deprecated option for PACKETSIZE kept logging it would be removed.

v1.5.7-beta2
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.
- 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.
 
v1.5.7-beta2 has been published, enable DEVMODE and run update.

This beta fixed the following issues with v1.5.7-beta1.
- Fixed issue with QoS settings not being applied at start up
- Fixed issue where multiple cron job instances were being ran potentially creating multiple Cron Jobs
- Continuous improvement in email functionality
- Fixed issue were deprecated option for PACKETSIZE kept logging it would be removed.

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

Looks much better in regard to QoS disable/enable based on settings in conf. Will monitor.

Aug 30 09:44:11 myrouter wan-failover.sh: WAN Switch - Disabling QoS Bandwidth Settings
Aug 30 09:44:11 myrouter wan-failover.sh: Debug - Outbound Bandwidth: 409600
Aug 30 09:44:11 myrouter wan-failover.sh: Debug - Inbound Bandwidth: 409600
Aug 30 09:44:11 myrouter wan-failover.sh: Debug - QoS Overhead: 42
Aug 30 09:44:11 myrouter wan-failover.sh: Debug - QoS ATM: 0
Aug 30 09:44:11 myrouter wan-failover.sh: Debug - QoS is Disabled
 
I'm the new guy in this thread... I may ask a "dumb" question. (be gentile)

Has anyone tried this script with a USB (cellular) Backup modem?
 

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