iptables Cheatsheet

Firewall rules.

Overview

iptables is the Linux packet-filtering tool that backs most host-level firewalls. Five primitive surfaces cover almost every operational use: tables and chains for placement, match conditions for selection, targets for action, connection tracking for stateful rules, and iptables-save for persistence across reboots.

The approach

Five idioms carry most of the operational weight. Memorising them moves the team from cargo-culting rules to writing host firewalls that hold up under audit.

Why this compounds

Each rule captures policy in a reviewable artefact. The team’s network-security fluency deepens; standard rule sets become reusable templates; new hosts inherit the conventions instead of recreating them.