ufw無効
sudo ufw disable
sudo systemctl stop ufw
sudo systemctl disable ufw
reboot
sudo apt install nftables
sudo update-alternatives --config iptables
sudo vim /etc/nftables.conf
#!/usr/sbin/nft -f
flush ruleset
table inet filter {
chain input {
type filter hook input priority 0; policy drop;
iifname "lo" counter accept
ct state established,related counter accept
ct state new tcp dport 22 counter accept
}
chain forward {
type filter hook forward priority 0; policy drop;
}
chain output {
type filter hook output priority 0; policy accept;
}
}
起動と有効化
systemctl enable nftables --now
動作確認
nft list ruleset
sudo iptables --version
iptables v1.8.4 (nf_tables)