Use it when a local service is unreachable from other hosts, or to restrict who can reach it.
INPUT
The INPUT chain (or the input hook in nftables) filters packets addressed to the host itself — SSH, web servers and other local services.
1. ss -ltnp | grep :<port> — listening on 0.0.0.0/:: or only 127.0.0.1?
2. nft list chain inet filter input (or iptables -L INPUT -n -v).
3. Allow rule before the drop? Counters increasing?
4. Test: nc -vz <host> <port> from outside.
5. Persist the rule.
packet for a local address → input hook → rules in order → accept → local socket
For Firewall → INPUT, continue with the first unproven Topic check: Confirm the destination is local in the relevant namespace and record pre/post-NAT tuple, ingress interface and address family. If that boundary is healthy, advance to the adjacent check: Inspect all base chains hooked to input plus their priorities/default policies and stateful exceptions for the original flow. 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
ingress frame → PREROUTING/NAT as applicable → route says local → INPUT hook chains → verdict → local socket lookup → application response
Healthy evidence: the remote packet reaches the host, routing classifies it local, input-hook rules produce the intended verdict and the local socket/application responds as designed.
Step 2 Verification and output interpretation Verify boundary
Existing fast checks for this Topic. - Confirm the destination is local in the relevant namespace and record pre/post-NAT tuple, ingress interface and address family.
- Inspect all base chains hooked to input plus their priorities/default policies and stateful exceptions for the original flow.
- Capture ingress and inspect counters/trace while checking the intended local socket/listener separately.
- After a minimal rule change, repeat remote original traffic and verify an expected denied flow remains denied.
Verification chain. ingress frame → PREROUTING/NAT as applicable → route says local → INPUT hook chains → verdict → local socket lookup → application response
Step 3 Commands Verify boundary
nft list chain inet filter input
iptables -L INPUT -n -v
Step 4 Failure modes and next checks Narrow the fault
Suspicious evidence: the flow is actually forwarded, DNAT changes the tuple unexpectedly, an earlier input chain drops it, counters remain zero, or firewall ACCEPT is mistaken for a healthy listener.
Step 5 Common mistakes Narrow the fault
- Default accept policy on servers.
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.
A typical policy: accept loopback, accept established/related, allow specific services, drop the rest. Check that the service listens on the right address (ss -ltnp) before blaming the firewall.
nft 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
Show destination ownership and route type first, then follow the inbound packet through PREROUTING as applicable, routing, INPUT base chains and the target local socket. Preserve post-DNAT destination identity where NAT changes the tuple before INPUT.
ReferenceImportant terms & boundaries5 sections · depth on demand
What this shows and what it does not
INPUT evidence requires that the packet is actually routed to local delivery, receives the expected input-hook verdict and reaches the intended socket/application; ACCEPT alone does not show a listener or protocol success.
In depth
INPUT: traffic addressed to the host itself
The INPUT chain filters packets whose destination is the host: SSH, web servers, databases, monitoring agents. In iptables terms, the iptables(8) manual page places INPUT in the filter table, and also in the nat, mangle and security tables. Rules are evaluated in order and the first match wins. A policy (ACCEPT or DROP) applies to packets that match no rule. In nftables, the same role is a base chain on the input hook.
A sound INPUT policy, in order
| Order | Rule | Reason |
|---|---|---|
| 1 | Accept established and related | Replies and ongoing sessions; most traffic |
| 2 | Drop invalid | Malformed or out-of-state packets |
| 3 | Accept the loopback interface | Local services talk over lo |
| 4 | Accept the necessary ICMP and ICMPv6 | PMTU, neighbour discovery, ping |
| 5 | Accept the specific services, from specific sources | SSH from management, web from anywhere |
| 6 | Log (rate-limited) | Visibility |
| Policy | DROP | Everything else |
Typical exposure review
| Question | Command |
|---|---|
| What's listening? | ss -tulnp |
| Bound to all addresses or only to localhost? | Look for 0.0.0.0, [::] and 127.0.0.1 |
| Which of those does the firewall allow? | nft list chain inet filter input |
| What's actually reachable from outside? | nmap -Pn -p- <host> from another network |
Defence in depth
The firewall is the second line of defence. The first is that services bind only where they're needed: a database listening on 127.0.0.1 or an internal address can't be reached from the Internet, even if a firewall rule is wrong.
host$ sudo ss -tulnp | awk 'NR==1 || /LISTEN|UNCONN/ {print $1, $5, $7}' | column -t
Netid Local Process
tcp 0.0.0.0:22 users:(("sshd",pid=842,fd=3))
tcp 127.0.0.1:5432 users:(("postgres",pid=1311,fd=6))
tcp 0.0.0.0:443 users:(("nginx",pid=1203,fd=8))
tcp 0.0.0.0:9100 users:(("node_exporter",pid=990,fd=3))
host$ sudo nft add rule inet filter input ip saddr 10.99.0.0/24 tcp dport 9100 accept
host$ sudo nft list chain inet filter input | grep -E "policy|dport"
host$ nmap -Pn -p 22,443,5432,9100 srv1.example.net
22/tcp filtered ssh
443/tcp open https
5432/tcp closed postgresql
9100/tcp filtered jetdirect
Reading the nmap result
From outside, 443 is open and 22 and 9100 are filtered (dropped by the firewall). 5432 shows "closed", because postgres only listens on localhost and the host answers with a reset. The port isn't reachable either way, but the difference shows which layer protects it.
Documented example, not captured output.
How it works at runtime
INPUT is part of Firewall → INPUT. INPUT is the netfilter path for packets that have completed an ingress routing decision and are destined for a local address/socket on the Linux host; it is not the chain for transit forwarding or ordinary locally generated output.
Topic-specific state model. INPUT is the netfilter path for packets that have completed an ingress routing decision and are destined for a local address/socket on the Linux host; it is not the chain for transit forwarding or ordinary locally generated output.
Interpretation rule. - Packet enters an interface ≠ it will traverse INPUT; forwarded traffic uses FORWARD after routing.
- INPUT ACCEPT ≠ a process is listening on the destination address/port.
- Local service reachable from localhost ≠ remote INPUT policy permits ingress on the external interface.
- DNAT may change destination before INPUT ≠ original wire tuple is the tuple every later rule sees.
Quick reference
INPUT chain policy for a typical server (nftables):
table inet filter {
chain input {
type filter hook input priority 0; policy drop;
ct state established,related accept
ct state invalid drop
iif lo accept
meta l4proto { icmp, ipv6-icmp } accept
ip saddr 10.0.0.0/8 tcp dport 22 accept
tcp dport { 80, 443 } accept
counter log prefix "in-drop: " limit rate 5/minute drop
}
}
Documented example, not captured output. Allow ICMPv6 (neighbour discovery breaks IPv6 otherwise) and ICMP fragmentation-needed (PMTU discovery).
Limits and how it fails
Primary failure point. INPUT evidence requires that the packet is actually routed to local delivery, receives the expected input-hook verdict and reaches the intended socket/application; ACCEPT alone does not show a listener or protocol success.
ReferenceConfiguration & state1 section · depth on demand
Configuration, persistence and lifecycle
Distribution/platform context. INPUT owns inbound-local firewall semantics. Routing determines local versus forwarded classification; NAT can alter the tuple; systemd/application services own listener readiness.
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 → INPUT. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://wiki.nftables.org/wiki-nftables/index.php/Main_Page · confidence 94%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
INPUT operational reference
Topic-specific lookup boundaries, proof limits and next-step Evidence for INPUT.
| Lookup boundary | Topic-specific reference | Operational use |
|---|---|---|
| Scope / effective state | INPUT is the netfilter path for packets that have completed an ingress routing decision and are destined for a local address/socket on the Linux host; it is not the chain for transit forwarding or ordinary locally generated output. | 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 | ingress frame → PREROUTING/NAT as applicable → route says local → INPUT hook chains → verdict → local socket lookup → application response | Trace requested/configured state through effective state to the observed workload result. |
| Failure boundary | INPUT proof requires that the packet is actually routed to local delivery, receives the expected input-hook verdict and reaches the intended socket/application; ACCEPT alone does not prove a listener or protocol success. | Stop broad troubleshooting at the first boundary that is not supported by evidence. |
| Positive evidence | Correlated Linux firewall evidence can establish this proof path: ingress frame → PREROUTING/NAT as applicable → route says local → INPUT hook chains → verdict → local socket lookup → application response | 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. INPUT proof requires that the packet is actually routed to local delivery, receives the expected input-hook verdict and reaches the intended socket/application; ACCEPT alone does not prove a listener or protocol success. | 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. |
INPUT · operational reference
Compact Linux state, persistence, verification and boundary reference for fast lookup.
| Reference boundary | INPUT |
|---|---|
| Topic path | Firewall → INPUT |
| Runtime state | INPUT is the netfilter path for packets that have completed an ingress routing decision and are destined for a local address/socket on the Linux host; it is not the chain for transit forwarding or ordinary locally generated output. |
| Fast checks | - Confirm the destination is local in the relevant namespace and record pre/post-NAT tuple, ingress interface and address family. - Inspect all base chains hooked to input plus their priorities/default policies and stateful exceptions for the original flow. - Capture ingress and inspect counters/trace while checking the intended local socket/listener separately. - After a minimal rule change, repeat remote original traffic and verify an expected denied flow remains denied. |
| Verification chain | ingress frame → PREROUTING/NAT as applicable → route says local → INPUT hook chains → verdict → local socket lookup → application response 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 | INPUT proof requires that the packet is actually routed to local delivery, receives the expected input-hook verdict and reaches the intended socket/application; ACCEPT alone does not prove a listener or protocol success. 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. |