Linux Commands Helper
💬 Your AI-powered Linux assistant
nft Command - Manage Netfilter Firewall Rules
The nft command is used to set up, maintain, and inspect packet filtering and classification rules in the Linux kernel. It is the modern replacement for iptables
.
Syntax
nft [options] [commands]
Examples
nft list ruleset
Display the current firewall ruleset.
nft add table inet filter
Create a new table called 'filter' in the 'inet' family.
nft add chain inet filter input { type filter hook input priority 0 ; }
Add a new chain to the 'filter' table for input packets.
Notes
- nft is intended to replace the older iptables, ip6tables, arptables, and ebtables tools.
- Requires root privileges to modify firewall rules.
- Configuration can be saved and restored using
nft list ruleset > rules.nft
andnft -f rules.nft
.