Fix: nftables Setup on Ubuntu 22.04
Ubuntu 22.04 uses nftables as the backend for iptables by default. The iptables command maps to iptables-nft. Direct nftables configuration provides better performance for complex rulesets.
Basic nftables ruleset — /etc/nftables.conf
#!/usr/sbin/nft -f
flush ruleset
table inet filter {
chain input {
type filter hook input priority 0; policy drop;
ct state established,related accept
iif lo accept
tcp dport { 22, 80, 443 } accept
icmp type echo-request accept
}
chain forward {
type filter hook forward priority 0; policy drop;
}
chain output {
type filter hook output priority 0; policy accept;
}
}sudo systemctl enable nftables && sudo systemctl start nftables
Use the Firewall Auditor to check your UFW/iptables rules on Ubuntu 22.
Open Tool →