Page MenuHomeVyOS Platform

Extend failover route functionality to use dynamically assigned interface next hops
Open, NormalPublicFEATURE REQUEST

Assigned To
None
Authored By
JeffWDH
Oct 11 2023, 4:57 PM
Referenced Files
None
Tokens
"Like" token, awarded by giuavo."Like" token, awarded by marc_s."Like" token, awarded by KaydenD."Like" token, awarded by Viacheslav.

Description

In my use case I only require a failover (4G) to be used only when the primary connection fails. I am wondering if failover route monitoring could be extended to allow for a more bare bones failover solution. This would require the addition of automatically grabbing the next hop from various interfaces (via DHCP, PPPoE, etc) as it currently only allows for static routes.

Example:

set interfaces ethernet eth0 address dhcp
set interfaces ethernet eth0 description Primary

set interfaces ethernet eth1 address dhcp
set interfaces ethernet eth1 description Secondary

set interfaces ethernet eth2 address 192.168.0.1/24
set interfaces ethernet eth2 description LAN

set firewall group network-group LAN network 192.168.0.0/24

set protocols failover route 0.0.0.0/0 dhcp-interface eth0 check target interface
set protocols failover route 0.0.0.0/0 dhcp-interface eth0 check timeout ‘10’
set protocols failover route 0.0.0.0/0 dhcp-interface eth0 check type ‘icmp’
set protocols failover route 0.0.0.0/0 dhcp-interface eth0 metric ‘1’

set protocols failover route 0.0.0.0/0 dhcp-interface eth1 check target interface
set protocols failover route 0.0.0.0/0 dhcp-interface eth1 check timeout ‘10’
set protocols failover route 0.0.0.0/0 dhcp-interface eth1 check type ‘icmp’
set protocols failover route 0.0.0.0/0 dhcp-interface eth1 metric ‘2’

set nat source rule 100 description ‘SNAT - LAN - Outbound Primary’
set nat source rule 100 outbound-interface ‘eth0’
set nat source rule 100 source group network-group LAN
set nat source rule 100 translation address ‘masquerade’

set nat source rule 101 description ‘SNAT - LAN - Outbound Secondary’
set nat source rule 101 outbound-interface ‘eth1’
set nat source rule 101 source group network-group LAN
set nat source rule 101 translation address ‘masquerade’

The above syntax is just a suggestion and can be modified.

Details

Version
-
Is it a breaking change?
Unspecified (possibly destroys the router)

Event Timeline

An additional "nice to have" would be a hook that runs on route state change.
Examples:

set protocols failover route 0.0.0.0/0 next-hop 100.100.100.1 hook '/config/scripts/failover-hook-100.100.100.1'

set protocols failover route 0.0.0.0/0 dhcp-interface eth0 hook '/config/scripts/failover-hook-eth0'

Similar to the WAN load balancing hook, a variable with the state could be passed to the script.

Viacheslav triaged this task as Normal priority.Jan 14 2024, 8:13 PM

If this ever becomes a thing, support for directly connected routes (ie. PPPoE) would be great as well.

Is there any movement on implementing this? As per T2760 this is the only way to resolve IPsec on dynamic ip's

Forum thread with a nice workaround by giuppo77: https://forum.vyos.io/t/wan-failover-with-dhcp/
Not a generic solution but maybe an inspiration for implementation.

Is there any way to incentivize the addition of this?

Just found my way to this task, and yes, this would be a very useful feature to have with multiple DHCP based wan connections.

Now that T5942 has been merged, is there any interest in extending it to add PPPoE support? The state change hooks would be nice as well. Thanks!