Rule Syntax(nftables)

Rule Syntax(nftables)

Commands #

{add | insert} rule [family] table chain [handle handle | index index] statement ... [comment comment]

replace rule [family] table chain handle handle statement ... [comment comment]

delete rule [family] table chain handle handle

Statements and verdicts #

  1. accept Accept the packet and stop processing.
  2. continue Continue processing the packet.
  3. drop Stop processing and silently drop the packet.
  4. goto Send processing to the specified chain but don’t return to the calling chain.
  5. jump Send processing to the specified chain and return to the calling chain when done or when a return statement is executed.
  6. limit Process the packet according to the rule if the limit of matching received packets has been reached.
  7. log Log the packet and continue processing.
  8. queue Stop processing and send the packet to the user-space process.
  9. reject Stop processing and reject the packet.
  10. return Send processing back to the calling chain.

nftables uses payload expressions and meta expressions #

Payload expressions are those that are gathered from packet information. For instance, there are certain header expressions such as sport and dport (source port and destination port, respectively) that apply to TCP and UDP packets and don’t make sense at the IPv4 and IPv6 layer since those layers don’t use ports. Payload Expressions for IPv4 TCP Header Expressions

Meta Expressions can be used for rules that apply broadly or are tied to common packet or interface properties.