Use it when configuring, checking or troubleshooting iptables in Linux Security.
iptables
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.
1. iptables is the legacy firewall interface (often iptables-nft backend now).
2. Default policies and rule order.
3. Persist with iptables-persistent/netfilter-persistent.
4. Don't mix with nft rules carelessly.
5. Migrate to nftables.
packet → chain rules → target
Context & applicabilityCommon mistakes · platform/version boundaries
An iptables rule/counter shows the selected frontend exposed or matched live Netfilter state, but it does not show backend ownership, persistence or end-to-end delivery.
Suspicious evidence: legacy/nft frontend mixed, duplicate rulesets, wrong namespace, default policy, persistence absent, firewalld/UFW overwrite, IPv6 separate or NAT/filter tuple confusion.
Operational reference
Fast context before you go deeper.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Verification path Verify boundary
packet/namespace → Netfilter hook/table → built-in/user chains → ordered matches/targets → conntrack/NAT/verdict → endpoint → persistence reload
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
- 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.
iptables -L -n -v --line-numbers— filter rulesiptables -t nat -L -n -v— NAT rulesiptables-save > rules.v4— save
ReferenceImportant terms & boundaries2 sections · depth on demand
What this shows and what it does not
An iptables rule/counter shows the selected frontend exposed or matched live Netfilter state, but it does not show backend ownership, persistence or end-to-end delivery.
In depth
iptables is the classic Linux packet filtering tool. On modern distributions the iptables command usually runs as iptables-nft, translating rules into nftables, but the syntax and many scripts remain in use.
iptables -P INPUT DROP
iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -i lo -j ACCEPT
iptables -A INPUT -s 10.0.10.0/24 -p tcp --dport 22 -j ACCEPT
iptables -A INPUT -p tcp -m multiport --dports 80,443 -j ACCEPT
iptables -L -n -v --line-numbers
iptables-save > /etc/iptables/rules.v4
Remember IPv6 needs separate ip6tables rules — a common gap. For new systems, prefer nftables or firewalld; avoid mixing management tools on the same host.
ReferenceConfiguration & state1 section · depth on demand
Commands
iptables -L -n -v --line-numbers
iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -p tcp --dport 22 -s 10.99.0.0/24 -j ACCEPT
iptables -P INPUT DROP
iptables-save > /etc/iptables/rules.v4
Documented example, not captured output. Remember ip6tables for IPv6. On modern distributions iptables is often iptables-nft (translated to nftables); do not mix legacy and nft backends.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in Linux Security → iptables. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://docs.kernel.org/security/ · confidence 94%Terms & aliases
Hover a linked term for a quick definition; click it to open its glossary entry. Aliases are other names that find this Topic in search.
Quick lookup tables
Linux Security → iptables proof map
Fast scope, effective-state, runtime-evidence and closure boundaries for Linux Security → iptables.
| Boundary | Establish | Does not establish |
|---|---|---|
| Scope | Exact host, role, build/kernel, identity, workload and expected control | Does not prove policy receipt or effective runtime state |
| Effective state | Resultant/loaded policy, precedence, mode, labels/rules/keys and active services/kernel controls | Configuration presence does not prove enforcement |
| Runtime evidence | Correlated events/audit, process/token/credential, packet/syscall and workload result | One event, clean status or allow/deny does not prove complete security |
| Closure | Original allowed/denied workload works, unsafe state is removed and recovery/regression pass | Commit, restart, block or compliance result alone is not closure |