Правила nftables можно настроить через файл конфигурации /etc/nftables.conf или напрямую с помощью команд.
После редактирования /etc/nftables.conf перезагрузите nftables
systemctl restart nftables
echo '#!/usr/sbin/nft -f' > /etc/nftables.conf
echo "flush ruleset" >> /etc/nftables.conf
nft -s list ruleset >> /etc/nftables.conf
systemctl enable nftables.service
nft -f /etc/nftables.conf
в файл /etc/network/interfaces:
после поисания сетевого интерфейса
iface enp5s0 inet manual
добваить
post-up nft -f /etc/nftables.conf
nft -a list ruleset
nft list chain ip nat PREROUTING
nft -a list chain ip nat PREROUTING | grep '# handle 14'
nft delete rule inet filter input handle 9
nft add rule inet filter input position 8 tcp dport 22 counter accept
root@clear:~# cat /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;
}
chain output {
type filter hook output priority filter;
}
}
nft flush ruleset