IP tables - changes not persisting

If your system is fedora-derived add the rule in /etc/sysconfig/iptables.

If you have already added your rule you should simply do a service iptables save.

You can always do
- service iptables save
- edit /etc/sysconfig/iptables as you need
- service iptables restart


You should mention if you are using RedHat or a Debian based system. With redhat / Centos, the service iptables save command should work.


When you call iptables, you're changing the rules that are running, but that information isn't stored anywhere to be re-applied. To do that, you want to execute iptables statements on load. If you're not rebooting your server every day, I don't know what's resetting iptables, but there are lots of packages to help you by being useful front-ends. Ubuntu has ufw, RH/Fedora-based distros have system-config-securitylevel, and there are dozens of others. These typically apply the change and persist it to a script for when things are next reloaded.