CentOS 7 - How to open ports in firewalld?

centos_logoPrior to CentOS 7, “iptables” and “shorewall” were the two options avaiable. Since CentOS-7, the default firewall tool is “firewalld”.

Here is a short-guide on how to open two ports in the firewalld application:


firewall-cmd --get-active-zones
# Lets open Jetty Web Server port
firewall-cmd --zone=public --add-port=8080/tcp --permanent
# Lets open some other port 4242 for TCP
firewall-cmd --zone=public --add-port=4242/tcp --permanent
# Commit changes
firewall-cmd --reload
firewall-cmd --list-all

Cheers.