Making Firewalls Easier in Linux: UFW

In Linux, setting up a firewall traditionally meant a deep dive into iptables. Iptables is not known as being user friendly, and I used to avoid it whenever possible. There is a software in Debian and Ubuntu to make this much easier and less frustrating: UFW. UFW stands for “Uncomplicated FireWall”. This software allows you to configure iptables with ease.

Here are some instructions to install UFW on Debian-based distros.

$ sudo apt update
$ sudo apt install ufw

Edit the config file to enable IPV4 and/or IPV6.

$ sudo nano /etc/default/ufw

Make sure the following is included somewhere in your config file:

IPV6=yes
IPV4=yes

Save the file and exit your text editor. The default policy of UFW is set so that that the incoming traffic is not allowed and the outgoing traffic is allowed. It denies access to your computer by others, but your programs are allowed to connect to the outside world. The basic syntax to add rules to ufw is as follows:

$ sudo ufw default [policy] [chain]

As an example, the following command will deny access to your computer:

$ sudo ufw default deny incoming

To allow traffic out, use the following command:

$ sudo ufw default allow outgoing

To allow SSH connections into your machine, use the following:

$ sudo ufw allow ssh

Before you enable ufw, use the following command to check its’ status:

$ sudo ufw status verbose

Finally, to enable ufw, use the following command:

$ sudo ufw enable

Enable the GUI

There is also a GUI to make it even easier. To install it:

$ sudo apt install gufw
ufw gufw firewall user interface

Firewalls in linux don’t get any easier than this! 😀