Feature Request - Gateway Monitoring enhancements

Started by dmcgough, November 19, 2026, 03:48:30 AM

Previous topic - Next topic
In my setup, I use 2 fiber connections at home. I use the Gateways feature to fail over from my primary to secondary link. I wish that I had a few more options for specifying what I want to be monitored on that specific link, however.

For example, testing reachability to the gateway address doesn't necessarily tell me I have actual internet reachability. I can manually put in the DNS server from that WAN provider, but I'd rather just be able to click a box and tell it to monitor the DNS server(s) that it received via DHCP on the WAN link. Or maybe the gateway and one or two DNS servers. Maybe don't fail the link til all 3 fail, or fail it as soon as any reachability to any of them fails. Or high packetloss (definable).

I can manually put in a DNS server for each Gateway, but if the provider changes this IP for any reason, my failover configuration may break. If it's on my secondary, I might not notice and I might have the link unintentionally marked down (because it can't reach the now-defunct DNS server) because I didn't check it often enough.

Also I noticed that when I put in an IP as a monitor IP, the system also created a route for it. I'm not sure, but I wonder if that would then force all traffic to that IP out that link - when my actual goal was just to monitor the IP reachability via that WAN link (but not to affect traffic from the inside to that address). Make sense?

Thanks!!

Host route: yes, your suspicion is right. A monitor IP gets a /32 host route via that gateway, so all routed traffic to that IP goes out that WAN, not just the monitoring pings. The fix is the gateway's advanced option "Disable Host Route", or picking monitor IPs you don't otherwise use. That's also why it's a bad idea to monitor the DNS server your clients actually use. A common pattern is a different public anycast IP per WAN (for example 1.1.1.1 on one, 9.9.9.9 on the other), none of them used for DNS.

Monitoring past the gateway: agreed, monitoring the ISP's next hop only proves the link to the ISP is up. A stable public anycast IP tests real internet reachability, and it won't change the way an ISP's DHCP-provided DNS can.

Defining "bad": this already exists. Each gateway has latency and packet loss thresholds under its advanced settings, plus probe interval, time period and loss interval. In the gateway group, the Trigger Level lets you choose whether failover happens on Member Down, Packet Loss, High Latency, or Packet Loss or High Latency.

Multiple monitor targets ("fail only if all 3 fail"): as far as I know there's no native option. dpinger monitors one target per gateway. That would be a good feature request on GitHub (opnsense/core).

Noticing problems on the secondary: dpinger logs every state change, so grep 'Alarm' /var/log/gateways/latest.log shows every drop, including on a link that isn't carrying traffic.

Thanks, I was unaware of the "Disable Host Route" option. This will make it easier to pick some example anycast addresses. I may still look into making the FR for monitoring multiple targets and setting down criteria. That way, I can test per-link reachability to multiple remote networks that matter to me. This would help enact a fail over if there are peering problems to a network that matters to me.

I still prefer having the option to monitor an 'internal' address as well, like the WAN-provided DNS server. It's something beyond the ISP gateway but not so far as a foreign network address, and it's something that should be up all the time. It doesn't change often, but it's something that's made available programmatically. If I can say "monitor the DHCP-provided DNS server" vs "monitor this IP that I looked up that, at the time of configuration, was the DHCP-provided DNS server"... it accomplishes the same goal - until it doesn't. Anything where I can configure my intent (that should continue to function after changes are made) vs something explicit is almost always preferable.

The 'defining bad' was more about being able to define failover conditions once I'm able to monitor more than one IP. I was aware of the very granular per-gateway packetloss and latency configurations - just need to extend that concept to multiple members and settings AND / OR conditions. Does one high packetloss to 1 of 3 monitor IPs initiate a failure, or does it need to be 2 of 3? That sort of stuff.

Makes sense. One stopgap until that exists:

Catch the DNS server changing: a small script run from cron or as a Monit "program" check could compare the WAN's current DHCP-provided DNS server with the gateway's configured monitor IP, and alert when they differ. It doesn't fix the monitor automatically, but you'd find out the day the ISP changes it, rather than when the secondary unexpectedly shows down.

Smart thinking - thanks again for the help!