Where to save Firewall?
after having decided what rules need to be set for iptables, should you save the iptables modifications by typing:
service iptables save. or, is it better to create a script and what's the difference? also, where should you save this scipt in Red Hat 9? thanks! |
you can do
iptables-save > /etc/sysconfig/iptables to save the currently loaded rules which will be loaded everytime you restart |
thanks for the reply looking_lost.
iptables-save > /etc/sysconfig/iptables accomplishes the same thing as service iptables save - saving the changes in the iptables file. i guess my question is what are the advantages of creating a firewall script, and where should you save it? |
Only real difference is that by loading the rules by hand from the commandline, you'll see any specific error messgaes. Depending on how you design your script, alot of times the script won't tell you when a rule fails to load (esp if you call the script during the init process). However, I think scripts are easier to work with, so I test out all the rules from the commandline first before I put them in a script. Then at the end of my script I have the same iptables-save > thing that Looking_Lost suggests.
I just put my script in the same directory as the iptables file (/etc/sysconfig/) and make it executable. You can then put the path to the script in one of the /etc/rc.d/ files so that the script is run at boot (it's actually best to use a specfic rc. file, but I don't remember off the top of my head). HTH |
With RedHat and Mandrake, you do not need to create a script in order to apply iptables rules, you can turn ON the iptables service.
The advantage is that the rules will be applied first and then followed by the activation of the network services. If you want the iptables service to start on system boot, make sure runlevel 3 and 5 are ON. Code:
chkconfig --list iptables Code:
service iptables start |
All times are GMT -5. The time now is 06:19 AM. |