Difference between revisions of "Counters"

From nftables wiki
Jump to navigation Jump to search
(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...")
(No difference)

Revision as of 19:57, 13 July 2016

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.