How to Work with UFW – Uncomplicated Firewall

Ufw (Uncomplicated Firewall) is a firewall management software which is quite useful during devops and system administrative tasks. By the end of this post, you will learn

  • How to install and setup a firewall
  • How to allow and deny access via ports
  • How to delete rules
  • etc

Let us start.

Installation and Setup

To install UFW (Uncomplicated Firewall) on Ubuntu, you can follow these steps:

sudo apt-get install ufw
sudo systemctl enable ufw

Allowing or Opening a Port in a UFW

To allow or opening a port in the firewall there by allowing access to your system you can do the following if you know the port that your service run on example in Django , it is 8000.

sudo ufw allow 8000

This will allow access to this port

Deny or Closing a Port in a UFW

sudo ufw deny 8000

Removing or Deleting Rules and Port from UFW

To remove a port from UFW (Uncomplicated Firewall) on Ubuntu, you can follow these steps:

  • List the available firewall rules and identify the rule number of the port you want to remove from the list. In most cases the rules apply to both IPV4 and IPV6 (v6) protocols.
sudo ufw status numbered
  • Delete the rule
sudo ufw delete rule_number

We have learnt how to use UFW. I hope this was helpful

Thanks for your time
Jesus Saves

By Jesse E.Agbe (JCharis)

Leave a Comment

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