# FASTPANEL wipes the whole iptables table on every fastpanel2 service start (breaks fail2ban)

**URL:** <https://community.fastpanel.direct/t/fastpanel-wipes-the-whole-iptables-table-on-every-fastpanel2-service-start-breaks-fail2ban/110>\
**Category:** General\
**Created:** [December 1, 2026, 3:16pm UTC](https://community.fastpanel.direct/t/fastpanel-wipes-the-whole-iptables-table-on-every-fastpanel2-service-start-breaks-fail2ban/110 "2026-12-01T15:16:27Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fiery](https://yyz1.discourse-cdn.com/flex053/user_avatar/community.fastpanel.direct/fiery/32/459_2.png) [@Fiery](https://community.fastpanel.direct/u/Fiery)\
**Post date:** [December 1, 2026, 3:16pm UTC](https://community.fastpanel.direct/t/fastpanel-wipes-the-whole-iptables-table-on-every-fastpanel2-service-start-breaks-fail2ban/110/1 "2026-12-01T15:16:27Z")

</div>

Hi everyone,

I ran into something that took me a while to track down, so I’m sharing it in case it helps others (and maybe the devs can take a look).

**Setup:** Debian 12, kernel 6.1.0-54, iptables 1.8.9 (nf\_tables), fastpanel2 8.0+deb12p23, fail2ban 1.0.2 using `iptables-ipset-proto6-allports`.

**What I noticed:** my fail2ban status showed thousands of banned IPs, but the matching ipsets had only a few hundred entries. Digging into it, I found the cause: every time the `fastpanel2` service starts (including the automatic package updates, which happen every 2-3 days), the panel recreates the `ip filter` and `ip6 filter` tables from scratch. All the rules added by other tools, like the fail2ban `--match-set f2b-...` rules, disappear.

fail2ban then notices (`Invariant check failed` / `iptables: Bad rule` in its log), recreates its actions, and the ipsets come back empty. The bans only live in fail2ban’s memory, so those IPs aren’t actually blocked until they trigger a new ban.

**How to reproduce:**

1. `iptables -S INPUT | grep -c f2b` → 6
2. `systemctl restart fastpanel2`
3. `iptables -S INPUT | grep -c f2b` → 0

---

<div class="post-metadata">

**Author:** ![fpuser](https://yyz1.discourse-cdn.com/flex053/user_avatar/community.fastpanel.direct/fpuser/32/507_2.png) [@fpuser](https://community.fastpanel.direct/u/fpuser)\
**Post date:** [December 1, 2026, 5:43pm UTC](https://community.fastpanel.direct/t/fastpanel-wipes-the-whole-iptables-table-on-every-fastpanel2-service-start-breaks-fail2ban/110/2 "2026-12-01T17:43:27Z")

</div>

> [@Fiery](#):
>
> Hi everyone,
> 
> I ran into something that took me a while to track down, so I’m sharing it in case it helps others (and maybe the devs can take a look).
> 
> **Setup:** Debian 12, kernel 6.1.0-54, iptables 1.8.9 (nf\_tables), fastpanel2 8.0+deb12p23, fail2ban 1.0.2 using `iptables-ipset-proto6-allports`.
> 
> **What I noticed:** my fail2ban status showed thousands of banned IPs, but the matching ipsets had only a few hundred entries. Digging into it, I found the cause: every time the `fastpanel2` service starts (including the automatic package updates, which happen every 2-3 days), the panel recreates the `ip filter` and `ip6 filter` tables from scratch. All the rules added by other tools, like the fail2ban `--match-set f2b-...` rules, disappear.
> 
> fail2ban then notices (`Invariant check failed` / `iptables: Bad rule` in its log), recreates its actions, and the ipsets come back empty. The bans only live in fail2ban’s memory, so those IPs aren’t actually blocked until they trigger a new ban.

Have not seen that issue on our end but we are on Ubuntu 24.04 using nftables, running fail2ban with various jails and was hoping to try and reproduce/shed light, sorry.

---

<div class="post-metadata">

**Author:** ![Less\_Stupid\_AI\_bot](https://avatars.discourse-cdn.com/v4/letter/l/9fc29f/32.png) [@Less\_Stupid\_AI\_bot](https://community.fastpanel.direct/u/Less_Stupid_AI_bot)\
**Post date:** [December 2, 2026, 7:39am UTC](https://community.fastpanel.direct/t/fastpanel-wipes-the-whole-iptables-table-on-every-fastpanel2-service-start-breaks-fail2ban/110/3 "2026-12-02T07:39:50Z")

</div>

[English]

On your Debian 12 system, you saw the fail2ban rules disappear when FASTPANEL restarted, even though fail2ban still listed active bans. That gap matters because a listed ban only protects the server while the firewall enforces it. The Ubuntu reply describes a different nftables setup.

Is firewall management enabled in FASTPANEL? From the occurrence you already captured, please share one matching fail2ban error line with addresses removed. If your panel has changed since `8.0+deb12p23`, include the installed version. The existing incident is enough for this check. I couldn’t confirm a workaround that restores both the rules and the active bans.

---

<div class="post-metadata">

**Author:** ![Fiery](https://yyz1.discourse-cdn.com/flex053/user_avatar/community.fastpanel.direct/fiery/32/459_2.png) [@Fiery](https://community.fastpanel.direct/u/Fiery)\
**Post date:** [December 2, 2026, 8:14am UTC](https://community.fastpanel.direct/t/fastpanel-wipes-the-whole-iptables-table-on-every-fastpanel2-service-start-breaks-fail2ban/110/4 "2026-12-02T08:14:56Z")

</div>

Thanks for following up. I’ve investigated this further and was able to reproduce the same behaviour on a second server.

**Regarding your questions:**

- **FASTPANEL firewall management:** Yes, it is enabled on both servers.

- **FASTPANEL version on the original Debian 12 server:** `8.0+deb12p23`.

Here is an exact Fail2ban error from the original incident (27 November 2026):

```auto
2026-11-27 05:02:49,795 fail2ban.utils [620]: ERROR -- stderr: 'iptables: Bad rule (does a matching rule exist in that chain?).'
2026-11-27 05:02:49,795 fail2ban.CommandAction [620]: ERROR Invariant check failed. Trying to restore a sane environment

```

The corresponding IPv6 check failed in the same way:

```auto
ip6tables: Bad rule (does a matching rule exist in that chain?).

```

The command being checked was looking for a rule matching the `f2b-nginx-404` IPSET in the `INPUT` chain.

**Original server — Debian 12:**

- FASTPANEL `8.0+deb12p23`

- Fail2ban `1.0.2`

- iptables/ip6tables `1.8.9 (nf_tables)`

- FASTPANEL firewall global policy: “Deny everything that is not explicitly allowed”, with 12 explicit ACCEPT rules.

**Second server — Debian 11:**

- FASTPANEL `8.0+deb11p23`

- Fail2ban `0.11.2`

- iptables/ip6tables `1.8.7 (nf_tables)`

- FASTPANEL firewall global policy: “Allow everything that is not explicitly denied”, with two explicit ACCEPT rules.

On both servers, monitoring nftables changes confirmed that restarting the `fastpanel2` service rebuilds the IPv4 and IPv6 `filter` tables, removing Fail2ban’s `--match-set` rules.

On the Debian 11 server, the IPSET sets and their entries remained intact after the rebuild, while the corresponding firewall rules were missing. I have not independently established the same IPSET persistence result on the Debian 12 server.

On the original Debian 12 server, manually restarting Fail2ban restored the expected IPv4 and IPv6 match-set rules. I also implemented and tested a delayed systemd hook to restart Fail2ban after FASTPANEL starts. This restores the rules as a workaround, although it does not address the underlying issue.

The same behaviour occurring with two different FASTPANEL firewall policies suggests that the issue is not specific to the default firewall policy.

The key point is that FASTPANEL’s firewall table rebuild removes rules installed by Fail2ban, leaving its IPSET-based bans without the corresponding rules in the INPUT chain.
