LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-15-2008, 07:57 AM   #1
neoplasma
LQ Newbie
 
Registered: Jul 2008
Posts: 9

Rep: Reputation: 0
confuse with iptables save


i used iptables and i still don't understand how iptables save previous configuration,

ussualy i used three way for add or edit rule in my iptables
1.stop iptables using '/etc/init.d/iptables stop' and then i insert new rule, after insert the new rule i use '/etc/init.d/iptables save' and than '/etc/init.d/iptables restart',after that i looked in /etc/sysconfig/iptables and all previous configuration was disepear in iptables script, i know the rule was save in iptables save but when i insert new rule again all previous script was disepear again

2.i edit the script manualy using 'vi /etc/sysconfig/iptables' and insert or edit new rule an than save new rule using ':wq' and restart iptables, the previous rule still exist when i used this method but i still confuse coz sometimes table mangle, nat or filter is disepear too

which one is the right one or maybe there is any method to keep all previous rule configuration in /etc/sysconfig/iptables coz sometimes i need deleted or edit rule in my iptables but i forgot previous ruled that i was inserted in iptables script

and last one, what is the diferent between "service iptables stop/save/restart" and using "/etc/init.d iptables stop/save/restart

thx..
 
Old 07-15-2008, 08:30 AM   #2
gparrish
LQ Newbie
 
Registered: Apr 2006
Posts: 13

Rep: Reputation: 0
ussualy i used three way for add or edit rule in my iptables
1.stop iptables using '/etc/init.d/iptables stop' and then i insert new rule, after insert the new rule i use '/etc/init.d/iptables save' and than '/etc/init.d/iptables restart',after that i looked in /etc/sysconfig/iptables and all previous configuration was disepear in iptables script, i know the rule was save in iptables save but when i insert new rule again all previous script was disepear again

1. Try this instead.

- Dont stop iptables
- Insert rule as needed
- Check rule config
iptables -L

- Save iptables
/sbin/iptables-save > /etc/sysconfig/iptables

Now stop/start or restart iptables.
/etc/init.d/iptables stop/start

- Check rule config
iptables -L

- Restore iptables if your new rules is not present.
/sbin/iptables-restore /etc/sysconfig/iptables


2. As for 'service' that is just a wrapper to run init scripts. I would recommend you utilize the '/etc/init.d/' practice since you will find that commonly on various *nix systems where service will not be available on all distros.

Thanks,
greg
 
Old 07-15-2008, 10:47 PM   #3
neoplasma
LQ Newbie
 
Registered: Jul 2008
Posts: 9

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by gparrish View Post
ussualy i used three way for add or edit rule in my iptables
1.stop iptables using '/etc/init.d/iptables stop' and then i insert new rule, after insert the new rule i use '/etc/init.d/iptables save' and than '/etc/init.d/iptables restart',after that i looked in /etc/sysconfig/iptables and all previous configuration was disepear in iptables script, i know the rule was save in iptables save but when i insert new rule again all previous script was disepear again

1. Try this instead.

- Dont stop iptables
- Insert rule as needed
- Check rule config
iptables -L

- Save iptables
/sbin/iptables-save > /etc/sysconfig/iptables

Now stop/start or restart iptables.
/etc/init.d/iptables stop/start

- Check rule config
iptables -L

- Restore iptables if your new rules is not present.
/sbin/iptables-restore /etc/sysconfig/iptables


2. As for 'service' that is just a wrapper to run init scripts. I would recommend you utilize the '/etc/init.d/' practice since you will find that commonly on various *nix systems where service will not be available on all distros.

Thanks,
greg
thx a lot greg, i'll try those method
btw what is exactly "init script"?
 
Old 07-16-2008, 08:14 AM   #4
gparrish
LQ Newbie
 
Registered: Apr 2006
Posts: 13

Rep: Reputation: 0
Init scripts are basically just shell scripts used to start up services or daemons on a system when it boots or when you want to stop/start/restart services manually. How this is done may vary depending on the distribution. Many of these are installed by the OS or application when it is installed, but you can create your own and add or remove them as needed.

Review this link for more good details.

http://www.linux.com/articles/114107

Thanks,
greg
 
Old 07-17-2008, 02:02 AM   #5
neoplasma
LQ Newbie
 
Registered: Jul 2008
Posts: 9

Original Poster
Rep: Reputation: 0
ic maybe itsame like msconfig on windows
sometimes i put command in /etc/rc.local but i dont know what is init means hehe

thx anyway
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
iptables-save, iptables-restore, how to set up them in some script sarajevo Linux - Networking 1 03-25-2008 12:39 AM
how to save iptables ? renaissance Ubuntu 2 07-21-2006 09:27 AM
how to save iptables ricnoah Red Hat 8 02-19-2006 11:48 PM
Where should I save this iptables? wardialer Linux - Newbie 2 02-12-2005 05:10 AM
Iptables-save ??? gruger Linux - Security 3 05-23-2003 07:23 PM


All times are GMT -5. The time now is 08:42 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration