Logo

How to Set Up a Firewall with UFW on Ubuntu 24.04

Mar 15, 2024

To Set Up a Firewall with UFW on Ubuntu 24.04, follow these steps:

Step 1 : Ensure your system is up-to-date:

sudo apt update

Step 2 : If not already installed, install UFW (Uncomplicated Firewall):

sudo apt install ufw

Step 3 : Check the status of UFW:

sudo ufw status

Step 4 : Allow SSH connections:

sudo ufw allow ssh

Step 5 : (Optional) Allow Other Services : allow other services such as HTTP, HTTPS:

sudo ufw allow http
sudo ufw allow https

Step 6 : Enable UFW to start protecting your system:

sudo ufw enable

Step 7 : Verify that UFW is active and configured as intended:

sudo ufw status

Congratulations! You have successfully set up a firewall with UFW on Ubuntu 24.04.

Recommended