CentOS 7 - How to open ports in firewalld?

Focus On Content  ~/ click me to toggle the navigation bar to the right

<img src="/img/2016/11/centos_logo.png" alt="centos_logo"> Prior 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.