How To Configure Firewall with UFW on Ubuntu 20.04 LTS

htt‮w//:sp‬ww.lautturi.com
How To Configure Firewall with UFW on Ubuntu 20.04 LTS

To configure a firewall with UFW (Uncomplicated Firewall) on Ubuntu 20.04 LTS, you will need to perform the following steps:

  1. Install UFW using the following command:
sudo apt install ufw
  1. Enable the firewall by running the following command:
sudo ufw enable
  1. Allow incoming connections for specific services by running the following command, replacing <service> with the name of the service you want to allow:
sudo ufw allow <service>

For example, to allow incoming SSH connections, you would run the following command:

sudo ufw allow ssh
  1. You can also allow incoming connections for specific ports by running the following command, replacing <port number> with the port number you want to allow:
sudo ufw allow <port number>

For example, to allow incoming connections on port 80 (for HTTP), you would run the following command:

sudo ufw allow 80
  1. To deny incoming connections for a specific service or port, use the deny option instead of allow. For example:
sudo ufw deny ssh
sudo ufw deny 80
  1. You can check the status of the firewall at any time by running the following command:
sudo ufw status

This will show you which services and ports are allowed or denied.

Created Time:2017-10-28 21:38:50  Author:lautturi