OPNsense Forum

English Forums => General Discussion => Topic started by: RamSense on June 16, 2025, 01:55:13 PM

Title: *SOLVED* Monit - apply settings gateway cli command with reboot opnsense
Post by: RamSense on June 16, 2025, 01:55:13 PM
Hi,

I have my WireGuard not working after a reboot of opnsense ( looks a lot like this post: https://forum.opnsense.org/index.php?topic=41081.0 (https://forum.opnsense.org/index.php?topic=41081.0) and this one https://forum.opnsense.org/index.php?topic=36688.0 (https://forum.opnsense.org/index.php?topic=36688.0)). When I just hit [apply] on the SYSTEM: GATEWAYS: CONFIGURATION page (without making changes) all starts working with WireGuard.

I'm trying to "fix" this by cloning the Monit alert settings [gateway alert] and in service test settings, execute and something like path:
/bin/sh -c '/usr/local/sbin/configctl interface routes alarm'

What is the cli command for "apply settings gateway, without changing configuration?"

Or is there another way to automate this after an Opnsense reboot?

Thank you for your help with this.
Title: Re: Monit - apply settings gateway cli command with reboot opnsense
Post by: RamSense on June 17, 2025, 06:56:13 PM
I have tested the command /bin/sh -c '/usr/local/sbin/configctl interface routes alarm'after a reboot manually from shell, and wireguard instantly started getting data and starts working with ipv4 and ipv6 showing.
So I am getting closer.

I am thus looking for a way for Monit to execute this command with a reboot of my OPNsense box.

Can someone help me how to manage that with monit?
Title: Re: Monit - apply settings gateway cli command with reboot opnsense
Post by: RamSense on June 19, 2025, 06:45:24 PM
I solved this, not by monit or cron job, but making a custom script in /usr/local/etc/rc.syshook.d/start

#!/bin/sh

/usr/local/sbin/configctl interface routes alarm

Named it 99-gatewayboot and made the file executable.

(99 to get it started as late as possible)

Now it is working and I have a fix for my Wireguard problem for now at reboot of OPNsense.