Centos server will not hold iptables configuration

dsljanus asked:

I have set up a Centos 7 server to run Nagios. By default the OS has pretty draconian iptables rules and a fellow here suggested fixing this by inputing this command:

iptables -A IN_public_allow -p tcp --dport 80 -j ACCEPT 

This works fine until I restart the server, at which point I have to input the command again, otherwise the server is unreachable once again.

Is this normal behaviour for iptables? Can I do something to fix it?

My answer:


CentOS 7 uses firewalld by default to manage the firewall.

You can simply add the port to firewalld with:

firewall-cmd --add-service=http --permanent     # Startup config
firewall-cmd --add-service=http                 # Running config

View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.