How to Manage Firewalld and UFW on Linux

Firewalls are essential components of any computer system, helping to protect it from unauthorized access and potential security threats. In the world of Linux, there are two popular firewall management tools – Firewalld and UFW (Uncomplicated Firewall) that help users easily configure and manage their firewall settings.

In this article, we will discuss how to manage Firewalld and UFW on a Linux system.

Firewalld:

Firewalld is a dynamically managed firewall that provides a more user-friendly interface for managing firewall rules. It is the default firewall management tool on many Linux distributions, including Fedora and CentOS.

  1. Installing Firewalld: Firewalld is usually pre-installed on most Linux distributions. However, if it is not installed on your system, you can install it using the package manager of your distribution. For example, on CentOS, you can install Firewalld using the following command:

    sudo yum install firewalld
  2. Starting and enabling Firewalld: To start and enable Firewalld, you can use the following commands:

    sudo systemctl start firewalld
    sudo systemctl enable firewalld
  3. Managing Firewalld rules: You can use the firewall-cmd command to manage Firewalld rules. For example, to allow incoming traffic on port 80 (HTTP), you can use the following command:
    sudo firewall-cmd --zone=public --add-port=80/tcp --permanent
    sudo firewall-cmd --reload

UFW (Uncomplicated Firewall):

UFW is a simplified firewall management tool that is designed to be easy to use for beginners. It is the default firewall management tool on Ubuntu and other Debian-based distributions.

  1. Installing UFW: UFW is usually pre-installed on Ubuntu and other Debian-based distributions. However, if it is not installed on your system, you can install it using the package manager. For example, on Ubuntu, you can install UFW using the following command:

    sudo apt-get install ufw
  2. Enabling UFW: To enable UFW, you can use the following command:

    sudo ufw enable
  3. Managing UFW rules: You can use the ufw command to manage UFW rules. For example, to allow incoming traffic on port 22 (SSH), you can use the following command:
    sudo ufw allow 22/tcp

Both Firewalld and UFW provide easy-to-use interfaces for managing firewall rules on Linux systems. Whether you choose Firewalld for its dynamic management capabilities or UFW for its simplicity, it is important to have a strong firewall in place to protect your system from potential security threats. By following the steps outlined in this article, you can easily manage your firewall settings and strengthen the security of your Linux system.

Tags: 114711471147