iptables not saving rules on reboot

Issues related to configuring your network
Post Reply
screwballl
Posts: 8
Joined: 2014/07/18 18:45:53

iptables not saving rules on reboot

Post by screwballl » 2014/07/18 18:55:10

Recently installed CentOS 7, ran all needed yum updates.
Modified /etc/sysconfig/iptables-config, changed all to yes EXCEPT:
IPTABLES_STATUS_VERBOSE=”no”

Installed iptables-services-1.4.21-13.el7.x86_64

Service started and working.

Added several rules for squid, in and out like this as I have for the last few years with similar distros (CentOS 6.5, Scientific Linux 6.5):

iptables -I INPUT -p tcp -m tcp --dport 8080 -j ACCEPT
Then "service iptables save" and shows it is saved.

Reboot server and when it comes back up, ALL rules are gone. No backups, no saved rule files, no save files, back to default iptables when OS was loaded.

"/usr/sbin/iptables-restore" does nothing as it finds no rules to restore, even if I manually saved them.

I even shut down iptables, manually added them to "/etc/sysconfig/iptables", save, and then restart iptables, yet after reboot it is all gone.

I am curious if this is a bug that needs reported or if there is something else I am missing.

User avatar
TrevorH
Site Admin
Posts: 33218
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: iptables not saving rules on reboot

Post by TrevorH » 2014/07/18 20:03:28

Did you take the necessary steps to disable the new firewalld service first? CentOS 7 enables firewalld by default and you make rule changes using either firewall-config (GUI) or firewall-cmd. You can find details in the man pages.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

screwballl
Posts: 8
Joined: 2014/07/18 18:45:53

Re: iptables not saving rules on reboot

Post by screwballl » 2014/07/18 20:08:45

Yes firewalld has been disabled and stopped.

It is purely iptables now.

firewall-cmd wont work unless firewalld is running, but we use iptables, not firewalld.


So why are the rules I am adding and saving, not being saved after reboot?

Post Reply