LinuxQuestions.org
Review your favorite Linux distribution.
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 02-19-2010, 02:03 AM   #1
eboy98
Member
 
Registered: Oct 2007
Distribution: RHEL5
Posts: 64

Rep: Reputation: 15
Applying iptables firewall rules failed ?


Hello,

recently i upgrade my rhel5 kernel from 2.6.18-8.el5 to 2.6.25.Fact is now when i try to start iptables an error came out.

i was trying

Code:
#/etc/init.d/iptables start
Flushing firewall rules:                                   [  OK  ]
Setting chains to policy ACCEPT: filter                    [  OK  ]
Unloading iptables modules:                                [  OK  ]
Applying iptables firewall rules:                          [FAILED]
I did not make any change with /etc/sysconfig/iptables file.Moreover after i got this error i use the following command system-config-securitylevel and change according to my need then i try to start again but no luck.

can any one give me a little hint.



Thanks.
 
Old 02-19-2010, 02:25 AM   #2
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
What happens if you apply the configuration manually? Like:
Code:
iptables-restore < /etc/sysconfig/iptables
Does it provide you with an error line number?

I've had sudden load failures of this kind happen to me (without having edited the configuration file) after having deleted a user account for which an iptables rule had been previously created. The configuration would fail to load, due to the non-existent user account. It's just an example, though - there's plenty other reasons why an iptables configuration can fail to load.

Last edited by win32sux; 02-19-2010 at 02:35 AM. Reason: Spelling.
 
Old 02-19-2010, 02:33 AM   #3
eboy98
Member
 
Registered: Oct 2007
Distribution: RHEL5
Posts: 64

Original Poster
Rep: Reputation: 15
Code:
# iptables-restore < /etc/sysconfig/iptables
iptables-restore: line 21 failed
i checked /etc/sysconfig/iptables file line 21 it contain COMMIT

what does this mean?

Last edited by eboy98; 02-19-2010 at 02:36 AM.
 
Old 02-19-2010, 02:34 AM   #4
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
Quote:
Originally Posted by eboy98 View Post
Code:
# iptables-restore < /etc/sysconfig/iptables
iptables-restore: line 21 failed
Great! So what does line 21 have?
 
Old 02-19-2010, 02:39 AM   #5
eboy98
Member
 
Registered: Oct 2007
Distribution: RHEL5
Posts: 64

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by win32sux View Post
Great! So what does line 21 have?
i checked /etc/sysconfig/iptables file line 21 it contain COMMIT
 
Old 02-19-2010, 02:42 AM   #6
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
Quote:
Originally Posted by eboy98 View Post
i checked /etc/sysconfig/iptables file line 21 it contain COMMIT

what does this mean?
To quote Andreasson, it means that "at this point we should commit all rules currently in the pipeline to kernel". So perhaps you could show us everything above this COMMIT?
 
Old 02-19-2010, 02:45 AM   #7
eboy98
Member
 
Registered: Oct 2007
Distribution: RHEL5
Posts: 64

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by win32sux View Post
To quote Andreasson, it means that "at this point we should commit all rules currently in the pipeline to kernel". So perhaps you could show us everything above this COMMIT?


Code:
# Firewall configuration written by system-config-securitylevel
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:RH-Firewall-1-INPUT - [0:0]
-A INPUT -j RH-Firewall-1-INPUT
-A FORWARD -j RH-Firewall-1-INPUT
-A RH-Firewall-1-INPUT -i lo -j ACCEPT
-A RH-Firewall-1-INPUT -p icmp --icmp-type any -j ACCEPT
-A RH-Firewall-1-INPUT -p 50 -j ACCEPT
-A RH-Firewall-1-INPUT -p 51 -j ACCEPT
-A RH-Firewall-1-INPUT -p udp --dport 5353 -d 224.0.0.251 -j ACCEPT
-A RH-Firewall-1-INPUT -p udp -m udp --dport 631 -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m tcp --dport 631 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 2049 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A RH-Firewall-1-INPUT -j REJECT --reject-with icmp-host-prohibited 
COMMIT
 
Old 02-19-2010, 03:02 AM   #8
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
This new kernel, you compiled it yourself?
 
Old 02-19-2010, 03:06 AM   #9
eboy98
Member
 
Registered: Oct 2007
Distribution: RHEL5
Posts: 64

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by win32sux View Post
This new kernel, you compiled it yourself?
yes
 
Old 02-19-2010, 03:12 AM   #10
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
Quote:
Originally Posted by eboy98 View Post
yes
I suspect this could be related to your kernel config (specifically, with regards to the Netfilter modules selected). In other words, a module which was present in the RHEL kernel package, but isn't present in your home-brewed solution. Of course, I'm not sure about this. Could you verify that the Netfilter settings in the config you used to compile are in line with RHEL's? That's pretty much all that occurs to me right now.
 
Old 02-19-2010, 03:23 AM   #11
eboy98
Member
 
Registered: Oct 2007
Distribution: RHEL5
Posts: 64

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by win32sux View Post
I suspect this could be related to your kernel config (specifically, with regards to the Netfilter modules selected). In other words, a module which was present in the RHEL kernel package, but isn't present in your home-brewed solution. Of course, I'm not sure about this. Could you verify that the Netfilter settings in the config you used to compile are in line with RHEL's? That's pretty much all that occurs to me right now.
One thing my learning stage with Linux is still novice could you please explain me how to check Netfilter setting.Though i am using google right now to find about Netfilter.
 
Old 02-19-2010, 03:30 AM   #12
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
You could grep the config file you used, for strings like CONFIG_NF_ and NETFILTER, for example.

BTW, it may help if you try each of those rules manually at the command line, in an effort to spot which one (if any) is causing the failure. I think this would be easier to troubleshoot with that information in hand.

Last edited by win32sux; 02-19-2010 at 03:38 AM.
 
  


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] - Applying rules to a specific local IP? lew Linux - Networking 1 08-10-2009 01:55 AM
Applying iptables rules / don't seem to work once I change them jonwondering Linux - Newbie 24 10-24-2008 09:40 PM
Iptables rules for basic firewall winxandlinx Linux - Security 7 10-27-2006 07:12 AM
Applying iptables rules to multiple subnets eggi Linux - Networking 2 01-04-2006 10:29 PM
Applying firewall rules to user account Beerer Linux - Security 0 01-10-2005 03:42 PM

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

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