What's new

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!

Changing from Failover Mode to Load Balance Mode does require a reboot unfortunately. If you switch back to Failover Mode you could add your rules like this via CLI. *** I realized I mistyped my example to you in my prior post as well. ***

Test using this example:
Code:
ip rule add from 192.168.50.137 to all table 200 priority 150

Once you have tested that you could add something like this firewall-start script to make sure it stays added and as well doesn't create duplicates, add each IP to the IPS array, one IP per line between the quotes.

Code:
# Redirect IPs to WAN1
IPS='
192.168.50.137
'
TABLE="200"

for IP in ${IPS}; do
  if [ -z "$(ip rule list from ${IP} to all lookup ${TABLE} priority 150)" ] >/dev/null;then
    ip rule add from ${IP} to all table ${TABLE} priority 150
  fi
done
IPS=""
TABLE=""
like you I get busy, but was playing around this morning. This, even if incorrect made .24 use wan1
ip rule add from 192.168.50.24 to all table 200 lookup wan1
Fyi, i struggle with this stuff
 
I finally made my way over to using this script, I've been reading and reading but I can't figure out the possibility to enable OpenVPN client 1 on failover only and disable client on fallback. I'm sure this has been discussed somewhere before, but I only want VPN enabled when I'm on WAN1. Any help appreciated.
 
I finally made my way over to using this script, I've been reading and reading but I can't figure out the possibility to enable OpenVPN client 1 on failover only and disable client on fallback. I'm sure this has been discussed somewhere before, but I only want VPN enabled when I'm on WAN1. Any help appreciated.
I recommend to use VPNMON-R2 by @Viktor Jaep for this, I purposely do not build in this feature to allow leverage of his tool to perform VPN Monitoring.
 
I recommend to use VPNMON-R2 by @Viktor Jaep for this, I purposely do not build in this feature to allow leverage of his tool to perform VPN Monitoring.
I was literally just reading his readme, but I wasn't sure the feature I was looking for was included. Using VPN only on wan1 and not on wan0 should be possible using VPNMON?
 
I was literally just reading his readme, but I wasn't sure the feature I was looking for was included. Using VPN only on wan1 and not on wan0 should be possible using VPNMON?
By default VPNMON-R2 will try to connect and monitor a VPN connection on either WAN0 or WAN1... it's whatever your preference is. It's purpose is to make a connection and maintain it, no matter the cost. It will not, however, only initiate a connection after a failover... Sorry. ;)
 
Last edited:
By default VPNMON-R2 will try to connect and monitor a VPN connection on either WAN0 or WAN1... it's whatever your preference is. It's purpose is to make a connection and maintain it, no matter the cost. It will not, however, only initiate a connection after a failover... Sorry. ;)
I misread the actual question when I was on my phone.
 

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