Centos 7 => Automatic iptables rules load

Support for security such as Firewalls and securing linux
Post Reply
Posts: 44
Joined: 2015/12/07 20:01:46

Centos 7 => Automatic iptables rules load

Post by jejedu67 » 2018/10/29 23:47:35


I want to know if there is a solution in order to load automatically iptables rules after each restart, without going to SSH and load it myself.

Thank you very much

User avatar
Forum Moderator
Posts: 28031
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Centos 7 => Automatic iptables rules load

Post by TrevorH » 2018/10/30 02:59:31

If using iptables-services and not firewalld (the default) then your saved rules are in /etc/sysconfig/iptables and can be updated from the running set of currnet rules by running service iptables save. The rules are loaded from there at reboot/restart if iptables.service is enabled (systemctl is-enabled iptables).

If you use firewalld which is default then you can use firewall-cmd --runtime-to-permanent to save the running rules and/or run firewall-cmd twice, once with and once without --permanent.
CentOS 6 will die in November 2020 - migrate sooner rather than later!
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 is dead, do not use it.
Full time Geek, part time moderator. Use the FAQ Luke

Post Reply

Return to “CentOS 7 - Security Support”