# Debian 10 Firewalld vs iptables thrashing about

**URL:** <https://forum.virtualmin.com/t/debian-10-firewalld-vs-iptables-thrashing-about/112010>\
**Category:** Help! (Home for newbies)\
**Created:** [August 27, 2021, 6:03pm UTC](https://forum.virtualmin.com/t/debian-10-firewalld-vs-iptables-thrashing-about/112010 "2021-08-27T18:03:14Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jabowery](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/jabowery/32/2650_2.png) [@jabowery](https://forum.virtualmin.com/u/jabowery)\
**Post date:** [August 27, 2021, 6:03pm UTC](https://forum.virtualmin.com/t/debian-10-firewalld-vs-iptables-thrashing-about/112010/1 "2021-08-27T18:03:14Z")

</div>

| System | Operating system | Debian Linux 10 |
| --- | --- | --- |
| Webmin version | 1.973 | Usermin version |
| Virtualmin version | 6.16 Pro | Authentic theme version |
| Time on system | Friday, August 27, 2021 5:48 PM | Kernel and CPU |

Linux IPTables Firewall  
IPv4 Firewall

```auto

**Rules file /etc/iptables.up.rules**
**External managed rules detected. Activate "[Directly edit firewall rules"] or your firewall rules may break.**

**Warning!** It appears that FirewallD is being used to generate your system's firewall. Maybe you should use the [FirewallD module] instead.

**WARNING! Your current IPtables configuration is invalid : iptables-restore v1.8.2 (nf_tables): Set f2b-proftpd doesn't exist. Error occurred at line: 45**

```

OK, so clicking on FirewallD:

```auto

FirewallD

### Failed to list zones : Error: INVALID_ZONE

```

So, as per [FirewallD - Invalid Zones - #8 by vminbeginner](https://forum.virtualmin.com/t/firewalld-invalid-zones/109081/8) I activated buster backports, uninstalled iptables, and reinstalled iptables, and still had a problem. So I installed firewalld hoping I could get things to work but that didn’t help either.

So I apt purge iptables and apt purge firewalld and apt install firewalld but that ended up with error messages like:

```auto
ERROR: '/usr/sbin/iptables-restore -w -n' failed: iptables-restore v1.8.2 (nf_tables):
                                                  line 4: RULE_REPLACE failed (No such file or directory): rule in chain INPUT
                                                  line 4: RULE_REPLACE failed (No such file or directory): rule in chain OUTPUT

```

but at least then I found this:

> **[Resolve 'ERROR: '/usr/sbin/iptables-restore -w -n' failed: iptables-restore...](https://www.allsupported.com/resolve-error-usr-sbin-iptables-restore-w-n-failed-iptables-restore-v1-8-2-nf_tables/)**
>
> After changing the configuration of a firewall the journal may report an error when restarting the firewall service such as \[…\]

Which said to edit /etc/firewalld/firewalld.conf and change IndividualCalls=no to IndividualCalls=yes

When I did that, at least firewalld seemed to be running without any status errors.

Hopefully I’ve not ended up with a damaged system.

UPDATE: Yep. Damaged. I had to reload from backup.

It would appear Debian 10 has a firewall problem that Virtualmin hasn’t been able to correct.

Is there some “howto” for getting Debian 10 and a firewall to work and play well together under Virtualmin?

---

<div class="post-metadata">

**Author:** ![Francewhoa](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/francewhoa/32/58_2.png) [@Francewhoa](https://forum.virtualmin.com/u/Francewhoa)\
**Post date:** [August 28, 2021, 4:20am UTC](https://forum.virtualmin.com/t/debian-10-firewalld-vs-iptables-thrashing-about/112010/2 "2021-08-28T04:20:28Z")

</div>

Hello [jabowery](https://forum.virtualmin.com/u/jabowery) 🙂 The Ubertus team faced the same challenge. To resolve this, we use both **[nftables](https://packages.debian.org/buster-backports/nftables)** and [**firewalld**](https://packages.debian.org/search?suite=buster-backports&searchon=names&keywords=firewalld) from the Backport for Debian 10 Buster.

* * *

Below are detailed steps & info. If those are of interest.

## Steps

1. Backup everything. This is optional, but recommended in the unlikely event that the following does not work.
2. Remove **iptables**
3. Reboot server
4. Install [**nftables**](https://packages.debian.org/buster-backports/nftables) from the Debian Buster Backport repository. So that you get a more recent version.
5. Install [**firewalld**](https://packages.debian.org/buster-backports/firewalld) from the Debian Buster Backport repository. So that you get a more recent version.
6. Adapt your Fail2Ban configurations appropriately for nftables. For example, but not limited to, using the Webmin Fail2Ban page, adapt its “ **Default action to apply** ” for nftables. For example **nftables-multiport**. Instead of **iptables-multiport**.
7. Reboot server
8. If fail2ban is not a fresh installation. It might need a few of its cycles to adapt itself.
9. If the above fails. Try the same steps but fully remove fail2ban, then reinstall a fresh new fail2ban.
10. Done. You have successfully resolved the challenge with fail2ban & iptables. Enjoy 🙂

Attribution to the Ubertus SysAdmin team & DevOps team for those steps

## Why nftables instead of iptables?

- Starting with Debian 10, iptables is officially deprecated with nftables. With Debian 11 the deprecated goes even further. iptables is now the default on Debian 11. Source at [https://www.phoronix.com/scan.php?page=news\_item&px=Debian-11-Nftables-Firewalld](https://www.phoronix.com/scan.php?page=news_item&px=Debian-11-Nftables-Firewalld)

- Starting in August 2020, nftables is included into the Linux Kernel. Which result in potential significant increase in both performance & security.

- Fail2Ban on Debian 10 has very good support for nftables. With lots of built-in configurations.

## Notes

For those not familiar with nftables. It is the new framework by the Netfilter Project. Which allows you to perform packet filtering (firewalling), NAT, mangling and packet classification.

**firewalld** is a front end management tool for nftables. Think of **nftables** as the engine. And **firewalld** as your dashboard.

Firewalld “owns” the firewall on the system, and all management should be done using the firewalld commands or the Webmin firewalld module. Attribution to Joe at [https://forum.virtualmin.com/t/firewall-iptables-and-firewalld-conflict/58278/5](https://forum.virtualmin.com/t/firewall-iptables-and-firewalld-conflict/58278/5)

Related wiki about nftables at [nftables - Debian Wiki](https://wiki.debian.org/nftables)

For those not familiar with Backport. It means you get more recent version of packages for Debian.

nftables replaces the old popular iptables, ip6tables, arptables and ebtables.

---

<div class="post-metadata">

**Author:** ![sonoracomm](https://cdn.forum.virtualmin.com/letter_avatar_proxy/v4/letter/s/71e660/32.png) [@sonoracomm](https://forum.virtualmin.com/u/sonoracomm)\
**Post date:** [September 2, 2021, 8:12pm UTC](https://forum.virtualmin.com/t/debian-10-firewalld-vs-iptables-thrashing-about/112010/3 "2021-09-02T20:12:41Z")

</div>

Do yourself a favor and implement CSF + LFD.

Sorry if this is not perfect for you. I just recommend CSF every chance I get (over any other iptables firewall and fail2ban). It’s well worth the learning curve.

[https://virtualarchitects.com/wiki/doku.php?id=networking:firewall:csf](https://virtualarchitects.com/wiki/doku.php?id=networking:firewall:csf)

G

---

<div class="post-metadata">

**Author:** ![jabowery](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/jabowery/32/2650_2.png) [@jabowery](https://forum.virtualmin.com/u/jabowery)\
**Post date:** [September 14, 2021, 3:48pm UTC](https://forum.virtualmin.com/t/debian-10-firewalld-vs-iptables-thrashing-about/112010/4 "2021-09-14T15:48:21Z")

</div>

> [@sonoracomm](#):
>
> CSF + LFD

None of the above works for me. I just deleted the rule that references fail2ban sshd.

Does anyone know of upgrading to Debian 11 breaks virtualmin?

It seems Debian 11 is the only place one can get a working firewall out-of-the-box.

---

<div class="post-metadata">

**Author:** ![system](https://cdn.forum.virtualmin.com/uploads/default/original/2X/c/cd96d761e326db4b2bef94886a639109bd7a8e76.svg) [@system](https://forum.virtualmin.com/u/system)\
**Post date:** [November 13, 2021, 3:49pm UTC](https://forum.virtualmin.com/t/debian-10-firewalld-vs-iptables-thrashing-about/112010/5 "2021-11-13T15:49:10Z")

</div>

Closed on November 13, 2021, 3:49pm UTC

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