Use it when restricting outbound traffic, or when the host cannot reach something although the network is fine.
OUTPUT
local process sends → routing → output hook rules → postrouting → leaves the host
For Firewall → OUTPUT, continue with the first unproven Topic check: Identify the exact originating process/socket and namespace, destination family/tuple, selected source address and route/interface. If that boundary is healthy, advance to the adjacent check: Inspect all output-hook base chains, policy routing marks and NAT rules that can change route or tuple. 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
local process/socket → OUTPUT hook chains → marking/DNAT as applicable → route/reroute → POSTROUTING/SNAT → egress interface → remote service/response
Healthy evidence: the process generates the expected tuple, output rules permit/deny it as intended, capture shows correct egress translation and the application receives the expected result.
Step 2 Verification and output interpretation Verify boundary
Existing fast checks for this Topic. - Identify the exact originating process/socket and namespace, destination family/tuple, selected source address and route/interface.
- Inspect all output-hook base chains, policy routing marks and NAT rules that can change route or tuple.
- Correlate rule trace/counters with egress capture and conntrack while reproducing the original client transaction.
- Verify the remote response and local application result after the smallest policy change, plus a negative egress-policy regression case.
Verification chain. local process/socket → OUTPUT hook chains → marking/DNAT as applicable → route/reroute → POSTROUTING/SNAT → egress interface → remote service/response
Step 3 Commands Verify boundary
nft list chain inet filter output
Step 4 Failure modes and next checks Narrow the fault
Suspicious evidence: operators inspect INPUT/FORWARD for a local client flow, rule counters do not match the process traffic, marks reroute unexpectedly, or output ACCEPT is blamed for a remote-side failure.
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.
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
Pin the originating process/socket, namespace, effective source/destination tuple and route decision. Trace locally generated traffic through output-hook chains, possible DNAT/marking, rerouting and postrouting/SNAT, then verify egress capture and remote/application response.
ReferenceImportant terms & boundaries5 sections · depth on demand
What this shows and what it does not
OUTPUT is confirmed only when locally generated traffic is shown to receive the intended output verdict, leave through the expected route/translation and complete the original remote transaction.
In depth
OUTPUT: traffic created by the host
The OUTPUT chain sees packets generated by local processes, before they leave the host. The iptables(8) manual page lists OUTPUT in all five tables: filter, nat, mangle, raw and security. Its nat version can rewrite destinations of locally generated traffic. Most hosts leave OUTPUT open (policy ACCEPT), but restricting it is a strong control on servers whose outbound needs are well known.
Why filter outbound traffic
| Threat | Effect of an OUTPUT allow list |
|---|---|
| Malware calling home | Blocked unless the destination is allowed |
| Data exfiltration | Limited to approved destinations |
| A compromised web app scanning the internal network | Blocked |
| Misconfigured software talking to the Internet | Visible in the logs |
An outbound allow list
| Order | Rule |
|---|---|
| 1 | Accept established and related |
| 2 | Accept lo |
| 3 | DNS to the internal resolvers only (UDP and TCP 53) |
| 4 | NTP to the internal time servers |
| 5 | HTTP(S) to the package mirror or proxy |
| 6 | Syslog and metrics to the collectors |
| 7 | Application-specific destinations (database, APIs) |
| 8 | Log and reject everything else |
Use reject rather than drop for outbound traffic. Applications then fail at once with "connection refused" instead of waiting for timeouts, which makes problems much easier to diagnose.
Matching by owner
On the output hook, rules can match the UID or GID of the process that created a packet. For example, only the user reportapi may reach the partner API, and only _apt may reach the package mirrors.
host$ sudo nft add chain inet filter output '{ type filter hook output priority filter; policy accept; }'
host$ sudo nft add rule inet filter output ct state established,related accept
host$ sudo nft add rule inet filter output oif lo accept
host$ sudo nft add rule inet filter output ip daddr { 10.20.0.53, 10.20.0.54 } meta l4proto { tcp, udp } th dport 53 accept
host$ sudo nft add rule inet filter output meta skuid reportapi ip daddr 198.51.100.80 tcp dport 443 accept
host$ sudo nft add rule inet filter output tcp dport { 80, 443 } ip daddr 10.40.0.10 accept
host$ sudo nft add rule inet filter output log prefix '"nft-out-reject: "' limit rate 10/minute reject
host$ sudo journalctl -k -g nft-out-reject -n 3
nft-out-reject: IN= OUT=eth0 SRC=10.110.0.64 DST=203.0.113.99 PROTO=TCP SPT=48122 DPT=4444 UID=33 GID=33
Reading the log line
A process running as UID 33 (www-data on Debian) tried to connect to port 4444 on an outside address. That isn't something a web server needs. It's exactly the kind of event outbound filtering is meant to stop and reveal. The UID= field appears because the log statement runs on the output hook.
Documented example, not captured output.
How it works at runtime
OUTPUT is part of Firewall → OUTPUT. OUTPUT is the netfilter path for locally generated packets after a local process creates traffic and before final egress processing; it is distinct from forwarding and can evaluate locally known attributes, marks, destination state and post-routing/NAT behavior.
Topic-specific state model. OUTPUT is the netfilter path for locally generated packets after a local process creates traffic and before final egress processing; it is distinct from forwarding and can evaluate locally known attributes, marks, destination state and post-routing/NAT behavior.
Interpretation rule. - Remote inbound traffic ≠ OUTPUT traffic; server replies are locally generated and do traverse output paths, but the request itself does not.
- OUTPUT ACCEPT ≠ return path or remote firewall permits the packet.
- Process connect error ≠ firewall drop; DNS, route, listener or TLS/application failures can produce similar symptoms.
- Packet seen on loopback ≠ packet leaves the intended external interface after routing/NAT.
Quick reference
OUTPUT filtering controls what the host may initiate. Default accept is common; default drop is used on high-security servers:
chain output {
type filter hook output priority 0; policy drop;
ct state established,related accept
oif lo accept
udp dport 53 ip daddr { 10.0.0.53, 10.0.0.54 } accept
udp dport 123 accept
tcp dport { 80, 443 } ip daddr @update_mirrors accept
tcp dport 514 ip daddr 10.0.0.60 accept
}
Restricting egress limits malware callbacks and data exfiltration, but requires listing DNS, NTP, package mirrors, logging, monitoring, LDAP/Kerberos and backup destinations.
Limits and how it fails
Primary failure point. OUTPUT is confirmed only when locally generated traffic is shown to receive the intended output verdict, leave through the expected route/translation and complete the original remote transaction.
ReferenceConfiguration & state1 section · depth on demand
Configuration, persistence and lifecycle
Distribution/platform context. OUTPUT owns locally generated firewall policy. Linux Networking owns route/source selection; NAT owns translation; applications own client behavior and remote services own acceptance.
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 → OUTPUT. 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
OUTPUT operational reference
Topic-specific lookup boundaries, proof limits and next-step Evidence for OUTPUT.
| Lookup boundary | Topic-specific reference | Operational use |
|---|---|---|
| Scope / effective state | OUTPUT is the netfilter path for locally generated packets after a local process creates traffic and before final egress processing; it is distinct from forwarding and can evaluate locally known attributes, marks, destination state and post-routing/NAT behavior. | 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 | local process/socket → OUTPUT hook chains → marking/DNAT as applicable → route/reroute → POSTROUTING/SNAT → egress interface → remote service/response | Trace requested/configured state through effective state to the observed workload result. |
| Failure boundary | OUTPUT is proven only when locally generated traffic is shown to receive the intended output verdict, leave through the expected route/translation and complete the original remote transaction. | Stop broad troubleshooting at the first boundary that is not supported by evidence. |
| Positive evidence | Correlated Linux firewall evidence can establish this proof path: local process/socket → OUTPUT hook chains → marking/DNAT as applicable → route/reroute → POSTROUTING/SNAT → egress interface → remote service/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. OUTPUT is proven only when locally generated traffic is shown to receive the intended output verdict, leave through the expected route/translation and complete the original remote transaction. | 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. |
OUTPUT · operational reference
Compact Linux state, persistence, verification and boundary reference for fast lookup.
| Reference boundary | OUTPUT |
|---|---|
| Topic path | Firewall → OUTPUT |
| Runtime state | OUTPUT is the netfilter path for locally generated packets after a local process creates traffic and before final egress processing; it is distinct from forwarding and can evaluate locally known attributes, marks, destination state and post-routing/NAT behavior. |
| Fast checks | - Identify the exact originating process/socket and namespace, destination family/tuple, selected source address and route/interface. - Inspect all output-hook base chains, policy routing marks and NAT rules that can change route or tuple. - Correlate rule trace/counters with egress capture and conntrack while reproducing the original client transaction. - Verify the remote response and local application result after the smallest policy change, plus a negative egress-policy regression case. |
| Verification chain | local process/socket → OUTPUT hook chains → marking/DNAT as applicable → route/reroute → POSTROUTING/SNAT → egress interface → remote service/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 | OUTPUT is proven only when locally generated traffic is shown to receive the intended output verdict, leave through the expected route/translation and complete the original remote transaction. 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. |