cyclone: fail over to cellular based on WAN reachability #1363

Merged
JakeHillion merged 1 commits from jj/wmlqxmvowrlz into main 2026-10-01 01:12:39 +01:00
Owner

Cyclone only preferred the cellular default route when dhcpcd removed
its route on enp2s0. A primary WAN that kept its route but could not
reach the internet, or an IPv4LL default route installed by dhcpcd
during a flap, still won over cellular.

Added a wanFailover module under modules/networking and enabled it on
cyclone. A service pings 1.1.1.1, 8.8.8.8 and 9.9.9.9 bound to enp2s0
every 5 seconds, starting each round at the next target in turn; a
round passes if any target answers. After 3 consecutive failed rounds
it installs a metric 100 default route via cellular, and after 12
consecutive passed rounds it removes it again. Source NAT conntrack
entries are flushed on each switch, and the current state is read back
from the routing table on start.

Probing bound to enp2s0 keeps the primary measurable while cellular is
preferred, and the asymmetric thresholds with counters reset on any
opposing result prevent a flapping primary from bouncing traffic.

Test plan:

  • CI
  • Deploy to cyclone and confirm wan-failover starts on enp2s0
  • Drop outbound ICMP on enp2s0 with nft and confirm failover to
    cellular, then remove the rule and confirm failback after ~1 minute
Cyclone only preferred the cellular default route when dhcpcd removed its route on enp2s0. A primary WAN that kept its route but could not reach the internet, or an IPv4LL default route installed by dhcpcd during a flap, still won over cellular. Added a wanFailover module under modules/networking and enabled it on cyclone. A service pings 1.1.1.1, 8.8.8.8 and 9.9.9.9 bound to enp2s0 every 5 seconds, starting each round at the next target in turn; a round passes if any target answers. After 3 consecutive failed rounds it installs a metric 100 default route via cellular, and after 12 consecutive passed rounds it removes it again. Source NAT conntrack entries are flushed on each switch, and the current state is read back from the routing table on start. Probing bound to enp2s0 keeps the primary measurable while cellular is preferred, and the asymmetric thresholds with counters reset on any opposing result prevent a flapping primary from bouncing traffic. Test plan: - CI - Deploy to cyclone and confirm wan-failover starts on enp2s0 - Drop outbound ICMP on enp2s0 with nft and confirm failover to cellular, then remove the rule and confirm failback after ~1 minute
JakeHillion added 1 commit 2026-10-01 01:06:45 +01:00
cyclone: fail over to cellular based on WAN reachability
commit-validation / validate-single-commit (pull_request) Successful in 7s
flake-update / update (push) Successful in 33s
buildbot/nix-eval Build done. (636 warnings)
buildbot/nix-build Build done.
buildbot/nix-effects Build done.
36a8f06b0c
Cyclone only preferred the cellular default route when dhcpcd removed
its route on enp2s0. A primary WAN that kept its route but could not
reach the internet, or an IPv4LL default route installed by dhcpcd
during a flap, still won over cellular.

Added a wanFailover module under modules/networking and enabled it on
cyclone. A service pings 1.1.1.1, 8.8.8.8 and 9.9.9.9 bound to enp2s0
every 5 seconds, starting each round at the next target in turn; a
round passes if any target answers. After 3 consecutive failed rounds
it installs a metric 100 default route via cellular, and after 12
consecutive passed rounds it removes it again. Source NAT conntrack
entries are flushed on each switch, and the current state is read back
from the routing table on start.

Probing bound to enp2s0 keeps the primary measurable while cellular is
preferred, and the asymmetric thresholds with counters reset on any
opposing result prevent a flapping primary from bouncing traffic.

Test plan:
- CI
- Deploy to cyclone and confirm wan-failover starts on enp2s0
- Drop outbound ICMP on enp2s0 with nft and confirm failover to
  cellular, then remove the rule and confirm failback after ~1 minute
JakeHillion force-pushed jj/wmlqxmvowrlz from bb68079e92 to 36a8f06b0c 2026-10-01 01:06:45 +01:00 Compare
JakeHillion merged commit 36a8f06b0c into main 2026-10-01 01:12:39 +01:00
JakeHillion deleted branch jj/wmlqxmvowrlz 2026-10-01 01:12:39 +01:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: JakeHillion/nixos#1363