nftables 规则:没有此类文件或目录错误

los*_*fos 5 linux iptables netfilter nftables

我正在尝试应用我从本指南中采用的 nftables 规则:

nft add rule filter INPUT tcp flags != syn counter drop
Run Code Online (Sandbox Code Playgroud)

不知何故,这最终是:

错误:无法处理规则:没有这样的文件或目录

谁能发现我在这条规则中可能遗漏了什么?

Amo*_*mos 6

你可能错过了你的桌子或链条。

nft list ruleset
Run Code Online (Sandbox Code Playgroud)

会给你你正在使用的东西。如果它什么也没打印出来,你就错过了两者。

nft add table ip filter # create table
nft add chain ip filter INPUT { type filter hook input priority 0 \; } # create chain
Run Code Online (Sandbox Code Playgroud)

然后您应该能够将您的规则添加到链中。

注意:如果您使用 ssh 登录,您的连接将被暂停。