The Uncomplicated Firewall for Ubuntu systems
The Uncomplicated Firewall (ufw) is already installed on Ubuntu 20.04 and Ubuntu 22.04. It still uses the iptables backend on Ubuntu 20.04, and the nftables backend on Ubuntu 22.04. For normal operations, it offers a vastly simplified set of commands. Perform just one simple command to open the desired ports and another simple command to activate it, and you have a good, basic firewall. Whenever you perform a ufw command, it will automatically configure both the IPv4 and the IPv6 rules. This alone is a huge time-saver, and much of what we’ve had to configure by hand with either iptables or nftables is already there by default. Although our two versions of Ubuntu use different backends, ufw configuration is identical for both of them.
ufw is also available for Debian and other Debian-based distros, but it might not be installed. If that’s the case, install it by issuing the sudo apt install ufw command.