Use it to understand where in the packet path a rule must go and why a rule does or does not match.
Netfilter
Netfilter is the kernel framework behind Linux firewalls and NAT. Packets pass hooks — prerouting, input, forward, output, postrouting — where tables and chains of rules act on them; conntrack tracks connection state.
1. Is the packet for the host (input), routed (forward) or local (output)?
2. Rules in that hook: nft list ruleset.
3. State rule present (ct state established,related accept)?
4. conntrack -L | grep <ip> — connection tracked?
5. Trace a packet: nft monitor trace with a trace rule.
prerouting (DNAT) → routing decision → input or forward → output → postrouting (SNAT)
For Firewall → Netfilter, continue with the first unproven Topic check: Classify the flow as inbound-local, outbound-local, forwarded or locally generated to a local address and map its expected hook sequence. If that boundary is healthy, advance to the adjacent check: Read base chains and hook priorities across all active families/tables, not only a familiar chain name. Preserve the same host/time/identity scope and rerun the original workload before accepting recovery.
Continue only after interpreting the current observation.Context & applicabilityCommon mistakes · platform/version boundaries
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 Operational evidence path Verify boundary
packet origin → namespace → PREROUTING/OUTPUT as applicable → route decision → INPUT or FORWARD → POSTROUTING as applicable → socket/egress → workload
Healthy evidence: the observed packet follows the expected hook sequence, matching rules and conntrack/NAT state are coherent, and the packet reaches the intended next boundary.
Step 2 Verification and output interpretation Verify boundary
Follow routing/namespace placement into the expected Netfilter hook, watch the matching rule/chain counter, inspect conntrack/NAT state when applicable, and verify reply traffic.
Existing fast checks for this Topic. - Classify the flow as inbound-local, outbound-local, forwarded or locally generated to a local address and map its expected hook sequence.
- Read base chains and hook priorities across all active families/tables, not only a familiar chain name.
- Inspect conntrack/NAT state and captures before and after route/translation boundaries when packet identity changes.
- Verify the final local socket or egress packet and repeat the original workload after any policy change.
Verification chain. packet origin → namespace → PREROUTING/OUTPUT as applicable → route decision → INPUT or FORWARD → POSTROUTING as applicable → socket/egress → workload
Step 3 Commands Verify boundary
nft list ruleset
cat /proc/net/nf_conntrack | head
conntrack -L | head
Step 4 Failure modes and next checks Narrow the fault
Suspicious evidence: operators inspect the wrong hook path, ignore earlier-priority chains, confuse bridge/local/routed traffic, or interpret frontend output without proving the kernel path for the actual packet.
Step 5 Common mistakes Narrow the fault
- Forgetting that conntrack state allows replies.
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.
conntrack -L— tracked connectionsnft 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
ReferenceWhat it is1 section · depth on demand
Core model
Reason from packet origin and routing decision to the relevant hook sequence rather than from a tool name. Preserve namespace and family, identify whether the packet is local, forwarded or locally generated, then correlate hook priority, conntrack state, NAT transformation and the userspace frontend that programmed the kernel rules.
ReferenceImportant terms & boundaries5 sections · depth on demand
What this shows and what it does not
Netfilter is confirmed only when the actual packet path and hook order for the original flow are established and the effective verdict/translation at each relevant boundary agrees with capture and workload behavior.
In depth
Netfilter hooks, priorities and the packet path
Netfilter is the packet filtering framework inside the Linux kernel. Firewall tools register chains at its hooks, and the hooks decide when a chain sees a packet. The nftables wiki describes the hooks and the priority values:
| Priority keyword | Value | Typical use |
|---|---|---|
| raw | −300 | Exempt traffic from connection tracking |
| (conntrack) | −200 | Connection tracking itself |
| mangle | −150 | Change packet fields or marks |
| dstnat | −100 | Destination NAT (prerouting) |
| filter | 0 | Normal filtering |
| security | 50 | SELinux packet labelling |
| srcnat | 100 | Source NAT (postrouting) |
Chains at the same hook run in increasing priority order. NAT chains must have a priority above −200, so that connection tracking runs first.
Packet paths (wiki)
| Traffic | Hooks passed |
|---|---|
| To a local process | prerouting → (routing decision) → input |
| Through the host (routed) | prerouting → forward → postrouting |
| From a local process | output → (routing decision) → postrouting |
| Before anything else, per interface | ingress (netdev family) |
Connection tracking
Connection tracking follows every flow and gives each packet a state. The state is what makes simple stateful rules possible: allow established and related traffic, filter only new connections.
| State | Meaning |
|---|---|
| new | The first packet of a flow |
| established | Part of a flow already seen in both directions |
| related | A related flow (e.g. an ICMP error, an FTP data connection) |
| invalid | Doesn't match a known flow |
| untracked | Exempted in the raw priority |
Inspecting connection tracking
host$ sudo conntrack -L -p tcp --dport 443 | head -3
tcp 6 431999 ESTABLISHED src=203.0.113.50 dst=10.110.0.64 sport=51822 dport=443 ... [ASSURED] mark=0 use=1
host$ sudo conntrack -C
18211
host$ sysctl net.netfilter.nf_conntrack_max
net.netfilter.nf_conntrack_max = 262144
host$ dmesg | grep -i "nf_conntrack: table full"
host$ sudo nft list hooks ip | head -12
host$ sudo nft monitor trace
When the conntrack table fills
If the number of tracked flows reaches nf_conntrack_max, the kernel drops new connections and logs "table full, dropping packet". Busy load balancers and DNS servers can hit this. Raising the limit, or exempting high-volume stateless traffic in the raw priority, fixes it. nft list hooks shows every chain registered at each hook, from every tool.
Documented example, not captured output.
How it works at runtime
Netfilter is part of Firewall → Netfilter. Netfilter is the Linux kernel packet-processing framework that exposes hook points such as PREROUTING, INPUT, FORWARD, OUTPUT and POSTROUTING and provides the underlying filtering, connection-tracking and NAT machinery used by nftables and iptables frontends.
Runtime state ownership and mechanics. Linux packet filtering is implemented by Netfilter hooks across ingress, local input/output, forwarding and postrouting paths. nftables, iptables compatibility layers, firewalld and UFW are policy/configuration interfaces that can program overlapping kernel rulesets.
Topic-specific state model. Netfilter is the Linux kernel packet-processing framework that exposes hook points such as PREROUTING, INPUT, FORWARD, OUTPUT and POSTROUTING and provides the underlying filtering, connection-tracking and NAT machinery used by nftables and iptables frontends.
Interpretation rule. - Netfilter ≠ nftables or iptables; those are userspace rule interfaces to kernel netfilter facilities.
- A packet seen on an interface ≠ it traverses every netfilter hook; local, forwarded and bridged paths differ.
- Conntrack state ESTABLISHED ≠ application health; it only describes tracked flow state.
- NAT translation ≠ filtering permission; translation and accept/drop verdicts are separate policy boundaries.
Quick reference
Netfilter hooks where packets can be filtered or changed:
| Hook | Packets |
|---|---|
| prerouting | All incoming, before routing (DNAT) |
| input | Destined for this host |
| forward | Routed through the host |
| output | Generated by this host |
| postrouting | All outgoing, after routing (SNAT/masquerade) |
Connection tracking (conntrack) gives stateful filtering: ct state established,related accept early in input/forward chains.
conntrack -L | head; conntrack -S
sysctl net.netfilter.nf_conntrack_max net.netfilter.nf_conntrack_count
A full conntrack table ("nf_conntrack: table full, dropping packet") drops new connections on busy gateways — raise nf_conntrack_max or exempt traffic with notrack.
Limits and how it fails
Primary failure point. Netfilter is confirmed only when the actual packet path and hook order for the original flow are established and the effective verdict/translation at each relevant boundary agrees with capture and workload behavior.
ReferenceConfiguration & state1 section · depth on demand
Configuration, persistence and lifecycle
Distribution/platform context. Netfilter owns kernel hook and packet-processing semantics. nftables/iptables own rule-expression interfaces; conntrack/NAT features own tracked state and translation; Linux Networking owns route/link delivery.
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 Firewall → Netfilter. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://wiki.nftables.org/wiki-nftables/index.php/Main_Page · confidence 94%Authoritative Linux project/vendor documentation reviewed for bounded reference claims: kernel packet-filtering/NAT hooks and ownership boundaries. Documentation-based technical verification only; not lab or production-runtime proof. The schema vendor_doc method is used for authoritative project/vendor documentation; deployment applicability remains separate evidence.
Basis: https://www.netfilter.org/documentation/ · confidence 93%What changed and what may be affected
Recent technical edits are separated from ordinary page timestamps. Relationship impact is advisory: it identifies nearby canonical references to review, not automatic breakage.
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
Netfilter operational reference
Topic-specific lookup boundaries, proof limits and next-step Evidence for Netfilter.
| Lookup boundary | Topic-specific reference | Operational use |
|---|---|---|
| Scope / effective state | Netfilter is the Linux kernel packet-processing framework that exposes hook points such as PREROUTING, INPUT, FORWARD, OUTPUT and POSTROUTING and provides the underlying filtering, connection-tracking and NAT machinery used by nftables and iptables frontends. | Establish exactly what this Topic owns before crossing into another subsystem. |
| Fast verification | Pin exact namespace + five-tuple + interfaces/direction → prove route/listener prerequisites → identify manager/backend → snapshot full ruleset + hook priorities/default policies → reproduce with counters/trace + packet capture → correlate conntrack/NAT → change one demonstrated cause → read back effective state → repeat original workload + negative regression flow. | Use the shortest evidence path first; a fast check is a boundary test, not blanket proof. |
| Verification chain | packet origin → namespace → PREROUTING/OUTPUT as applicable → route decision → INPUT or FORWARD → POSTROUTING as applicable → socket/egress → workload | Trace requested/configured state through effective state to the observed workload result. |
| Failure boundary | Netfilter is proven only when the actual packet path and hook order for the original flow are established and the effective verdict/translation at each relevant boundary agrees with capture and workload behavior. | Stop broad troubleshooting at the first boundary that is not supported by evidence. |
| Positive evidence | Correlated Linux firewall evidence can establish this proof path: packet origin → namespace → PREROUTING/OUTPUT as applicable → route decision → INPUT or FORWARD → POSTROUTING as applicable → socket/egress → workload | Use this observation only for the specific claim it actually supports. |
| Evidence limit | It does not independently prove behavior outside the captured namespace, family, five-tuple, interface/direction, manager/backend, ruleset generation, conntrack/NAT state, time window or application scope. Netfilter is proven only when the actual packet path and hook order for the original flow are established and the effective verdict/translation at each relevant boundary agrees with capture and workload behavior. | Do not promote a local success signal into end-to-end or adjacent-dependency proof. |
| Next troubleshooting check | Continue from the first unproven firewall boundary: preserve the current ruleset/state, capture the exact packet path and rule verdict, change only the demonstrated cause through the authoritative manager, read back effective policy, then repeat the original workload and regression flows. | Continue to the next unresolved boundary while preserving the original test condition. |
Netfilter · operational reference
Compact Linux state, persistence, verification and boundary reference for fast lookup.
| Reference boundary | Netfilter |
|---|---|
| Topic path | Firewall → Netfilter |
| Runtime state | Netfilter is the Linux kernel packet-processing framework that exposes hook points such as PREROUTING, INPUT, FORWARD, OUTPUT and POSTROUTING and provides the underlying filtering, connection-tracking and NAT machinery used by nftables and iptables frontends. |
| Fast checks | - Classify the flow as inbound-local, outbound-local, forwarded or locally generated to a local address and map its expected hook sequence. - Read base chains and hook priorities across all active families/tables, not only a familiar chain name. - Inspect conntrack/NAT state and captures before and after route/translation boundaries when packet identity changes. - Verify the final local socket or egress packet and repeat the original workload after any policy change. |
| Verification chain | packet origin → namespace → PREROUTING/OUTPUT as applicable → route decision → INPUT or FORWARD → POSTROUTING as applicable → socket/egress → workload Boundary chain: local authoritative state → adjacent dependency → effective/programmed state → original workload/request → return/regression → explicit Evidence boundary. Boundary chain: local authoritative state → adjacent dependency → effective/programmed state → original workload/request → return path or regression → explicit Evidence boundary. |
| Failure boundary | Netfilter is proven only when the actual packet path and hook order for the original flow are established and the effective verdict/translation at each relevant boundary agrees with capture and workload behavior. Boundary chain: process/context → userspace configuration → kernel subsystem/resource → device/network/filesystem dependency → effective state → original workload. |
| Persistence rule | Prove which configuration source owns the state, then prove that the running consumer loaded or generated the intended state. |