netfilter project logo

The "nftables" project

What is nftables?

nftables replaces the popular {ip,ip6,arp,eb}tables. This software provides a new in-kernel packet classification framework that is based on a network-specific Virtual Machine (VM) and a new nft userspace command line tool. nftables reuses the existing Netfilter subsystems such as the existing hook infrastructure, the connection tracking system, NAT, userspace queueing and logging subsystem.

This software also provides libnftables, the high-level userspace library that includes support for JSON, see man (3)libnftables for more information.

What is the status of nftables?

This software is available upstream since Linux kernel 3.13.

Running nftables

You require the following software in order to run the nft command line tool:

  • Linux kernel since 3.13, although newer kernel versions are recommended.
  • libmnl: the minimalistic Netlink library
  • libnftnl: low level netlink userspace library
  • nft: command line tool

nft syntax differs from {ip,ip6,eb,arp}tables. Moreover, there is a backward compatibility layer that allows you run iptables/ip6tables, using the same syntax, over the nftables infrastructure.

Main Features

  • Network-specific VM: the nft command line tool compiles the ruleset into the VM bytecode in netlink format, then it pushes this into the kernel via the nftables Netlink API. When retrieving the ruleset, the VM bytecode in netlink format is decompiled back to its original ruleset representation. So nft behaves both as compiler and decompiler.
  • High performance through maps and concatenations: Linear ruleset inspection doesn't scale up. Using maps and concatenations, you can structure your ruleset to reduce the number of rule inspections to find the final action on the packet to the bare minimum.
  • Smaller kernel codebase. The intelligence resides in the userspace nft command line tool, which is considerably more complex than iptables in terms of codebase, however, in the midrun, this will potentially allow us to deliver new features by upgrading the userspace command line tool, with no need of kernel upgrades.
  • Unified and consistent syntax for every support protocol family, contrary to xtables utilities, that are well-known to be full of inconsistencies.

Git trees


You can check out the nftables HOWTO documentation, there is also a manpage.

Copyright © 1999-2024 The Netfilter webmasters . Contact webmaster