The WAN facing connection is sometime reinitialised and lost by the OPNsense server.
The solution is to monitor the WAN facing connection.
The script referenced above will try to restore the connetion by bringing the interface down and then up. If that does not work, it will issue a reboot of the system.
To enable monitoring, on needs to add a cron job in OPNsense that calls the action created by the script every 5 minutes for instance (less/more).
You may need to update the interface.
So to install this script: a. Copy it to your OPNsense instance. b. Execute it once interactively (copies script, and adds action)
Using the OPNsense UI, this action can be enabled as a cron job. Cron jobs are added under System>Settings>Cron. Add an entry that you:
- Enable
- Set minutes to
*/5
- Select "ping_check" as the command
- Set a description such as "Ping check and recover connection"
- Click save.