구성 파일이 있어도 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.

어떤 배포판을 사용하고 있는지 알려주시면 적절한 메커니즘을 찾는 데 도움을 드릴 수 있습니다.

관련 정보