設定ファイルがあってもnftablesは機能しません。

設定ファイルがあってもnftablesは機能しません。

Debian 10でnftablesを使用しています。これは私の設定ファイルです。

# cat /etc/nftables.conf
#!/usr/sbin/nft -f

flush ruleset

table inet filter {
        chain input {
                type filter hook input priority 0;
        }
        chain forward {
                type filter hook forward priority 0;
        }
        chain output {
                type filter hook output priority 0;
        }
}

およびサービスファイル

[Unit]
Description=nftables
Documentation=man:nft(8) http://wiki.nftables.org
Wants=network-pre.target
Before=network-pre.target shutdown.target
Conflicts=shutdown.target
DefaultDependencies=no

[Service]
Type=oneshot
RemainAfterExit=yes
StandardInput=null
ProtectSystem=full
ProtectHome=true
ExecStart=/usr/sbin/nft -f /etc/nftables.conf
ExecReload=/usr/sbin/nft -f /etc/nftables.conf
ExecStop=/usr/sbin/nft flush ruleset

[Install]
WantedBy=sysinit.target

しかし、nftablesは正しく動作しません。いくつかの例があります。

nft list tables: 出力なし

...

# nft list table inet filter
Error: Could not process rule: No such file or directory
list table inet filter
                ^^^^^^

....

# nft add table ip filter
Error: Could not process rule: Operation not supported
add table ip filter
^^^^^^^^^^^^^^^^^^^^

なぜ?どうやって解決しますか?

ベストアンサー1

展開パッケージは、nftablesシステム起動時にnftablesルールを自動的にロードするメカニズムを提供できます。たとえば、Fedoraではnftablesサービスを有効にできます。

systemctl enable nftables

...ここで設定がロードされます/etc/sysconfig/nftables.conf

どのディストリビューションを使用しているかを教えてください。適切なメカニズムを見つけるのに役立ちます。

おすすめ記事