Stateful nftables rules: conntrack, default drop, tracing
11 steps · about 3 h 40 min · Intermediate
- Stateful firewall (article, Wikipedia, 10 min)
Start with the idea of tracking sessions rather than judging each packet alone, since everything later builds on it.
- Netfilter (article, Wikipedia, 15 min)
Shows where hooks, connection tracking and nftables sit in the Linux kernel before you write any rules.
- Quick reference-nftables in 10 minutes (reference, nftables wiki (Netfilter project), 15 min)
The official vocabulary of tables, chains, hooks and rules, which you need to read any ruleset.
- nftables wiki (doc, nftables wiki (Netfilter project), 15 min)
The upstream index: use it to find the conntrack page, example rulesets and troubleshooting notes.
- nftables - Debian Wiki (doc, Debian Wiki, 10 min)
Practical setup: install the package, enable the service and find /etc/nftables.conf so you can run a first ruleset.
- How to Create a Stateful Firewall with nftables Connection Tracking (tutorial, OneUptime, 20 min)
A compact, complete default-drop ruleset with established,related accept, invalid drop and specific new-connection allows.
- How to Configure nftables for Stateful Packet Filtering on Ubuntu (tutorial, OneUptime, 25 min)
Adds named sets, logging and a server example, so you can make the first ruleset easier to maintain.
- Linux nftables Deep Dive: Modern Stateful Firewalls (article, Berik Ashimov, 25 min)
Goes deeper on conntrack matching, hook priorities and notrack, and introduces nft monitor trace.
- Designing Stateful Linux Firewalls with native nftables Rulesets and NAT (guide, KloudVin, 35 min)
Extends to forwarding, NAT, verdict maps, rate limits and atomic reloads, and shows tracing a single client's packets.
- nftables: The Modern Linux Firewall Replacing iptables — Complete Guide (2026) (guide, The Linux Club, 30 min)
Pulls it together with variables, sets and SSH brute-force limiting, plus syntax checking with nft -c before you apply.
- nftables - ArchWiki (reference, ArchWiki, 20 min)
A final reference for persistence and everyday usage once you are writing your own rules.