nft: Administration tool of the nftables framework for packet filtering and classification
nft [ -s ] list { ruleset [family] | tables [family] | table [family] TABLE | chains [family] | chain [family] TABLE CHAIN }
What it does
nftables is the kernel packet filter under iptables-nft: every iptables / ip6tables rule on these nodes is an nftables rule, and nft lists them all, in its own syntax.
Options you will use
list ruleset [family]- Print the whole ruleset (or only one family: ip, ip6, inet, arp, bridge, netdev).
list tables [family]- List the tables.
list table [family] TABLE- List all chains and rules of the table (family defaults to ip).
list chains [family]- List the chains: their declarations only, without rules.
list chain [family] TABLE CHAIN- List all rules of the chain.
-s, --stateless- Omit stateful information of rules and stateful objects (counter values).
-v, --version- Show version.
Examples
$ sudo nft list ruleseteverything kube-proxy, kubelet, Calico and ufw loaded, IPv4 and IPv6
$ sudo nft list chain ip filter INPUTone chain
$ sudo nft list tablesip / ip6 filter, nat, mangle - the iptables-nft tables
Gotchas
- Rules made by iptables-nft use xt compat expressions; nft prints the iptables extension's own translation (ct state new, fib daddr type local, log prefix ...), nothing for -m comment, and xt match "NAME" where there is no translation. Translations can lose detail: read such rules with iptables -S.
- "# Warning: table ip filter is managed by iptables-nft, do not touch!" (on stderr): do not change these tables with nft - kube-proxy and ufw rewrite them.
- Needs root: "Operation not permitted (you must be root)".
Try nft in a real terminal Free, in your browser - a real Ubuntu terminal to try it in, with missions that check your work.