nftables Cheatsheet

Modern firewall.

Overview

nftables is the modern Linux firewall and the long-term replacement for iptables. Five primitives carry most operational use: unified inet syntax across v4/v6/ARP/bridge, atomic rule updates, native sets and maps, per-rule counters and quotas, JSON output for automation. Fluency turns network policy into clean, observable, atomically loaded rules instead of the historical iptables/ip6tables/arptables sprawl.

The approach

Tables and chains first, set-based rules for anything dynamic, atomic loads from a file under version control. Five idioms cover most operational nftables use; memorising them moves the team from "edit ruleset live" to confident, auditable firewall management.

Why this compounds

Each rule captures policy as code. Counters surface which rules actually fire; named sets keep the policy compact as the blocklist grows. By year two the team's firewall reviews are reading set-membership diffs instead of hunting through hundreds of iptables -A lines.