HomeContact

How To Set Up a Firewall Using firewalld on Rocky Linux 9

By Shady Nagy
Published in Linux
January 03, 2024
1 min read
How To Set Up a Firewall Using firewalld on Rocky Linux 9

Table Of Contents

01
Introduction
02
Prerequisites
03
Step 1: Installing firewalld
04
Step 2: Starting and Enabling firewalld
05
Step 3: Checking the Status of firewalld
06
Step 4: Opening Ports for RabbitMQ
07
Step 5: Reloading firewalld
08
Step 6: Verifying the Open Ports
09
Conclusion
10
Feedback and Questions

Introduction

firewalld is a firewall management tool available on many Linux distributions, including Rocky Linux. It provides a dynamically managed firewall with support for network zones to define the level of trust for network connections or interfaces.

Setting up a firewall is crucial for ensuring the security and integrity of your system. In this guide, we’ll walk you through the process of setting up a firewall using firewalld on Rocky Linux 9 and opening ports 5672 and 15672, which are commonly used by RabbitMQ.

Prerequisites

  • A system running Rocky Linux 9
  • Sudo privileges

Step 1: Installing firewalld

If firewalld is not already installed on your system, you can install it using the following command:

sudo dnf install firewalld

Step 2: Starting and Enabling firewalld

Once installed, start the firewalld service and enable it to start on boot:

sudo systemctl start firewalld
sudo systemctl enable firewalld

Step 3: Checking the Status of firewalld

To ensure firewalld is running, use the following command:

sudo systemctl status firewalld

Step 4: Opening Ports for RabbitMQ

RabbitMQ typically uses port 5672 for client connections and 15672 for the management plugin. To open these ports, use the following commands:

sudo firewall-cmd --zone=public --add-port=5672/tcp --permanent
sudo firewall-cmd --zone=public --add-port=15672/tcp --permanent

Step 5: Reloading firewalld

After making changes, reload firewalld to apply them:

sudo firewall-cmd --reload

Step 6: Verifying the Open Ports

To verify that the ports are open, use:

sudo firewall-cmd --list-all

This command will show all settings, including open ports in the current zone.

Conclusion

Your Rocky Linux 9 system now has a running firewalld firewall with ports 5672 and 15672 open for RabbitMQ. This setup enhances your system’s security while allowing necessary traffic for RabbitMQ.

Remember, firewall management is a critical aspect of system administration. Regularly check and update your firewall settings to ensure optimal security.

Feedback and Questions

We’d love to hear your feedback on this tutorial! If you have any questions or suggestions for improvement, please don’t hesitate to reach out. You can leave a comment below, or you can contact us through the following channels:

  1. Email: shady@shadynagy.com
  2. Twitter: @ShadyNagy_
  3. LinkedIn: Shady Nagy

If you found this guide beneficial, don’t hesitate to share it with your network. Until the next guide, happy coding!


Tags

#Linux#Centos#Centos 8#Rocky 8#Rocky 9#Firewall#RabbitMQ

Share


Previous Article
Efficient Task Scheduling in .NET Applications with Hangfire and In-Memory Storage
Shady Nagy

Shady Nagy

Software Innovation Architect

Topics

AI
Angular
dotnet
GatsbyJS
Github
Linux
MS SQL
Oracle

Related Posts

Allowing Nginx to Connect to the Network on Rocky Linux 9
Allowing Nginx to Connect to the Network on Rocky Linux 9
June 07, 2024
2 min

Quick Links

Contact Us

Social Media