How do you reload nftables?

I’m not seeing a systemd unit for nftables - how does one reload the nftables from the config iniptables-nft short of rebooting the host? Perhaps in the manner of iptables-restore?

Also, what is the rulespec format for iptables-nft? There’s no man page, and it seems to require rules numbers and reject any iptables-like rulespec with a Bad Argument error.

As for nft, how does one get it to list linenumbers in the manner if iptables-nft -L --linenumbers? This doesn’t seem to be in the man page anywhere,

Fedora 44 here.

Take a look at nftables.service as provided by the package nftables-services. I assume you have chosen to not use firewalld, which is a valid choice.

First has to be running:

sudo systemctl start nftables


Reload:

 systemctl reload nftables

The iptables-nft command does not use a separate “rulespec” format because it is a shim that translates legacy iptables syntax into the underlying nftables kernel API atomically.

  • Input Syntax: It accepts standard legacy iptables arguments (e.g., -A INPUT -p tcp --dport 80 -j ACCEPT).

  • Underlying Mechanism: It uses the libxtables framework to hook into the nf_tables kernel subsystem via the nft_compat module, converting commands on the fly rather than reading a static file format.

  • Management: While you can manage rules using legacy commands, the actual persistent configuration is stored in nftables syntax files (typically /etc/nftables.conf or included files).

There’s no --line-numbers equivalent in nft. Instead, nftables uses handle numbers — the -a (or --handle) flag prints them:

nft -a list ruleset

Took me some time learning this valuable information. And Still Learning…:slight_smile:

I also encourage you read up on nftables.