How to open port for a specific IP address with firewall-cmd on CentOS?

on February 23rd, 2017 by Hades | No Comments »

If you would like to open port 1234 for the IP address with the firewall-cmd command on a CentOS 7.1 server:

firewall-cmd --permanent --zone=public --add-rich-rule='
  rule family="ipv4"
  source address=""
  port protocol="tcp" port="1234" accept'

Check the zone file later to inspect the XML configuration

cat /etc/firewalld/zones/public.xml

Reload the firewall

firewall-cmd --reload


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.