Hi gurus and newbies,
i recently deployed a wireguard debian server (shall be knownst as WG for this post) in the cloud and then painfully setup my mikrotik onsite to tunnel to the WG server and then breakout to the internet. The reason behind me doing this is the following. I deploy cloud pbx extentions and recently setup recurrsive failover on a client site mikrotik BUT after failover occured, the voip server traffic was still routing to the extention via the failed WAN ip instead of the secondary. So my idea was to deploy the WIREGUARD server and have the gateway in the cloud rather which means either the primary or secondary WAN connection would still route the inbound calls to the desired extention after failover as occured (if anyone has a better way of doing this, the gods will shine on you for sharing).
the script i used to setup my mikrotik to tunnel to the WG cloud server is the following:
# You should change "XX.XX.XX.XX" to you wireguard server
# and set public-key,private-key,preshared-key,"YY.YY.YY.YY/YY" according to your config
/interface/wireguard/add name=wg0 private-key="[PRIVATE_KEY_HERE]"
/interface/wireguard/peers/add interface=wg0 endpoint-address=XX.XX.XX.XX endpoint-port=12321 public-key="[PUBLIC_KEY_HERE]" preshared-key="[PRESHARED_KEY_HERE]" persistent-keepalive=25s allowed-address=0.0.0.0/0
/ip/address/add interface=wg0 address=YY.YY.YY.YY/YY
/ip/route/add dst-address=XX.XX.XX.XX comment=wgserver disabled=yes
/ip/route/add dst-address=0.0.0.0/0 gateway=wg0
/ip/dhcp-client/add add-default-route=no interface=ether1 script=":local route [/ip route find comment=\"wgserver\"]\r\
\n:if (\$bound=1) do={\r\
\n /ip route set \$route gateway=\$\"gateway-address\" disabled=no\r\
\n} else={\r\
\n /ip route set \$route disabled=yes\r\
\n}" use-peer-dns=no use-peer-ntp=no
/interface/list/member/add interface=wg0 list=WAN
/ip/dns/set allow-remote-requests=yes servers=8.8.8.8,8.8.4.4
my question now is, how do i intergrate a reccursive failover into this configuration since the routing tables have become a lot more complex. My Mikrotik is setup simple with WAN1 on ether1, WAN2 on ether 2 and ether 3,4 and 5 all bridged for the LAN and using and RB 951