A Firewall in Linux Systems

A firewall prevent unauthorized access to your computer. It’s a crucial part of security in your operating system.

For Debian-compatible distributions like Ubuntu, if you want to use a graphical interface, the easiest way is to install the gufw program:
sudo apt-get update
sudo apt-get install gufw

Once installed, you can run the gufw program, enable the firewall in the window that appears, and leave the profile as “home.”

Additional tip: If you encounter problems with the gufw firewall not starting, you can try running the following command after installing gufw along with ufw:

sudo ufw enable

Alternatively, you can install only the ufw package and manually set up the basic firewall rules:

sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw enable

In rpm compatible systems like Fedora and others, you need to enable the firewalld service for initial configuration:

sudo systemctl enable firewalld

You can verify if the firewall service is running by checking its status:

sudo systemctl status firewalld

For more detailed information about the current firewalld configuration, you can use the following command:

sudo firewall-cmd –list-all