Reloading iptables rules on boot for CentOS and RHEL is simpler than for most other Linux Distributions. RHEL and its clone CentOS write its “permanent” iptables rules to the /etc/sysconfig/iptables file. Writing iptables rules is out of the scope of this article, so I won’t go over that today.
After you have applied your respective iptables rules, you may wish to check on your iptables rules before you save them. Use the following command to list all the current rules:
Use this command to save the iptables rules (the following command is the actual command to save the rules so they are applied on boot)
/sbin/service iptables save
The following command would allow you to double check that your rules have been saved. It is similar to
iptables -L, but also different. The previous command shows all the rules that are currently in effect, but many of those rules will not be applied after your system has been restarted. The following command will show all the rules that are currently in effect and have been written to disk, meaning they will apply even after a reboot.