Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Stateful Inspection of packets with iptables
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
gthank
n00b
n00b


Joined: 08 Feb 2005
Posts: 15

PostPosted: Fri Feb 11, 2005 7:09 pm    Post subject: Stateful Inspection of packets with iptables Reply with quote

I've got almost everything set up on my server here at work, but when iptables is running, I can't do things like DNS. I suspect this is because I'm denying everything by default and only allowing specific protocols through the firewall. I'm trying to set my INPUT chain to accept packets that are ESTABLISHED or RELATED, but iptables won't let me add the rule. Here's the command I'm using.
Code:
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT

Thanks for any help.

gthank
_________________
". . . from hell's heart I stab at thee; for hate's sake I spit my last breath at thee."
Back to top
View user's profile Send private message
tdemarest
Tux's lil' helper
Tux's lil' helper


Joined: 18 Mar 2003
Posts: 99
Location: California, USA

PostPosted: Sat Feb 12, 2005 6:02 am    Post subject: Reply with quote

That's the same line I have. Are you sure the error is happening with this particular line, or some earlier line?
Back to top
View user's profile Send private message
gthank
n00b
n00b


Joined: 08 Feb 2005
Posts: 15

PostPosted: Sat Feb 12, 2005 8:09 am    Post subject: That's the line Reply with quote

In fact, it's the only line I'm executing. I'm trying to add one rule to an existing (functioning) instance of iptables.

gthank
_________________
". . . from hell's heart I stab at thee; for hate's sake I spit my last breath at thee."
Back to top
View user's profile Send private message
nightblade
Guru
Guru


Joined: 20 Jul 2004
Posts: 368
Location: back from SE Asia

PostPosted: Sat Feb 12, 2005 9:14 am    Post subject: Re: Stateful Inspection of packets with iptables Reply with quote

gthank wrote:
iptables won't let me add the rule.

What error message do you get ?
_________________
In God we trust. All the others must provide a valid X.509 certificate
Back to top
View user's profile Send private message
markkuk
Guru
Guru


Joined: 29 Nov 2002
Posts: 446

PostPosted: Sat Feb 12, 2005 12:50 pm    Post subject: Reply with quote

Remember that "iptables -A" adds the rule at the end of the chain, if there are any rules with REJECT, DROP or jumps to different chains before it the new rule will have no effect. Try inserting the rule at the head of the chain with "iptables -I"
Back to top
View user's profile Send private message
gthank
n00b
n00b


Joined: 08 Feb 2005
Posts: 15

PostPosted: Sun Feb 13, 2005 12:23 am    Post subject: error message when trying to add state inspection rule Reply with quote

Would you believe I proofread that post like 3 times and still didn't notice that I'd forgotten to paste in the error? Anyway, when I try to add the rule (it doesn't matter whether I'm inserting or appending), I get the following error:
    iptables: No chain/target/match by that name

Thanks again for all the help,

gthank

P.S. I'm using a cut-and-paste to put in the exact command I'm executing

Code:
iptables -I INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT

or
Code:
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT

_________________
". . . from hell's heart I stab at thee; for hate's sake I spit my last breath at thee."
Back to top
View user's profile Send private message
tdemarest
Tux's lil' helper
Tux's lil' helper


Joined: 18 Mar 2003
Posts: 99
Location: California, USA

PostPosted: Sun Feb 13, 2005 12:45 am    Post subject: Reply with quote

I did a little of googling on this and the most promising item I found was to make sure the ipt_state option is built as a module or into your kernel. Make sure that you have the following enabled:

cd /usr/src/linux
make menuconfig (or your favorite kernel configurator)
Locate:
Device->Networking->Networking Options->Network packet filtering->IP: Netfilter Configuration->IP Tables support->

[*] Connection state match support
[*] Connection tracking match support

If not, enable, recompile, install new kernel and reboot.
Back to top
View user's profile Send private message
gthank
n00b
n00b


Joined: 08 Feb 2005
Posts: 15

PostPosted: Sun Feb 13, 2005 4:42 am    Post subject: promising lead Reply with quote

Thanks! I didn't have those options enabled because they weren't listed under the iptables section until I enabled another option that said it was required for NAT/Masq. Since I'm not doing any of that, I had it disabled to avoid cluttering up the kernel. The kernel is compiling at the moment, but I'm pretty sure this will fix that problem. With a little good luck, the next time I post I'll be able to report having a fully functional server. Thanks again.

gthank
_________________
". . . from hell's heart I stab at thee; for hate's sake I spit my last breath at thee."
Back to top
View user's profile Send private message
gthank
n00b
n00b


Joined: 08 Feb 2005
Posts: 15

PostPosted: Mon Feb 14, 2005 3:02 pm    Post subject: It's ALIVE!!! Reply with quote

Everything is, to quote Chico, "lookin' good!" Thanks again for all the help everyone.

gthank
_________________
". . . from hell's heart I stab at thee; for hate's sake I spit my last breath at thee."
Back to top
View user's profile Send private message
tdemarest
Tux's lil' helper
Tux's lil' helper


Joined: 18 Mar 2003
Posts: 99
Location: California, USA

PostPosted: Tue Feb 15, 2005 3:40 pm    Post subject: Reply with quote

Sounds great. Glad to hear you fixed your problem.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum