← BACK TO FORUM INDEX

CrowdSec VS Fail2Ban VS NFtables Sets

BY | Dec 3, 2026 | Network Security

CrowdSec vs Fail2Ban vs nftables Sets: Which Layer Stops Brute Force First?

Fail2Ban, CrowdSec, and plain nftables sets all reduce brute-force noise, but they sit at different layers. Fail2Ban watches local logs and bans. CrowdSec does the same and can share signals across a community. nftables sets are just firewall data structures you populate yourself. This post covers where each one belongs and how they can run together without fighting.

Visual Overview

What Changed

Fail2Ban Is Still the Local Baseline

It remains the simplest tool for watching auth logs and adding temporary bans. Most distributions package it, and the default SSH jail is enough for a single server.

CrowdSec Added Shared Signals

CrowdSec keeps the local agent model but lets you contribute and consume community decisions. The bouncer then pushes those decisions into nftables, iptables, or a reverse proxy.

nftables Sets Became the Common Enforcement Point

Both tools can write into nftables sets. You can also populate a set from your own scripts, blocklists, or other agents without running either daemon.

Technical Comparison

Fail2Ban

[sshd]
enabled  = true
maxretry = 5
findtime = 10m
bantime  = 10m
ignoreip = 203.0.113.4/32
Detection: auth.log / journald pattern match.
Enforcement: action.d rules into iptables or nftables.
Scope: single host, no shared signals. The values above are the shipped defaults.

CrowdSec

sudo cscli decisions list
sudo cscli metrics
sudo cscli bouncers list
Detection: YAML scenarios against parsed log streams.
Local API: LAPI on 127.0.0.1:8080.
Enforcement: separate bouncer to nftables, iptables, or a proxy. Scope is local plus the community decision feed.

nftables Sets

set banned_ipv4 {
    type ipv4_addr
    flags timeout
    timeout 1h
}
Detection: none, you supply every element.
Enforcement: ip saddr @banned_ipv4 drop.
Scope: kernel-level, no daemon, entries expire on the timeout flag.

Fail2Ban Basics

Install and enable

sudo apt install -y fail2ban
sudo systemctl enable --now fail2ban
The default configuration usually enables an SSH jail. Check status with sudo fail2ban-client status sshd.

Ignore your own IP

sudo nano /etc/fail2ban/jail.local
Add your admin addresses to ignoreip. Edit jail.local so package upgrades do not overwrite your changes.

What it does under the hood

Fail2Ban tails logs, matches failure patterns, and inserts temporary firewall rules. The jail controls maxretry, findtime, and bantime; the action defines where the rule lands, typically an iptables or nftables chain it manages. A ban survives until the timer expires or you lift it with fail2ban-client set sshd unbanip.

CrowdSec Basics

Install the agent

curl -s https://install.crowdsec.net | sudo sh
sudo apt install crowdsec
CrowdSec runs as a local agent that parses logs with scenarios. It can run without joining the community if you only want local decisions.

Add a bouncer

sudo apt install crowdsec-firewall-bouncer-nftables
sudo systemctl enable --now crowdsec-firewall-bouncer
The bouncer is the piece that actually blocks. Common options write to nftables, iptables, or sit in front of nginx/Caddy. Without a bouncer the agent only produces decisions.

Community lists

sudo cscli decisions list
You can consume curated blocklists that other instances have already flagged. This is the main difference from Fail2Ban: you see traffic that has not yet hit your own logs.

nftables Sets Alone

Create a dynamic set

table inet filter {
    set banned_ipv4 {
        type ipv4_addr
        flags timeout
        timeout 1h
    }
    chain input {
        type filter hook input priority 0; policy drop;
        ip saddr @banned_ipv4 drop
        # ... rest of your rules
    }
}
Elements can be added with nft add element inet filter banned_ipv4 { 192.0.2.1 } or by any tool that speaks nftables.

Populate from elsewhere

A small script, Fail2Ban action, CrowdSec bouncer, or even a cron job reading a blocklist can feed the same set. The firewall does not care where the address came from.

When this is enough

If you already have reliable log parsing elsewhere or only need a static/dynamic blocklist, a plain set avoids running another daemon.

Running Them Together

Common pattern

Use Fail2Ban or CrowdSec for detection and let both write into the same nftables set (or separate sets that feed the same drop rule). Avoid having two tools both manage the same chain directly.

Order of operations

Keep your base firewall policy first. Add the ban set as an early drop. Detection tools only insert and remove elements; they do not rewrite the whole ruleset.

What to watch

Check that your own IP is ignored, that ban timeouts are reasonable, and that you still have an out-of-band console. A misconfigured bouncer can lock you out the same way a bad UFW rule can.

Official Resources

Questions for the Community

Are you still on Fail2Ban only?

Or have you moved part of the load to CrowdSec or a pure nftables set?

How do you keep your own IP from being banned?

ignoreip, a separate management network, or something else?

Any unexpected interactions?

Did two tools fight over the same chain, or did a bouncer surprise you after an update?

Disclaimer

This content is for educational and informational purposes only. It is not technical advice. Firewall and ban configurations can lock you out. Test on a spare system, keep an out-of-band console available, and verify commands against the versions you actually run.

DISCUSSION

No replies yet. Be the first to join the discussion!

A1 AI Assistant
Call Text A1 Forum Tech News Contact Form
Cookie Settings