Counters

From nftables wiki
Revision as of 19:57, 13 July 2016 by Pablo (talk | contribs) (Created page with "Counters are optional in ''nftables'', thus, you need to explicitly specify them in the rule if you want them. The following example allows you to account all tcp traffic tha...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Counters are optional in nftables, thus, you need to explicitly specify them in the rule if you want them.

The following example allows you to account all tcp traffic that you machine receives:

% nft add rule filter input ip protocol tcp counter

An interesting feature of the counter action is that its position in the rule syntax matters. This rule is not equivalent to the previous rule:

% nft add rule filter input counter ip protocol tcp

The rule is evaluated from the left to the right, so any kind of packet will update the counters, not only TCP packets.