Ubuntu Firewall – UFW useful commands


To follow this tutorial, you will need one Debian 10 server with a sudo non-root user, which you can set up by following Steps 1-3 in the Initial Server Setup with Debian 10 tutorial.

Step 1 – Installing UFW

Debian does not install UFW by default. If you followed the entire Initial Server Setup tutorial, you will have installed and enabled UFW. If not, install it now using apt:

sudo apt install ufw

We will set up UFW and enable it in the following steps.

Step 2 — Using IPv6 with UFW (Optional)

This tutorial is written with IPv4 in mind, but will work for IPv6 as long as you enable it. If your Debian server has IPv6 enabled, you will want to ensure that UFW is configured to support IPv6; this will ensure that UFW will manage firewall rules for IPv6 in addition to IPv4. To configure this, open the UFW configuration file /etc/default/ufw with nano or your favorite editor:

sudo nano /etc/default/ufw

Then make sure the value of IPV6 is yes. It should look like this:

/etc/default/ufw excerpt

Continue reading “Ubuntu Firewall – UFW useful commands” »