Pcornel
Browse topics
Options
Recent
Favorites
Linux · Technical reference

FORWARD

Direct answer

The FORWARD chain filters packets routed through the host between interfaces — on routers, VPN gateways and container/VM hosts. Forwarding must also be enabled with net.ipv4.ip_forward=1.

When to use this

Use it when a Linux host routes traffic for others, or when containers or VMs cannot reach the network.

First 30 seconds

1. sysctl net.ipv4.ip_forward (and net.ipv6.conf.all.forwarding) — 1?

2. nft list chain inet filter forward / iptables -L FORWARD -n -v.

3. Return traffic allowed (established,related)?

4. NAT needed? See POSTROUTING masquerade.

5. Test from a client behind the host.

Operational verification

packet arrives for another host → ip_forward enabled → forward hook rules → routed out → postrouting (SNAT)

Evidence · next step

For Firewall → FORWARD, continue with the first unproven Topic check: Confirm the host is actually routing the flow, forwarding is enabled where required, and pin ingress/egress interfaces/namespaces plus pre/post-NAT tuple. If that boundary is healthy, advance to the adjacent check: Inspect forward-hook chains, stateful established/related handling, zone/policy bindings and default forward policy in both directions. 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
Platform / version applicability
linux
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

Platformlinux
Scope / prerequisiteUse it when a Linux host routes traffic for others, or when containers or VMs cannot reach the network.
What next?3 suggested next steps
Evidence1
On this pageJump to a specific section
Operational workflow

Verification & Troubleshooting

Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.

5 steps Observe → verify → isolate → change minimally → repeat the original test.
ObservedRecord what the original test actually shows

Capture the concrete output, symptom, packet, log or counter before changing anything.

Step 1 Operational evidence path Verify boundary

ingress → PREROUTING/DNAT → route chooses transit egress → FORWARD hook policy/state → POSTROUTING/SNAT → egress → return path → workload

Healthy evidence: transit packets traverse the intended interfaces and forward rule path, required NAT/state is coherent in both directions, and the original routed workload succeeds.

Step 2 Verification and output interpretation Verify boundary

Existing fast checks for this Topic. - Confirm the host is actually routing the flow, forwarding is enabled where required, and pin ingress/egress interfaces/namespaces plus pre/post-NAT tuple.

  • Inspect forward-hook chains, stateful established/related handling, zone/policy bindings and default forward policy in both directions.
  • Capture ingress and egress simultaneously and correlate conntrack/NAT plus rule counters while reproducing the original workload.
  • After the minimal fix, verify full bidirectional application behavior and regression flows between other zones/networks.

Verification chain. ingress → PREROUTING/DNAT → route chooses transit egress → FORWARD hook policy/state → POSTROUTING/SNAT → egress → return path → workload

Step 3 Commands Verify boundary
sysctl net.ipv4.ip_forward
nft list chain inet filter forward
Step 4 Failure modes and next checks Narrow the fault

Suspicious evidence: traffic is misclassified local versus forwarded, forwarding sysctl is off, default FORWARD policy drops despite NAT, container-generated chains intervene, or asymmetric return traffic breaks stateful acceptance.

Step 5 Common mistakes Narrow the fault
  • Forwarding enabled without forward rules.
Evidence references

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.

observation · 1
Key points

Docker and libvirt add their own FORWARD rules; a default-drop FORWARD policy from another tool can break them. Check sysctl net.ipv4.ip_forward first.

Key checks
  • nft list ruleset — all nftables rules
  • iptables -S; iptables -t nat -S — iptables rules (if used)
  • firewall-cmd --list-all — firewalld zone settings
  • ufw status verbose — UFW rules and defaults
  • ss -tulpn — which services listen
ReferenceWhat it is1 section · depth on demand

Core model

Show that routing classifies the packet as transit traffic, confirm IP forwarding and namespace/interface topology, then follow pre-routing/NAT, forward-hook chains, conntrack state and post-routing/NAT in both directions. Verify the return path because stateful policy and asymmetric routing can make one direction appear healthy.

ReferenceImportant terms & boundaries5 sections · depth on demand

