How to install and set up UFW on Ubuntu

This is a guide on how to set UFW on a Ubuntu operating system. In this guide I will show how to allow a couple common ports but this can be changed based on your needs.

Step One: (If not already installed) Install UFW

sudo apt install ufw

Step Two: Add common ports (SSH for connections, DNS for piHole) please do add anymore that you need

sudo ufw allow SSH

sudo ufw allow DNS

sudo ufw allow 82/tcp

Its worth noting writing know items (Such as DNS, SSH, HTTP) is the same as doing:

sudo ufw allow 22/tcp

sudo ufw allow 53/udp

sudo ufw allow 82/tcp

Just makes it easier to remember.

Step Three: Check all that have been added are correct:

sudo ufw show added

Step Four: Enable UFW

sudo UFW enable

If you ever needed to disable the firewall just type

sudo UFW disable

Be sure to check out our other Cyber Security posts for more information:

Cyber Security Posts

Leave a Reply

Your email address will not be published. Required fields are marked *