IPtables rules flushed with reboot ?
Hello,
I notice that my firewall rules are flushed with a reboot. Is that some setting or so ? |
Fedora (15 at least) will load saved iptables rules from /etc/sysconfig/iptables , so if you are loading your rules manually via a script, you need to save the rules using
Code:
iptables-save > /etc/sysconfig/iptables |
It is common practice to use shell scripts to establish a functional set of iptables rules. The rules are edited in the shell script, and then the script is run to load the rules set. The script can be hooked into the system startup scripting in order to automatically load at boot-time. Usually, there is provision in the script to flush all of the rules, and then successively re-build the set of rules as the script runs. This allows you edit the script to add new functionality, and then run the script to install the new features.
--- rod. |
I think ufw (uncomplicated firewall- default in ubuntu) and firestarter firewall frontends, if installed, affect iptables at startup. They also change iptables rules when network is switched off or on. You may want to uninstall these if you have your own firewall iptables rules.
In ubuntu, following line inserted in file /etc/rc.local will load iptables rules at startup: iptables-restore < myrules.saved (no sudo needed in this file). File 'myrules.saved' is obtained by following command: sudo iptables-save > myrules.saved |
Quote:
I use CentOS 5.6 On another server I do not have this problem... And I can't find a difference... |
I have solved my problem by removing the file /etc/sysconfig/iptables
This file indeed had some basic firewall rules which were read on reboot. Now, when I reboot, my firewall rules which I set through CSF are kept. |
All times are GMT -5. The time now is 06:38 PM. |