Last Updated on 1 month by Sachin G
Here in this small post, I will discuss how to allow ports in the RHEL , CentOS or its derivatives like Alma Linux, Rocky Linux, Fedora, etc version firewall. some users want to open ports and some of user wants to open ports for services like HTTP, FTP, SSH, etc.I am going to explain below for open port or add services in Firewalld.
First, log in with the root user and find Active Zone in Firewalld.
You need to first search, which zone is active in Firewalld. To find get active zone, execute the below following command.
# firewall-cmd --get-active-zones
In CentOS or RHEL , or the firewall is Firewalld, you will get a zone name The name can be dmz, public, or others. if you get an active zone is DMZ from the name and you want to open a port like 3444, then execute the below command to open the port in DMZ.
# firewall-cmd --zone=dmz --permanent --add-port=3444/tcp
if you want to change some other port then repeat the command and replace the port number, for each port you want to open . After that, we need to reload the service of the firewall to change the effect.
# firewall-cmd --reload
Most of the users want to use iptables instead of firewalld, so if you want to disable firewalls and implement iptable then you can refer this link of my blog post here.
I’m Sachin Gupta — a freelance IT support specialist and founder of Tech Transit. I’m certified in Linux, Ansible, OpenShift (Red Hat), cPanel, and ITIL, with over 15 years of hands-on experience. I create beginner-friendly Linux tutorials, help with Ansible automation, and offer IT support on platforms like Upwork, Freelancer, and PeoplePerHour. Follow Tech Transit for practical tips, hosting guides, and real-world Linux expertise!