Networking HowTos
Networking HowTos

Save iptables firewall config on CentOS 6

February 1, 2013 CentOS, Linux

Changes you make to iptables firewall rules only exist for the current boot, and if you don’t save the config, you will loose any changes upon rebooting.
CentOS 6 blocks most incoming ports by default, so you will generally have to make changes to the firewall if you install any new packages. Thankfully CentOS 6 provides the ability to easily save the configuration.
To save the current iptables firewall config, issue the following command:

# service iptables save

Example output:

# service iptables save
iptables: Saving firewall rules to /etc/sysconfig/iptables:[  OK  ]
#

During the next system boot up, or the next time the iptables rules are reloaded, your firewall settings will be reloaded.

You Might Also Like