Firewall. Open port for CentOS 7

Commands

1
2
3
4
5
6
7
systemctl status firewalld
firewall-cmd --state
firewall-cmd --get-services
firewall-cmd --info-service=service-name
ls /usr/lib/firewalld/services/
firewall-cmd --zone=public --permanent --add-port=8080/tcp
firewall-cmd --reload

Use this command to find your active zone(s):

1
firewall-cmd –get-active-zones

It will say either public, dmz, or something else. You should only apply to the zones required.

In the case of dmz try:

1
firewall-cmd –zone=dmz –add-port=2888/tcp –permanent

Otherwise, substitute dmz for your zone, for example, if your zone is public:

1
firewall-cmd –zone=public –add-port=2888/tcp –permanent

Then remember to reload the firewall for changes to take effect.

1
firewall-cmd –reload

Documentation