What this shows and what it does not

FORWARD evidence requires confirmed transit classification, expected filtering verdict, required translation and bidirectional return behavior through the original application flow; forwarding enablement or ACCEPT alone is insufficient.

In depth

FORWARD: traffic routed through the host

The FORWARD chain filters packets that enter on one interface and leave on another without being addressed to the host. That's router, VPN gateway and container host traffic. The iptables(8) manual page places FORWARD in the filter, mangle and security tables. Forwarding only happens at all when the kernel has net.ipv4.ip_forward=1 (and net.ipv6.conf.all.forwarding=1 for IPv6).

Where FORWARD matters

Host roleFORWARD traffic
Router or firewall between networksEverything between the networks
VPN gateway (WireGuard, OpenVPN)Traffic between tunnel clients and the LAN
Docker, Podman or Kubernetes hostTraffic between containers, and from containers to the outside
KVM host with routed or NAT networksVM traffic
An ordinary serverShould be none (policy drop)

A forwarding policy for a VPN gateway

OrderRule
1Accept established and related
2Drop invalid
3VPN clients (wg0) to the internal networks, specific services only
4Internal admin network to the VPN clients (if needed)
5Log and drop the rest
PolicyDROP

Common surprises

SymptomCause
Containers lose network access after a firewall reloadThe tool flushed the rules the container runtime had added
Traffic forwards although the policy is DROPAnother table or tool accepts it at the same hook
Forwarding doesn't work at allip_forward is 0, or rp_filter drops asymmetric traffic
Replies never arriveMissing NAT or missing return routes on the other side
host$ sysctl net.ipv4.ip_forward
net.ipv4.ip_forward = 1
host$ sudo nft add rule inet filter forward ct state established,related accept
host$ sudo nft add rule inet filter forward iifname wg0 oifname eth1 ip daddr 10.30.0.0/24 tcp dport { 22, 443, 5432 } accept
host$ sudo nft add rule inet filter forward counter log prefix '"nft-fwd-drop: "' limit rate 5/minute
host$ sudo nft list chain inet filter forward
host$ sudo nft list ruleset | grep -B2 "hook forward"
host$ sudo tcpdump -ni eth1 host 10.99.1.20 and port 5432 -c 4

Every forward chain counts

The last nft command shows every base chain on the forward hook, from all tables. A packet must be accepted by all of them. Any one of them can drop it, for example a chain added by Docker or by firewalld. That's why a correct-looking rule in one table can still fail.

Documented example, not captured output.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.

How it works at runtime

FORWARD is part of Firewall → FORWARD. FORWARD is the netfilter path for packets routed through the Linux host between interfaces or namespaces rather than delivered to or generated by a local socket, and it commonly intersects IP forwarding, bridges/routers, containers, VPNs and NAT gateways.

Topic-specific state model. FORWARD is the netfilter path for packets routed through the Linux host between interfaces or namespaces rather than delivered to or generated by a local socket, and it commonly intersects IP forwarding, bridges/routers, containers, VPNs and NAT gateways.

Interpretation rule. - IP forwarding enabled ≠ FORWARD policy permits the flow.

  • FORWARD ACCEPT ≠ NAT is configured when address translation is required.
  • DNAT/SNAT configured ≠ forwarding is permitted; NAT and filtering are separate.
  • One-way packet capture ≠ bidirectional session health; return routing/state/policy must also work.

Quick reference

FORWARD handles traffic routed through the host (routers, VPN gateways, container/VM hosts).

sysctl -w net.ipv4.ip_forward=1; echo 'net.ipv4.ip_forward=1' > /etc/sysctl.d/90-forward.conf
nft add rule inet filter forward iifname "wg0" oifname "eth0" ip saddr 10.8.0.0/24 accept
nft add rule inet filter forward ct state established,related accept

Docker sets FORWARD policy to DROP and adds its own chains; libvirt and Kubernetes CNIs add rules too — check nft list ruleset for chains you did not create before changing defaults.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.

Limits and how it fails

Primary failure point. FORWARD evidence requires confirmed transit classification, expected filtering verdict, required translation and bidirectional return behavior through the original application flow; forwarding enablement or ACCEPT alone is insufficient.

