If you would like to open port 1234 for the IP address 1.2.3.4
with the firewall-cmd command on a CentOS 7.1 server:
1 2 3 4 |
firewall-cmd --permanent --zone=public --add-rich-rule=' rule family="ipv4" source address="1.2.3.4/32" port protocol="tcp" port="1234" accept' |
Check the zone file later to inspect the XML configuration
1 |
cat /etc/firewalld/zones/public.xml |
Reload the firewall
1 |
firewall-cmd --reload |