Transfer from https://tvzr.com/archives/134
Because there are several common services on my server, such as mysql, memcached, redis, etc., the default ports are too safe, I will change to other ports, but these ports need to provide more services, so only use iptables Off:
iptables -I INPUT 4 -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT
Then save
service iptables save
After executing the second command, you will find the following information:
iptables: Saving firewall rules to /etc/sysconfig/iptables:[ OK ]
It stands to reason that the configuration should be saved after restarting, but after restarting the machine, I found that the firewall configuration has not been saved. So Google, it turned out that you need to start iptables. Awkward ~
chkconfig iptables on