# Executing scripts at boot time

**URL:** <https://forum.openwrt.org/t/executing-scripts-at-boot-time/91992>\
**Category:** Installing and Using OpenWrt\
**Created:** [March 22, 2021, 11:04am UTC](https://forum.openwrt.org/t/executing-scripts-at-boot-time/91992 "2021-03-22T11:04:18Z")\
**Posts on this page:** 6\
**Page:** 2

<div class="post-metadata">

**Author:** ![trendy](https://forum.openwrt.org/user_avatar/forum.openwrt.org/trendy/32/8800_2.png) [@trendy](https://forum.openwrt.org/u/trendy)\
**Post date:** [March 23, 2021, 10:26am UTC](https://forum.openwrt.org/t/executing-scripts-at-boot-time/91992/21 "2021-03-23T10:26:25Z")

</div>

If your problem is solved, please consider marking this topic as [Solved]. See [How to mark a topic as [Solved]](https://forum.openwrt.org/t/how-to-mark-a-topic-as-solved/40174) for a short how-to.

---

<div class="post-metadata">

**Author:** ![SharkScout](https://forum.openwrt.org/user_avatar/forum.openwrt.org/sharkscout/32/32884_2.png) [@SharkScout](https://forum.openwrt.org/u/SharkScout)\
**Post date:** [March 24, 2021, 7:50am UTC](https://forum.openwrt.org/t/executing-scripts-at-boot-time/91992/22 "2021-03-24T07:50:44Z")

</div>

I am quite sympathetic to your idea. I also wanted to do this originally, as I am familiar with `iptables` but was new (still am) to openWrt.

I eventually decided against it though, because it became apparent that many services in openWrt rely on the `fw3` firewall. Even other firewall type applications like `banIP` do not try to replace `fw3`.

If you use `iptables` directly and disable `fw3`, you actually have very little user testing on openWrt, it seems.

So kudos to you for trying anyway. Please keep us updated on this, particularly if you hit security issues. I suspect you might discover unknown edge cases in that setup at some point.

---

<div class="post-metadata">

**Author:** ![Bcw](https://forum.openwrt.org/letter_avatar/bcw/32/6_449c533f586939b6e5f246632a46421f.png) [@Bcw](https://forum.openwrt.org/u/Bcw)\
**Post date:** [March 24, 2021, 9:48am UTC](https://forum.openwrt.org/t/executing-scripts-at-boot-time/91992/23 "2021-03-24T09:48:26Z")

</div>

In the Linux systems I've worked with - and I believe OpenWrt is no different - the firewall functionality is always provided by iptables. You need to flush the tables if you want to disable the firewall. From what I've read fw3 has it's own description of the firewall (in its own language) and creates iptables rules. If you disable the fw3 firewall iptables gets flushed. If you re-enable these tbles are rebuilt from the fw3 description.

I expect that other tools that need to modify iptables go through fw3 to manipulate the firewall.

I agree that having two hands on the wheel (in this case modify iptables directly and through fw3) is not a good idea.  
I followed the recommendation of Pavel - I cleared the default firewall rules and added my own in the firewall.user.  
All the default chains (not used by me, but possibly by other tools) are still there.  
If I stop and restart the firewall (using luci) all my private rules are reconstructed. Which, of course is, would not be the case if I use a script to create these rules.

As an aside - on a soapbox - I personally do not feel fw3 adds a lot of value. Sure, creating safe firewall rules can be complex and tricky. From the fw3 description it's purpose is to simplify things. It probably depends on your past experience and the situation in which the router is deployed.  
I would be quite happy with a barebone Linux system, which would permit me to use standard default Linux tools.

But, although I do have some past experience with OpenWRT from the white Russian days - I am still reacquainting myself with OpenWRT. I now have two test systems running, and these seem to work well. I do appreciate the possibilities OpenWRT opens that on the default router firmware would not be possible.

---

<div class="post-metadata">

**Author:** ![vgaetera](https://forum.openwrt.org/user_avatar/forum.openwrt.org/vgaetera/32/113586_2.png) [@vgaetera](https://forum.openwrt.org/u/vgaetera)\
**Post date:** [March 24, 2021, 11:53am UTC](https://forum.openwrt.org/t/executing-scripts-at-boot-time/91992/24 "2021-03-24T11:53:14Z")

</div>

> [@Bcw](#):
>
> All the default chains (not used by me, but possibly by other tools) are still there.

Unfortunately, no, e.g. you are missing zone-specific chains.  
Those are used for connection tracking, traffic marking, forwarding, masquerading, etc.

> [@Bcw](#):
>
> I personally do not feel fw3 adds a lot of value.

Don't underestimate the importance of safe config.  
Even experienced users are prone to make mistakes and typos.  
Modular verification applied by fw3 can significantly minimize related risks.

Moreover, iptables is on the verge of deprecation.  
All modern general-purpose Linux distros should have already utilized nftables.  
And the next version of OpenWrt firewall aka fw4 relies on nftables.

---

<div class="post-metadata">

**Author:** ![reinerotto](https://forum.openwrt.org/letter_avatar/reinerotto/32/6_449c533f586939b6e5f246632a46421f.png) [@reinerotto](https://forum.openwrt.org/u/reinerotto)\
**Post date:** [March 24, 2021, 6:54pm UTC](https://forum.openwrt.org/t/executing-scripts-at-boot-time/91992/25 "2021-03-24T18:54:18Z")

</div>

> [@Bcw](#):
>
> As an aside - on a soapbox - I personally do not feel fw3 adds a lot of value.  
> I would be quite happy with a barebone Linux system, which would permit me to use standard default Linux tools.

+1.  
As long as you are happy with the plain LuCi management, fw3 seems to be OK, because even to be required.  
However, in case of trying "unusual" or more advanced system setups, fw3 is a real pothole in the road to succesful implementation.  
Which finally caused me to drop fw3 for all setups, even simple ones.

I do not see the benefit in inventing a new method of describing the firewall (read: iptables) rules, when the bare-bone iptables-rules would suffice. And having the advantage of the availability of a lot of docs.

---

<div class="post-metadata">

**Author:** ![system](https://forum.openwrt.org/uploads/default/original/3X/7/4/740520c71f00039bbf001045c682f0ecb25e905a.png) [@system](https://forum.openwrt.org/u/system)\
**Post date:** [April 3, 2021, 6:54pm UTC](https://forum.openwrt.org/t/executing-scripts-at-boot-time/91992/26 "2021-04-03T18:54:46Z")

</div>

Closed on April 3, 2021, 6:54pm UTC

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.

[Previous page](https://forum.openwrt.org/t/executing-scripts-at-boot-time/91992.md?page=1)
