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.
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.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.
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.