[SOLVED] Apply Custom Firewall Rules Upon Reboot

Hi everyone,
I have custom firewall rules defined in LuCI within Network -> Firewall -> Custom Rules.

When I reboot (e.g. after power outage) the router (Turris Omnia, currently Turris OS version 5.1.0) these rules are not applied.

Executing service firewall restart (after reboot) restarts the firewall and applies the custom rules.

What do I need to do, to enable the rules upon reboot?

(If this has been solved already, I appreciate a link to the corresponding topic.)

Thanks so much!

One possibility is to use cron with clause “@reboot”, i.e.
@reboot service firewall restart

Another way is to use /etc/rc.local
I use that for Atlas service that does not start correctly upon reboot. It can be done via editing the file above or via > Local Startup tab.
I have it like:

(sleep 20; /etc/init.d/atlas restart) &
exit 0

Update 2021-02-22: This “solution” does not work. See my next post for a working solution.

Thanks for the replies!

I first tried adding a new file root to /etc/crontabs containing @reboot service firewall restart as this appears to be the more “modern” way. Unfortunately that did not work (and I did not have the time for further investigation).

However, adding

(sleep 30; /etc/init.d/firewall restart) & 

to /etc/rc.local (before exit 0) did the trick.

Issue is solved.

It turned out, that the “solution” from my previous post did not work.

To automatically restart the firewall upon reboot after a delay I added a file to /etc/cron.d containing

@reboot root sleep 60 && /etc/init.d/firewall restart

This actually works. :slight_smile: