
These rules control how to handle traffic that does not explicitly match any other rules. If you’re just getting started with your firewall, the first rules to define are your default policies. Let’s start with setting the default policies. However, before enabling UFW, we will want to ensure that your firewall is configured to allow you to connect via SSH. Now, when UFW is enabled, it will be configured to write both IPv4 and IPv6 firewall rules. To do this, open the UFW configuration with nano or your favorite editor. If your Ubuntu server has IPv6 enabled, ensure that UFW is configured to support IPv6 so that it will manage firewall rules for IPv6 in addition to IPv4. This tutorial is written with IPv4 in mind, but will work for IPv6 as well as long as you enable it. If it has been uninstalled for some reason, you can install it with sudo apt install ufw. One Ubuntu 22.04 server with a sudo non-root user, which you can set up by following our Initial Server Setup with Ubuntu 22.04 tutorial.This tutorial will show you how to set up a firewall with UFW on Ubuntu 22.04.

If you’re looking to get started securing your network, and you’re not sure which tool to use, UFW may be the right choice for you. UFW, or Uncomplicated Firewall, is a simplified firewall management interface that hides the complexity of lower-level packet filtering technologies such as iptables and nftables.
