Start by saving your current iptables rules if there are any.
If you are using CentOS 6.2 or 6.5, save your current iptables rules with the following command:
/sbin/service iptables save
If you are using CentOS 7 the base installation does not include iptables-services. You will need to install it before your firewall is persistent through boots
yum install -y iptables-services systemctl enable iptables systemctl start iptables
To save your current rule set use the following command
/usr/libexec/iptables/iptables.init save
That’s it! Your firewall rules are in place and protecting your server. Remember, you’ll need to edit the firewall rules later if you install other software or services.