How can we help?

Open port in Rocky Linux 9

Rocky Linux 9 uses firewalld as its default firewall management tool, providing a dynamic firewall that supports network zones. If you need to open a specific port, such as 5991/tcp, to allow traffic, you can do so using the firewall-cmd command.

Step-by-Step Instructions

1. Add the Port to the Firewall Rules

To permanently allow traffic through port 5991/tcp in the public zone, use the following command:

firewall-cmd --permanent --zone=public --add-port=5991/tcp
  • --permanent: This flag makes the change persistent across reboots.
  • --zone=public: Specifies the zone to which the rule will be added. The public zone is the default zone where public-facing services are usually placed.
  • --add-port=5991/tcp: Indicates the specific port and protocol (TCP in this case) to be opened.

3. Reload the Firewall Configuration

After adding the port, you need to reload the firewall to apply the changes:

firewall-cmd --reload

This command reloads the firewall rules and applies the new configuration.

4. Verify the Port is Open

To confirm that the port has been successfully opened, you can use the following command:

firewall-cmd --zone=public --query-port=5991/tcp

If the port is correctly added, It will show.

Was this article helpful to you?

How can we help?

Unavailable Item Is Unavailable Available Item Is Available