List ruleset with rule handles nftables
-a prints '# handle N' per rule; you need the handle to delete a single rule
nft -a list ruleset
more nftables
all 12 commands →
Delete a single rule by handle
nft delete rule inet filter input handle 7
Named counter on a rule
nft add rule inet filter input tcp dport 22 counter accept comment \"ssh\"
SNAT masquerade for outbound NAT
nft add rule ip nat postrouting oifname \"eth0\" masquerade
DNAT port forward to internal host
nft add rule ip nat prerouting iif \"eth0\" tcp dport 443 dnat to 10.0.0.5:8443
Rate-limit new connections
nft add rule inet filter input tcp dport 22 ct state new limit rate 10/minute accept