Skip to content
WebsiteHosting.com

concept Security & reliability

nftables hooks, priorities and multiple chains

Follow a packet through two nftables base chains at one hook. Changing a priority can change which verdicts the packet reaches, even when the result is still a drop.

Latest recorded source check · P0112

What it means

An nftables accept verdict ends evaluation in the current base chain; it does not guarantee that the packet will pass the firewall. A hook is a point in packet processing where a base chain can run. If several base chains apply to the packet at the same hook, the one with the smaller numerical priority runs first when their priorities differ. A later chain can still drop the packet.

Try it

Simulation — follow one synthetic IPv4 packet through two filter base chains, A and B, at the same hook. Both belong to the inet family, so both apply. A has priority 0 and accepts; B has priority 10 and drops. The starting trace is A:accept → B:drop. The result is a drop at the first hook. The later hook is set to accept, but the packet never reaches it.

nftables hooks, priorities and multiple chains

Explain how hook family, priority and chain placement change packet processing

Simulation
Modeled outcome: Drop

A drop at an applicable chain or later hook ends this modeled path.

nftables hooks, priorities and multiple chains: synthetic scenario inputs
Replaces all inputs with the documented starting example and the indicated change. Reset restores the starting example.
Ordered hooks and verdicts

First hook

  1. Chain A · priority 0accept
  2. Chain B · priority 10drop

Later hook

  1. Later verdictNot reached
  2. ResultDrop at first hook

Lower numerical priority runs earlier within the first hook. An accept there does not eliminate later chains.

Evaluated inputs

Required scenario evidence
provided
Chain A family
inet
A priority
0 priority
Chain B family
inet
B priority
10 priority
A verdict
accept
B verdict
drop

Not evaluated: Packet family · Later hook verdict

Two fixed filter base chains on one hook and one later abstract hook. No rule commands, NAT, actual filtering, hook-specific routing, jump/return or equal-priority tie resolution; earlier accepted path does not prove delivery.

About this model

The controls set only a local, bounded scenario. The computed branch is not a verdict about a live system. Inputs listed as not evaluated did not participate in this branch after validation.

Reset restores the original inputs. It does not change the open or closed state of help or FAQ answers.

Change only B priority from 10 to -10. The result is still a drop at the first hook, but now the entire trace is B:drop. A still has accept selected. The difference is that its verdict was never evaluated: B ran first and ended the path.

Use Reset to restore the starting example. Now change only Chain B family to ip6. B still has priority 10 and a drop verdict, but it does not apply to this IPv4 packet. The trace becomes A:accept → later:accept. The result is continue, not confirmation of delivery.

Which verdicts count?

Family determines which chains to consider before priority determines their order. In this simulation, ip applies to IPv4, ip6 to IPv6, and inet to both. Each applicable chain stands for a single verdict; the simulation does not calculate which individual rules would match inside it.

Priority orders chains within a hook. It does not put every chain along the packet's path into one numbered list. For example, start with the default families and priorities, set B to accept, and set the later hook to drop. The trace is A:accept → B:accept → later:drop. Unlike the starting example, the packet gets past the entire first hook. The location of the drop tells you which stage stopped it.

One more contrast: with an IPv4 packet, set both chain families to ip6. Neither chain applies. The model proceeds to the later hook without reading either chain’s verdict. A missing first-hook verdict in that case is not evidence that a rule accepted the packet.

There are two different reasons a trace can remain unresolved. If both applicable chains have priority 0, their relative order is not guaranteed. The simulation does not use their names or declaration order to pick a winner. If the chains have distinct priorities and both accept, but the later verdict is unknown, it is the observation at the next hook that is missing, not the order at the first one.

In practice

When reading a ruleset, identify the packet family and hook first. List the applicable base chains at that hook with their priorities. Then distinguish a verdict configured in a chain from evidence that the packet actually reached that chain and matched the relevant rule. An isolated accept tells you neither which later stages ran nor what they decided.

This example covers two fixed filter base chains and one abstract later hook. It does not inspect a host, filter traffic, resolve routing, or model NAT or jumps and returns between chains. Its priority inputs are whole numbers from -100 to 100; that range is a limit of the simulation.

Do not change a live firewall on the strength of this trace. Stop if the relevant observations or supported version are unknown. Any real change needs authorization, a check of the exact configuration, a preserved before-state, and a plan to verify and roll back the change. If the last observation you have is an accept, look for evidence at the next applicable chain or hook rather than treating that accept as proof of arrival.

Frequently asked questions

Editorial questions, answered from the sources listed for this article.

Which priority runs first?

Within one hook the smaller numerical priority is evaluated earlier. Do not compare numerical priorities across different hook stages as though they formed a single list.

Can chain names resolve equal priorities?

No guaranteed order follows from the names or declaration order. The model leaves two applicable equal-priority chains unresolved; inspect and establish an unambiguous actual ordering before relying on one verdict running first.

Does an inet chain see both IP families?

Yes, the inet family can cover IPv4 and IPv6. Individual base chains run at their configured hook, and individual rule conditions still determine whether a packet matches.

Does an accept verdict establish delivery?

No. A later base chain at that hook, or a later hook, can still drop the packet; the model has separate gates for them.

Sources & model boundaries

Primary references used for this explanation. The interactive example is an educational model, not a live check.

  1. nftables configuring chains

    Base chain priority and verdicts. Base-chain priority and verdict behavior: lower numerical priority runs earlier within a hook, equal-priority order is not guaranteed, and accept need not end all later evaluation.

    Checked .

  2. nft(8): nftables reference manual

    Address families: inet. The inet family can cover IPv4 and IPv6. Base-chain hooks and individual rule conditions still apply.

    Checked .

Report an issue. Include the article URL and ID, not passwords or access keys.