Pcornel
Security · Linux Security

iptables

Cheat sheet · https://pcornel.dk/topic.php?topic=4570

Back to the Topic

Answer

iptables is the legacy Netfilter userspace rule model for filter, NAT and related tables/chains; modern systems may implement its interface through an nftables compatibility backend, making backend and live-rule ownership critical.

Remember

  • iptables command output ≠ legacy kernel backend necessarily in use.
  • Rule saved ≠ rule loaded after boot or manager reload.
  • Configuration file present ≠ parsed, loaded and effective runtime state.
  • One allow/deny result ≠ complete DAC, privilege, LSM, firewall and application outcome.

First checks

  • iptables -L -n -v --line-numbers — filter rules
  • iptables -t nat -L -n -v — NAT rules
  • iptables-save > rules.v4 — save

Commands

iptables

Verify in this order

packet → chain rules → target

Where it usually breaks

First mismatch in platform/workload identity → desired configuration → management/control plane → runtime enforcement → telemetry → workload/resource outcome; preserve identity/policy/pre-state before mutation.

Linux Security → iptables proof map

BoundaryEstablishDoes not establish
ScopeExact host, role, build/kernel, identity, workload and expected controlDoes not prove policy receipt or effective runtime state
Effective stateResultant/loaded policy, precedence, mode, labels/rules/keys and active services/kernel controlsConfiguration presence does not prove enforcement
Runtime evidenceCorrelated events/audit, process/token/credential, packet/syscall and workload resultOne event, clean status or allow/deny does not prove complete security
ClosureOriginal allowed/denied workload works, unsafe state is removed and recovery/regression passCommit, restart, block or compliance result alone is not closure

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=4570

Confirmation

Confirm action

Continue?