PatrickMcHardykaber@trash.net2008Patrick McHardynftables8nftables
Administration tool for packet filtering and classification
nftablesdirectoryfilenamecmdnftablesDescription
nftables is used to set up, maintain and inspect packet
filtering and classification rules in the Linux kernel.
Options
For a full summary of options, run nftables --help.
Show help message and all options.
Show version.
Numeric output: IP addresses and other information
that might need network traffic to resolve to symbolic names
are shown numerically.
Add the directory directory to the list of directories to by searched for included files.
Read input from filename.
Read input from an interactive readline CLI.
Input file format
Input is parsed line-wise. When the last character of a line just before
the newline character is a non-quoted backslash (\),
the newline is treated as a line continuation.
A # begins a comment. All following characters on
the same line are ignored.
Other files can be included by using
include "filename".
Tablesadddeletelistflushtablefamilytable
Tables are containers for chains. They are identified by their family
and their name. The family must be one of
ipip6arpbridge.
When no family is specified, ip is used by default.
Add a new table for the given family with the given name.
Delete the specified table.
List all chains and rules of the specified table.
Flush all chains and rules of the specified table.
Chainsaddchainfamilytablechainhookpriorityadddeletelistflushchainfamilytablechain
Chains are containers for rules. They exist in two kinds,
basechains and regular chains. A basecase is an entry point for
packets from the networking stack, a regular chain may be used
as jump target and is used for better rule organization.
Add a new chain in the specified table. When a hook and priority
value are specified, the chain is created as a base chain and hooked
up to the networking stack.
Delete the specified chain.
List all rules of the specified chain.
Flush all rules of the specified chain.
Rulesadddeleterulefamilytablechainhandle handlestatement
Rules are constructed from two kinds of components according to a set
of rules: expressions and statements. The lowest order expression is a
primary expression, representing either a constant or a single datum
from a packets payload, meta data or a stateful module. Primary expressions
can be used as arguments to relational expressions (equality,
set membership, ...) to construct match expressions.
Primary expressionsMeta expressions
A meta expression refers to meta data associated with a packet.
Meta expressionsKeywordDescriptionTypelengthLength of the packet in bytesNumeric (32 bit)protocolEthertype protocol valueethertypepriorityTC packet priorityNumeric (32 bit)markPacket markpacketmarkiifInput interface indexifindexiifnameInput interface nameifnameiiftypeInput interface hardware typehwtypeoifOutput interface indexifindexoifnameOutput interface nameifnameoiftypeOutput interface hardware typehwtypeskuidUID associated with originating socketuidskgidGID associated with originating socketgidrtclassidRouting realmrealm
Meta expression specific typesTypeDescriptionifindex
Interface index (32 bit number). Can be specified numerically
or as name of an existing interface.
ifname
Interface name (16 byte string). Does not have to exist.
uid
User ID (32 bit number). Can be specified numerically or as
user name.
gid
Group ID (32 bit number). Can be specified numerically or as
group name.
realm
Routing Realm (32 bit number). Can be specified numerically
or as symbolic name defined in /etc/iproute2/rt_realms.