Guides and tutorials

Hundreds of tutorials and step by step guides carefully written by our support team.

How to install UFW on Debian 11/Ubuntu 22.04

UFW (Uncomplicated Firewall) is a network firewall tool for Linux-based operating systems that focuses on simplifying firewall configuration. UFW provides an easy-to-use user interface for managing firewall rules, allowing system administrators to easily configure and control network access to their systems. In summary, UFW is a useful tool for protecting Linux systems against potential network attacks.

  1. Open a terminal: Press Ctrl+Alt+T to open a terminal on your system.

  2. Verify that UFW is not installed: Before starting the installation of UFW, it is important to verify that it is not installed on your system. To do this, run the following command in the terminal:

sudo ufw status

If UFW is not installed, you will see an error message indicating that the ufw command is not found. Otherwise, be sure to disable UFW before continuing with the installation.

  1. Install UFW: To install UFW on Debian 11 or Ubuntu 22.04, run the following command in the terminal:
sudo apt-get update
sudo apt-get install ufw
  1. Verify the installed version: To verify that the UFW installation was completed correctly, run the following command in the terminal:
ufw version

This command should display the current version of UFW installed on your system.

  1. Configure UFW: Once UFW is installed, you must configure it to allow or deny connections to your system. By default, all connections are blocked, so it is important to configure the UFW rules according to your needs.
  • First, you can enable UFW using the following command:
sudo ufw enable
  • Next, you can configure UFW rules to allow or deny connections. For example, to allow SSH traffic, you must run the following command:
sudo ufw allow ssh
  • To deny HTTP traffic, run the following command:
sudo ufw deny http

You can consult the complete list of services and their associated ports, using the ufw app list command.

  1. Check the UFW rules: To check the rules you have configured in UFW, run the following command in the terminal:
sudo ufw status

This command will display the rules you have configured in UFW, as well as the current firewall status.

success Done! With these steps, you have installed and configured UFW on your Debian 11 or Ubuntu 22.04 system. Now, you can manage and modify UFW rules according to your network security needs.