LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 11-15-2005, 12:15 AM   #1
srnerkar1
Member
 
Registered: Nov 2005
Location: nagpur
Posts: 33

Rep: Reputation: 15
Lightbulb cant setup iptables


hello all there,
i am suffuring a problem while going for the firewalls using the iptables...... While installing (RedHat 9) i had choosen the no-firewall option but now i want to setup those. According to that i wrote 3 policy rules for INPUT,OUTPUT and FORWORED in file /etc/sysconfig/iptables (innitially that file was not present).
After writting rules when i try command "service iptables restart" it shows an error problem at first line for file /etc/sysconfig/iptables.
So what should be the problem???????
Is there any solution for that????



Expecting a quick reply!!!!!! PLEASE Help me..........
 
Old 11-15-2005, 01:14 AM   #2
nhs
Member
 
Registered: Aug 2003
Location: Edinburgh, Scotland
Distribution: Gentoo
Posts: 246

Rep: Reputation: 30
Don't create the file /etc/sysconfig/iptables by hand. Set up the firewall using iptables so that the current running firewall is what you want to keep and then execute "iptables-save >/etc/sysconfig/iptables" to write the file.

The init scripts will then execute iptables-restore which reads the format iptables-save creates. The man pages for iptables/iptables-save/iptables-restore are also worth a look (not that iptables-save/iptables-restore have much by way of options but as a description of how they function...).

Hope that clarifies things.

Last edited by nhs; 11-15-2005 at 01:15 AM.
 
Old 11-15-2005, 03:50 AM   #3
srnerkar1
Member
 
Registered: Nov 2005
Location: nagpur
Posts: 33

Original Poster
Rep: Reputation: 15
failed to understand....help again plzzzz

hello sir thanks for the quick reply.......
i understood that i should use iptables-save command to dump the rule of iptables but did not come to understand that where should i write or mention rules of iptables so that i would run command "iptables-save > /etc/sysconfig "? and how the /etc/sysconfig/iptables would get created after running the same command......
Thank you onces again..................................
 
Old 11-15-2005, 05:01 AM   #4
nhs
Member
 
Registered: Aug 2003
Location: Edinburgh, Scotland
Distribution: Gentoo
Posts: 246

Rep: Reputation: 30
iptables-save dumps the current iptables configuration to standard output. The >/etc/sysconfig/iptables redirects this to the file /etc/sysconfig/iptables (which the init scripts will later read). iptables-save >/etc/sysconfig won't work as /etc/sysconfig is a directory (and even if it were a file the init scripts won't look for the iptables config there) you need the full path /etc/sysconfig/iptables (as stated the command "iptables-save >/etc/sysconfig/iptables" should do the trick). The command "cat /etc/sysconfig/iptables" will allow you to see the result of running the previous command.
 
Old 11-15-2005, 07:54 AM   #5
srnerkar1
Member
 
Registered: Nov 2005
Location: nagpur
Posts: 33

Original Poster
Rep: Reputation: 15
does /etc/sysconfig/iptables file get created automatically.....

thanks sir....
I got the command but the question arrised in my mind that does the file "/etc/sysconfig/iptables" get created automatically??????....... and if yes then where should i write my all iptables rules so that i can run the command "iptables-save > /etc/sysconfig/iptables" to create that file automatically.......
Sir what i mean to say that should i create a new file(rather than /etc/sysconfig/iptables) consisting of all rules like INPUT,FORWORD,OUTPUT etc. and do anything so that the rules in the file get redirected in /etc/sysconfig/iptables?????????????
Thanks for ur valuable time...........
 
Old 11-15-2005, 01:10 PM   #6
simcox1
Member
 
Registered: Mar 2005
Location: UK
Distribution: Slackware
Posts: 794
Blog Entries: 2

Rep: Reputation: 30
If your getting errors it may just be because there's an error in the script. For example it's FORWARD not FORWORD.
 
Old 11-17-2005, 06:02 AM   #7
srnerkar1
Member
 
Registered: Nov 2005
Location: nagpur
Posts: 33

Original Poster
Rep: Reputation: 15
thank you sir for your valuable support

thank you sir for ur contrubution.... Sir here i managed to build certain rules for my linux PC using IPTABLES............. One lask question from my side if I would managed to build software router using Linux System, then will tere be requirement of CISCO routers.......
Will the Linux system Router replace CISCO one...........
THANKS FOR UR VALUABLE TIME...............SIR
 
  


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 setup peok Linux - Networking 5 11-11-2003 11:00 PM
iptables setup chrismiceli Linux - Networking 2 07-01-2003 08:18 AM
iptables setup bwarn Linux - Networking 1 04-09-2003 01:11 PM
iptables setup Tayl Linux - Networking 4 02-25-2003 09:13 PM
just need to setup IPTables and I'm done, but..... SprinterPD Linux - Networking 2 09-24-2001 06:11 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 06:50 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