ReferenceConfiguration & state1 section · depth on demand

Configuration, persistence and lifecycle

Distribution/platform context. FORWARD owns transit firewall filtering. Linux Networking owns routing/forwarding topology; NAT owns translation; container/VPN platforms may create additional namespaces/chains; applications own end-to-end protocol outcome.

Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Technical verification history

Verification history & basis

When and against what this Topic was checked. Later text edits do not count as a new check.

2026-09-14 · vendor doclinux current

Authoritative/upstream documentation reviewed for bounded claims in Firewall → FORWARD. Documentation verification only; this is not observed lab or production Evidence.

Basis: https://wiki.nftables.org/wiki-nftables/index.php/Main_Page · confidence 94%
Technical changelog & impact

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.

Related reference impactReview these references after material technical changes when their shared boundary is affected.
Terminology layer

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.

Aliases that resolve here
iptables forward chainnft forward hooklinux routing firewallforwarded traffic firewall
Embedded reference data

Quick lookup tables

FORWARD operational reference

Topic-specific lookup boundaries, proof limits and next-step Evidence for FORWARD.

Lookup boundaryTopic-specific referenceOperational use
Scope / effective stateFORWARD is the netfilter path for packets routed through the Linux host between interfaces or namespaces rather than delivered to or generated by a local socket, and it commonly intersects IP forwarding, bridges/routers, containers, VPNs and NAT gateways.Establish exactly what this Topic owns before crossing into another subsystem.
Fast verificationPin 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 chainingress → PREROUTING/DNAT → route chooses transit egress → FORWARD hook policy/state → POSTROUTING/SNAT → egress → return path → workloadTrace requested/configured state through effective state to the observed workload result.
Failure boundaryFORWARD proof requires confirmed transit classification, expected filtering verdict, required translation and bidirectional return behavior through the original application flow; forwarding enablement or ACCEPT alone is insufficient.Stop broad troubleshooting at the first boundary that is not supported by evidence.
Positive evidenceCorrelated Linux firewall evidence can establish this proof path: ingress → PREROUTING/DNAT → route chooses transit egress → FORWARD hook policy/state → POSTROUTING/SNAT → egress → return path → workloadUse this observation only for the specific claim it actually supports.
Evidence limitIt 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. FORWARD proof requires confirmed transit classification, expected filtering verdict, required translation and bidirectional return behavior through the original application flow; forwarding enablement or ACCEPT alone is insufficient.Do not promote a local success signal into end-to-end or adjacent-dependency proof.
Next troubleshooting checkContinue 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.

FORWARD · operational reference

Compact Linux state, persistence, verification and boundary reference for fast lookup.

Reference boundaryFORWARD
Topic pathFirewall → FORWARD
Runtime stateFORWARD is the netfilter path for packets routed through the Linux host between interfaces or namespaces rather than delivered to or generated by a local socket, and it commonly intersects IP forwarding, bridges/routers, containers, VPNs and NAT gateways.
Fast checks- Confirm the host is actually routing the flow, forwarding is enabled where required, and pin ingress/egress interfaces/namespaces plus pre/post-NAT tuple. - Inspect forward-hook chains, stateful established/related handling, zone/policy bindings and default forward policy in both directions. - Capture ingress and egress simultaneously and correlate conntrack/NAT plus rule counters while reproducing the original workload. - After the minimal fix, verify full bidirectional application behavior and regression flows between other zones/networks.
Verification chainingress → PREROUTING/DNAT → route chooses transit egress → FORWARD hook policy/state → POSTROUTING/SNAT → egress → return path → 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 boundaryFORWARD proof requires confirmed transit classification, expected filtering verdict, required translation and bidirectional return behavior through the original application flow; forwarding enablement or ACCEPT alone is insufficient. Boundary chain: process/context → userspace configuration → kernel subsystem/resource → device/network/filesystem dependency → effective state → original workload.
Persistence ruleProve which configuration source owns the state, then prove that the running consumer loaded or generated the intended state.
Confirmation

Confirm action

Continue?