OPNsense Forum

English Forums => General Discussion => Topic started by: drivera on September 01, 2019, 11:59:19 pm

Title: Reset/Invalidate DHCP on interfaces when their gateways go down
Post by: drivera on September 01, 2019, 11:59:19 pm
Hi!

In my multi-WAN setup, I have my gateways configured such that their monitoring IP is a well-known, "always up", pingable IP on the general internet.  This is important because occasionally the ISPs will have a link be up, but with no internet connectivity. Thus, monitoring an "internet" address helps me cover for that case and apply failover even though the link appears to be up.

However, I've also found that they have another issue wherein when there's a connectivity hiccup - usually due to a short power outage (< 1 min) - the connection will seem to be up, but connectivity won't be restored.  This seems to be an issue with the CableModem/ISP connection itself since OPNSense is correctly detecting the lack of connectivity and refuses to fail-back to the primary.

The scenario is this:


The question I have regarding all the above is this: is there a way that I could somehow attach a custom script that is executed when a gateway is marked as "DOWN"? i.e. "when this interface's gateway is marked as down, flush the DHCP lease and leave it unconfigured until it comes back up on its own"

The alternative is for me to buy a USB- or Network-controllable power strip - IOT style - and through that custom script, trigger a power cycle of the Cable Modem, which ideally results in fixing everything up.

So...Thoughts? Ideas?
Title: [SOLVED] Reset/Invalidate DHCP on interfaces when their gateways go down
Post by: drivera on September 02, 2019, 02:10:30 am
Found (I think) my solution via /usr/local/etc/rc.syshook monitor.

I'll play around with that and maybe I'll be able to figure out an easy way to fire off a DHCP release/renew for the "failed" interface.

 The only question I have is how to preserve it in a backup other than manually. But that's small potatoes by comparison :)

Cheers!