Replace firewalld with iptables in CentOS 7
Firewalld is a pain to set up. To switch to iptables:
yum -y install iptables-services
If you would like to save the firewall rules you need to run the following command
iptables-save > /root/iptables-rules.txt
These rules can be added to /etc/sysconfig/iptables but I usually use the rules that come with iptables package and add my rules to better suit my needs.
systemctl enable iptables systemctl enable ip6tables systemctl stop firewalld systemctl disable firewalld systemctl start iptables systemctl start ip6tables
That’s it!