iptables
Cheat sheet · https://pcornel.dk/topic.php?topic=2811
Answer
iptables is the classic tool for netfilter rules, with tables (filter, nat, mangle) and chains (INPUT, FORWARD, OUTPUT …). On current distributions iptables is usually iptables-nft, which writes nftables rules.
Remember
Rules are evaluated top to bottom; the first terminating match wins. iptables -L -n -v --line-numbers shows counters. Save and restore with iptables-save/iptables-restore (or the distribution's persistence package). Do not mix iptables-legacy and nft rules.
First checks
nft list ruleset— all nftables rulesiptables -S; iptables -t nat -S— iptables rules (if used)firewall-cmd --list-all— firewalld zone settingsufw status verbose— UFW rules and defaultsss -tulpn— which services listen
Commands
iptables -V- Fast checks
iptables
Verify in this order
packet → table and chain → rules top to bottom → first match target → policy if none
Where it usually breaks
First mismatch in link/interface → address/namespace → route/neighbor → firewall/policy → socket/daemon → DNS/TLS/SSH/application peer path; preserve identity/native diagnostic/pre-state before mutation.
Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=2811