How To Setup UFW (Uncomplicated Firewall) On Ubuntu 22.04 LTS

How To Setup UFW (Uncomplicated Firewall) On Ubuntu 22.04 LTS

In this tutorial, we are going to show you the method to set up UFW on Ubuntu 22.04 LTS.  UFW or Uncomplicated Firewall is an application that manages iptables-based firewalls on Ubuntu. UFW is a user-friendly tool to configure the firewall.

How To Setup UFW (Uncomplicated Firewall) On Ubuntu 22.04 LTS

Let’s have a look at the step-by-step method to set up UFW on Ubuntu 22.04 LTS.

UFW  is already installed on Ubuntu 22.04 LTS By default. You can run the following command to see whether the UFW is installed or not.

which ufw

If it does not return the path to the command then run the following command to install UFW on Ubuntu 22.04 LTS.

sudo apt install ufw

and run the following command to enable UFW:

sudo ufw enable

You can verify that UFW is running by running the following command:

sudo ufw status verbose

Run the following command to turn off or disable the UFW.

sudo ufw disable

UFW Allow Command To Allow Incoming Connections.

Run the following command to allow SSH access.

sudo ufw allow 22

Run the following command to deny the connection from port 80:

sudo ufw deny 80

Allow a specific IP Address

Run the following command to allow the specific IP address on Linux. The command below will allow the IP 192.168.1.115 to access all ports on the server:

sudo ufw allow from 192.168.1.115

Disable and Reset UFW on Ubuntu 22.04 LTS

Run the following command to turn off or disable UFW on Ubuntu 22.04 LTS

sudo ufw disable

Deleting a UFW Firewall Rule On Ubuntu 22.04 LTS

Run the following command to delete a UFW firewall rule on Ubuntu 22.04 LTS.

sudo ufw delete allow ssh
READ More Relevant Stuff:  apt Command In Linux Examples

Leave a Reply

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