OPNsense Forum

Archive => 21.1 Legacy Series => Topic started by: jonf on February 16, 2021, 01:15:32 pm

Title: Email alert when WAN drops/reconnects?
Post by: jonf on February 16, 2021, 01:15:32 pm
I'd like to get an email alert from OPNsense when my WAN connection has dropped and reconnected. As a bonus it would be nice if it could also show me the new IP addresses (v4 and v6) within the email. How could I do this?
Title: Re: Email alert when WAN drops/reconnects?
Post by: thowe on February 17, 2021, 06:11:58 pm
The simplest solution is theoretically the monit plugin. This can do exactly that. But then you have a problem: If you want to send mails over the internet when the WAN is down, this will probably not work. :-)

I have this setup. But I also have 2 different redundant WAN lines in one group. I.e. if one of the WAN lines is down, the notification is sent over the other one.

But this could help you:
Additionally I have set up an external monitoring from outside. For this I have set up a simple ping check at https://uptimerobot.com/ (free of charge). By default your OPNsense will not respond to external pings, so the test will always be "down". Therefore you have to use a firewall rule to selectively allow ICMP packets on the WAN port for the hosts of UptimeRobot. The easiest way to do this is to set up an alias of the type URL Table (IPs), which automatically fetches the current IP addresses from UptimeRobot (they publish this!). On this alias you can then set up the WAN rule. Have a look at the screenshot.