LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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 11-20-2004, 01:05 AM   #1
The_JinJ
Member
 
Registered: Apr 2004
Location: Scotland
Distribution: Suse, OpenWRT
Posts: 299

Rep: Reputation: 30
IPTABLES - rules in /etc/sysconfig/iptables


If I manually add a rule via the command line like:
#iptables -A INPUT -s 127.0.0.1 -p ICMP -j DROP
it works fine but I'm trying to add this to /etc/sysconfig/iptables. I used the same syntax but when I reload iptables i get an error:

Applying iptables firewall rules: iptables-restore: line 2 failed

Is the syntax in the file different than on the commend line?
 
Old 11-20-2004, 01:19 AM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
If what MDK/FC store in /etc/sysconfig/iptables
is the result/input of an iptables-save/-restore
operation it's definitely different.

Those files aren't your normal shell-script kind
of firewall setup-scripts.

Try a
iptables-save | less
with a few rules active to see what I mean :)


Cheers,
Tink
 
Old 11-20-2004, 01:25 AM   #3
The_JinJ
Member
 
Registered: Apr 2004
Location: Scotland
Distribution: Suse, OpenWRT
Posts: 299

Original Poster
Rep: Reputation: 30
Quote:
Originally posted by Tinkster
If what MDK/FC store in /etc/sysconfig/iptables
is the result/input of an iptables-save/-restore
operation it's definitely different.

Those files aren't your normal shell-script kind
of firewall setup-scripts.

Try a
iptables-save | less
with a few rules active to see what I mean


Cheers,
Tink
Cheers Tinkster, I see what you mean....
Where do these rules save then and how do you write a file that contains them? Or am I missing something here?
 
Old 11-20-2004, 01:29 AM   #4
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
All you need to do is (once the firewall is doing what you
want it to do) as root:

iptables-save > /etc/sysconfig/iptables


:}


Cheers,
Tink
 
Old 11-20-2004, 01:31 AM   #5
The_JinJ
Member
 
Registered: Apr 2004
Location: Scotland
Distribution: Suse, OpenWRT
Posts: 299

Original Poster
Rep: Reputation: 30
Quote:
Originally posted by Tinkster
All you need to do is (once the firewall is doing what you
want it to do) as root:

iptables-save > /etc/sysconfig/iptables


:}


Cheers,
Tink
DOH!!! That's so obvious!! lol...cheers Tinkster!
 
Old 11-20-2004, 01:33 AM   #6
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
You're welcome mate :)


Cheers,
Tink
 
Old 11-20-2004, 01:40 AM   #7
The_JinJ
Member
 
Registered: Apr 2004
Location: Scotland
Distribution: Suse, OpenWRT
Posts: 299

Original Poster
Rep: Reputation: 30
In case anyone is looking in here, I found this good tutorial which explains it all - http://www.faqs.org/docs/iptables/index.html
 
  


Reply



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 in sysconfig?? Mibble Red Hat 6 10-16-2005 09:37 PM
numbers in /etc/sysconfig/iptables sti2envy Linux - Security 1 10-06-2005 08:24 AM
iptables -P vs :OUTPUT in /etc/sysconfig/iptables TomF Linux - Security 2 04-14-2005 10:50 PM
etc/sysconfig/iptables file explinations Junior24 Linux - General 3 12-07-2004 01:35 PM
My iptables script is /etc/sysconfig/iptables. How do i make this baby execute on boo ForumKid Linux - General 3 01-22-2002 07:36 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:11 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
Open Source Consulting | Domain Registration