XTABLES-NFT(8)
โจ XTABLES-NFT(8) โ iptables using nftables kernel api โจ
๐ NAME
xtables-nft โ iptables using nftables kernel api ๐
๐ธ DESCRIPTION
okay so xtables-nft are versions of iptables that use the nftables API ๐ bestie, this is a whole set of tools that helps the sysadmin migrate their ruleset from iptables(8), ip6tables(8), arptables(8), and ebtables(8) over to nftables(8) ๐ฆ
The xtables-nft set is made up of several commands ๐ง:
- iptables-nft
- iptables-nft-save
- iptables-nft-restore
- ip6tables-nft
- ip6tables-nft-save
- ip6tables-nft-restore
- arptables-nft
- ebtables-nft
ngl these tools use the libxtables framework extensions and hook into the nf_tables kernel subsystem through the nft_compat module โจ
๐ USAGE
the xtables-nft tools let you manage the nf_tables backend using the native syntax of iptables(8), ip6tables(8), arptables(8), and ebtables(8) ๐ซถ
you should use the xtables-nft tools exactly the same way you'd use the corresponding original tools, no cap ๐
adding a rule will result in that rule being added to the nf_tables kernel subsystem instead ๐ฅ and listing the ruleset will use the nf_tables backend as well ๐
when these tools were designed, the main idea was to replace each legacy binary with a symlink to the xtables-nft program, like this ๐:
/sbin/iptables -> /usr/sbin/iptables-nft-multi
/sbin/ip6tables -> /usr/sbin/ip6tables-nft-multi
/sbin/arptables -> /usr/sbin/arptables-nft-multi
/sbin/ebtables -> /usr/sbin/ebtables-nft-multi
the iptables version string tells you whether the legacy API (get/setsockopt) or the new nf_tables api is being used ๐
iptables -V
iptables v1.7 (nf_tables)
๐ฆ DIFFERENCES TO LEGACY IPTABLES
the xtables-nft tools use the nf_tables kernel API, so rule additions and deletions are always atomic โจ unlike iptables-legacy, iptables-nft -A .. will NOT need to grab the current ruleset from the kernel, change it, and reload the altered ruleset ๐
โโ๏ธ instead, iptables-nft just tells the kernel to add one rule ๐ which is why the iptables-legacy --wait option is a no-op in iptables-nft ๐ฅฑ
using the xtables-nft tools lets you monitor ruleset changes with the xtables-monitor(8) command ๐
heads up ๐ญ: when you use-j TRACEto debug packet traversal through the ruleset, you'll need to run xtables-monitor(8) in--tracemode to actually see the monitoring trace events ๐
๐ EXAMPLES
one basic example is creating the skeleton ruleset in nf_tables from the xtables-nft tools on a fresh machine ๐:
root@machine:~# iptables-nft -L
[...]
root@machine:~# ip6tables-nft -L
[...]
root@machine:~# arptables-nft -L
[...]
root@machine:~# ebtables-nft -L
[...]
root@machine:~# nft list ruleset
table ip filter {
chain INPUT {
type filter hook input priority 0; policy accept;
}
chain FORWARD {
type filter hook forward priority 0; policy accept;
}
chain OUTPUT {
type filter hook output priority 0; policy accept;
}
}
table ip6 filter {
chain INPUT {
type filter hook input priority 0; policy accept;
}
chain FORWARD {
type filter hook forward priority 0; policy accept;
}
chain OUTPUT {
type filter hook output priority 0; policy accept;
}
}
table bridge filter {
chain INPUT {
type filter hook input priority -200; policy accept;
}
chain FORWARD {
type filter hook forward priority -200; policy accept;
}
chain OUTPUT {
type filter hook output priority -200; policy accept;
}
}
table arp filter {
chain INPUT {
type filter hook input priority 0; policy accept;
}
chain FORWARD {
type filter hook forward priority 0; policy accept;
}
chain OUTPUT {
type filter hook output priority 0; policy accept;
}
}
(please note that on fresh machines, listing the ruleset for the first time results in all tables and chains being created ๐ง)
to migrate your complete filter ruleset, in the case of iptables(8), you would use ๐ :
root@machine:~# iptables-legacy-save > myruleset # reads from x_tables
root@machine:~# iptables-nft-restore myruleset # writes to nf_tables
or
root@machine:~# iptables-legacy-save | iptables-translate-restore | less
to see how rules would look in the nft nft(8) syntax ๐ธ
๐ง LIMITATIONS
you should use Linux kernel >= 4.17 ๐ซถ
the CLUSTERIP target is not supported ๐ญ
to get up-to-date info about this, head to http://wiki.nftables.org/ ๐
๐ SEE ALSO
nft(8), xtables-translate(8), xtables-monitor(8) โจ
๐ AUTHORS
the nftables framework is written by the Netfilter project (https://www.netfilter.org) ๐
this manual page was written by Arturo Borrero Gonzalez <arturo@debian.org> for the Debian project, but others are allowed to use it too ๐
this documentation is free/libre under the terms of the GPLv2+ ๐ฆ
and that's a wrap, bestie ๐ซถ this was XTABLES-NFT(8) from June 2018, so go show it some love ๐โจ
๐ฆ where this page comes from
- alpine 3.22: iptables-doc 1.8.11-r1 ยท GPL-2.0-or-later
- alpine 3.23: iptables-doc 1.8.11-r1 ยท GPL-2.0-or-later
- alpine 3.24: iptables-doc 1.8.13-r0 ยท GPL-2.0-or-later
- centos-stream 10: iptables-nft 1.8.11-16.el10 ยท GPL-2.0-only AND Artistic-2.0 AND ISC
- debian trixie: iptables 1.8.11-2 ยท GPL-2.0-only
- fedora 43: iptables-nft 1.8.11-11.fc43 ยท GPL-2.0-only AND Artistic-2.0 AND ISC
- fedora 43: iptables-nft 1.8.11-12.fc43 ยท GPL-2.0-only AND Artistic-2.0 AND ISC
- fedora 44: iptables-nft 1.8.11-13.fc44 ยท GPL-2.0-only AND Artistic-2.0 AND ISC
- nixpkgs unstable: iptables 1.8.13
- opensuse-leap 16.0: iptables 1.8.11-160000.2.2 ยท Artistic-2.0 AND GPL-2.0-only
- opensuse-leap 16.0: iptables 1.8.11-160000.2.2 ยท Artistic-2.0 AND GPL-2.0-only
- opensuse-leap 16.0: iptables 1.8.11-160000.2.2 ยท Artistic-2.0 AND GPL-2.0-only
- opensuse-leap 16.0: iptables 1.8.11-160000.2.2 ยท Artistic-2.0 AND GPL-2.0-only
- ubuntu questing: iptables 1.8.11-2ubuntu2 ยท GPL-2.0-only
- ubuntu resolute: iptables 1.8.11-2ubuntu3 ยท GPL-2.0-only
- ubuntu stonking: iptables 1.8.11-2ubuntu3 ยท GPL-2.0-only
- Copyright 2016-2017, Arturo Borrero Gonzalez <arturo@netfilter.org>
- ๐ girlified by anthropic/claude-haiku-5.5 on : a language model's rewrite of the original, under its terms