Ubuntu 22.04 Set Up UFW Firewall in 5 Minutes

Ubuntu 22.04 Set Up UFW Firewall in 5 Minutes

Setting up the UFW firewall on Ubuntu 22.04 is a simple and effective way to protect your system from unwanted incoming traffic. Here is a step-by-step guide to help you set up the UFW firewall on your Ubuntu 22.04 system in just a few minutes:

  1. First, make sure that the UFW package is installed on your system. You can check if UFW is installed by running the following command:
sudo ufw status
Source:ww‮‬w.lautturi.com

If UFW is not installed, you can install it by running the following command:

sudo apt update
sudo apt install ufw
  1. Enable the UFW firewall by running the following command:
sudo ufw enable

This will enable the firewall and block all incoming traffic.

  1. Allow incoming traffic for specific services. For example, to allow incoming traffic for the SSH service (which is necessary if you want to be able to remotely access the server), you can run the following command:
sudo ufw allow ssh

To allow incoming traffic for other services, you can use the ufw allow command followed by the name of the service. For example, to allow incoming traffic for the HTTP and HTTPS services, you can run the following commands:

sudo ufw allow http
sudo ufw allow https
  1. (Optional) Allow incoming traffic for specific ports. If you want to allow incoming traffic for a specific port that is not associated with a service, you can use the ufw allow command followed by the port number.
Created Time:2017-10-30 14:27:24  Author:lautturi