To configure a firewall with UFW (Uncomplicated Firewall) on Ubuntu 20.04 LTS, you will need to perform the following steps:
sudo apt install ufw
sudo ufw enable
<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
<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
deny
option instead of allow
. For example:sudo ufw deny ssh sudo ufw deny 80
sudo ufw status
This will show you which services and ports are allowed or denied.