iptables
NetworkPackage: iptablesHandle with care
Linux's historical rule-based firewall; on recent Ubuntu, a compatibility layer over nftables. Rules live in memory: what you add is gone at reboot unless something saves it.
A mistake with this command can destroy data or lock you out
- A
DROPrule on port 22, or a defaultDROPpolicy set before the rule allowing SSH, cuts your own session. Test with asleep 120 && iptables -Fstarted beforehand, or from the console.
What its options do in the lessons
From the same glossary the lessons render under their commands, so the two cannot disagree.
iptables -L- Lists the rules. On Ubuntu 24.04 the command is the nft front end: it shows the same ruleset
nftdoes, in an older grammar and without what nft can additionally express. iptables -n- Performs no name resolution: addresses and ports stay numeric. Without it, the listing waits on DNS rule by rule.
iptables -v- Verbose listing, with each rule's packet and byte counters. They are what says which rule is actually seeing traffic.
iptables --version- Prints the version and, in parentheses, the backend in use:
nf_tablesorlegacy. The one quick way to know which of the two you are querying.
