这不起作用(通过 systemd 重启 nftables,它应该加载/etc/nftables.conf
):
cat /etc/nftables.d/forward/example.conf
meta oifname "eth2" ip daddr 5.6.7.8/30 accept
^^^^^^^^^^^^^^^^^^^ ~~~~
Error: Statement after terminal statement has no effect
但这也不起作用:
ip daddr 5.6.7.8/30 meta oifname "eth2" accept
^^^^^^^^^^^^^^^^^^^ ~~~~
Error: Statement after terminal statement has no effect
这也不是(使用连接示例)
ip daddr . meta oifname {5.6.7.8/30 . "eth2"} accept
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: Statement after terminal statement has no effect
注意:/etc/nftables.conf 的内容:
#!/usr/sbin/nft -f
flush ruleset
table inet filter {
chain input {
type filter hook input priority filter;
}
chain forward {
type filter hook forward priority filter;
include "/etc/nftables.d/forward/*.conf"
}
chain output {
type filter hook output priority filter;
}
}
我该如何同时执行这两项操作?如果此 IP 范围并不总是路由到 eth2(例如,策略路由),而 eth2 不只包含此 IP 范围,那么这是否有必要?