How to configure rocky Linux firewalld?

How to configure rocky Linux firewalld?

      • Introduction

        Firewalld plays a vital role in ensuring the security of your Linux system, managing both incoming and outgoing traffic, and shielding your network against potential risks. In this guide, we’ll walk you through the process of configuring firewalld on Rocky Linux, ensuring your system remains protected while allowing necessary traffic.

        Installing Firewalld

        To get started, it’s important to verify that firewalld is installed on your Rocky Linux system. If it’s not already installed, you can easily do so by executing the following command in your terminal:

        sudo dnf install firewalld

        Starting and Enabling Firewalld Service

        Once firewalld is installed, you’ll want to start the service and enable it to start automatically on boot. Execute the following commands:

        sudo systemctl start firewalld 
        sudo systemctl enable firewalld

        Checking Firewalld Status

        To verify if the firewalld service is running properly, you can use the following command:

        sudo systemctl status firewalld

        Configuring Firewalld

        Firewalld can be configured using the firewall-cmd command-line utility. Let’s explore some basic configurations.

        Allowing SSH Traffic

        If you need to allow SSH traffic through the firewall, use the following command:

        sudo firewall-cmd –zone=public –add-service=ssh –permanent

        This command ensures that SSH traffic is permitted in the public zone permanently.

        Allowing HTTP and HTTPS Traffic

        To allow HTTP and HTTPS traffic through the firewall, execute the following command:

        sudo firewall-cmd –zone=public –add-service=http –add-service=https –permanent

        This command enables HTTP and HTTPS traffic in the public zone permanently.

        Allowing Specific Ports

        If you require access to specific ports, you can open them using the following command:

        sudo firewall-cmd –zone=public –add-port=port_number/tcp –permanent

        Replace port_number with the specific port number you want to allow.

        Reloading Firewall Configuration

        After making changes to the firewall configuration, reload it to apply the changes:

        sudo firewall-cmd –reload

        Checking Configured Rules

        To view all currently configured rules in firewalld, you can use the following command:

        sudo firewall-cmd –list-all

        Adjusting Zone Settings

        Firewalld comes with various zones (public, home, work, etc.) representing different network environments. Adjust rules for each zone as needed.

        Further Configurations

        Explore additional options and configurations in the official documentation or by using the firewall-cmd –help command.


        Configuring firewalld on Rocky Linux is essential for enhancing system security and controlling network traffic effectively. By following these steps, you can ensure your system remains protected from potential threats while allowing necessary traffic.


  • What are the best VPS hosts for Rocky Linux?

    ReliableVPS offers some of the best VPS hosting solutions for Rocky Linux, providing reliable performance and excellent support.

  • Where can I buy a VPS server for Linux?

    You can purchase a VPS server for Linux from various providers online. Consider ReliableVPS for affordable and reliable options.

  • What are the benefits of using a budget VPS?

    Budget-friendly VPS solutions offer affordability and are perfect for individuals and small businesses seeking to host their websites or applications while staying within a reasonable budget.

  • Can I configure firewalld on other Linux distributions?

    Yes, firewalld is available on various Linux distributions, including CentOS, Fedora, and Ubuntu. While the setup procedure might differ slightly, the fundamental principles remain consistent across different configurations.

  • Is it necessary to configure firewalld on Rocky Linux?

    Yes, configuring firewalld on Rocky Linux is crucial for securing your system and protecting it from unauthorized access and malicious activity.

Post Your Comment

Free Migration Assistance

If you need assistance with migrating your current data from another provider, we would be more than happy to assist.