Skip to main content

Menu

LEVEL 0
0/5 XP
HomeAboutTopicsPricingMy VaultStats

Categories

πŸ€– Artificial Intelligence
☁️ Cloud and Infrastructure
πŸ’Ύ Data and Databases
πŸ’Ό Professional Skills
🎯 Programming and Development
πŸ”’ Security and Networking
πŸ“š Specialized Topics
HomeAboutTopicsPricingMy VaultStats
LEVEL 0
0/5 XP
GitHub
Β© 2026 CheatGridβ„’. All rights reserved.
Privacy PolicyTerms of UseAboutContact

nftables Modern Linux Firewall Cheat Sheet

nftables Modern Linux Firewall Cheat Sheet

Back to Operating Systems and CLI
Updated 2026-05-21
Next Topic: Operating System Fundamentals Cheat Sheet

nftables is the successor packet-classification framework built into the Linux kernel, replacing the legacy quartet of iptables, ip6tables, arptables, and ebtables with a single unified tool (nft). It has been available since Linux kernel 3.13 (2014) and is now the default firewall backend on all major distributions β€” RHEL 8+, Fedora 32+, Debian 10+, and Ubuntu 20.04+. Unlike iptables, nftables has no predefined chains; every table, chain, and hook must be explicitly declared, which eliminates unnecessary overhead but requires understanding the hierarchy: tables β†’ chains β†’ rules. The single most important mental model to internalize is that nftables processes chains in hook-priority order, and an accept verdict in one chain does not guarantee the packet is never seen by a later chain attached to the same hook.

What This Cheat Sheet Covers

This topic spans 21 focused tables and 150 indexed concepts. Below is a complete table-by-table outline of this topic, spanning foundational concepts through advanced details.

Table 1: Address Families (Table Families)Table 2: nft Command Reference β€” Tables, Chains, and RulesTable 3: Base Chain Hooks and Hook Priority ValuesTable 4: Base Chain TypesTable 5: Verdict Statements and Flow ControlTable 6: Packet Matching β€” IP, TCP/UDP, and Meta ExpressionsTable 7: Connection Tracking (ct) ExpressionsTable 8: Sets β€” Anonymous, Named, and Interval SetsTable 9: Maps and Verdict Maps (vmaps)Table 10: NAT β€” Source NAT, Masquerade, DNAT, and RedirectTable 11: Rate Limiting β€” limit Statement and MetersTable 12: Counters, Logging, and the log StatementTable 13: Persisting Rules β€” nftables.conf and systemdTable 14: Ruleset Debugging β€” nft monitor trace and nftraceTable 15: iptables-to-nftables MigrationTable 16: firewalld Interaction (RHEL / Fedora)Table 17: UFW Interaction (Ubuntu / Debian)Table 18: Docker and nftablesTable 19: Kubernetes and nftables (kube-proxy)Table 20: Flowtables β€” Kernel Fast-Path ForwardingTable 21: Complete Ruleset Examples

Table 1: Address Families (Table Families)

Each nftables table is tied to an address family that determines which layer of the networking stack it inspects. Choosing the right family is the first design decision, because it controls both which hooks are available and what traffic the rules can see.

TypeExampleDescription
inet
add table inet filter
β€’ Covers both IPv4 and IPv6 in the same ruleset
β€’ the preferred family for dual-stack hosts
β€’ Replaces separate iptables + ip6tables rulesets
ip
add table ip filter
β€’ IPv4 traffic only
β€’ Legacy-equivalent to iptables.
ip6
add table ip6 filter
β€’ IPv6 traffic only
β€’ Legacy-equivalent to ip6tables.

More in Operating Systems and CLI

  • Modern Rust-Based CLI Tools Cheat Sheet
  • Operating System Fundamentals Cheat Sheet
  • AWS CLI Cheat Sheet
  • GCP CLI Cheat Sheet
  • Linux Text Processing with grep, sed, and awk Cheat Sheet
  • systemd and Linux Service Management Cheat Sheet
View all 48 topics in Operating Systems and CLI