Networking Forums

Networking Forums > Computer Networking > Linux Networking > How does Iptables ........

Reply
Thread Tools Display Modes

How does Iptables ........

 
 
lekkie.aydot@gmail.com
Guest
Posts: n/a

 
      07-28-2005, 06:24 PM
How does iptables rules work? Does it read all the rules and if non
matches applies the default rule (iptables -P Chain -j rule) or it
executes the rule according to the order in which they are arranged.

 
Reply With Quote
 
 
 
 
Ian Northeast
Guest
Posts: n/a

 
      07-28-2005, 06:43 PM
On Thu, 28 Jul 2005 11:24:37 -0700, (E-Mail Removed) wrote:

> How does iptables rules work? Does it read all the rules and if non
> matches applies the default rule (iptables -P Chain -j rule) or it
> executes the rule according to the order in which they are arranged.


It starts at the first rule in the chain and progresses down. If it
encounters a -j rule (except -j LOG) it jumps to that target, and ignores
the rest of the chain. If it falls off the bottom of the chain the policy
(-P) is applied.

Regards, Ian

 
Reply With Quote
 
Llanzlan Klazmon
Guest
Posts: n/a

 
      07-29-2005, 01:23 AM
Ian Northeast <(E-Mail Removed)> wrote in
news(E-Mail Removed):

> On Thu, 28 Jul 2005 11:24:37 -0700, (E-Mail Removed) wrote:
>
>> How does iptables rules work? Does it read all the rules and if non
>> matches applies the default rule (iptables -P Chain -j rule) or it
>> executes the rule according to the order in which they are arranged.

>
> It starts at the first rule in the chain and progresses down. If it
> encounters a -j rule (except -j LOG) it jumps to that target, and
> ignores the rest of the chain. If it falls off the bottom of the chain
> the policy (-P) is applied.
>
> Regards, Ian
>
>


A comment on this. It is a good idea to have a rule that accepts
continuation packets as early in the chain as possible. That way the
bulk of traffic (assuming that most packets are part of an existing
connection) is dealt with using the minimum processing overhead. So you
want a rule like:

IPTABLES -A <chain name> -m state --state RELATED,ESTABLISHED -j ACCEPT

Hit as early on as possible.

Klazmon.
 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
about iptables junaidaslam Linux Networking 3 08-29-2005 09:35 PM
Looking for iptables applications code (iptables.c) to run some rules to forward packets tvnaidu@yahoo.com Linux Networking 2 01-17-2005 05:01 PM
iptables Bernd Roth Linux Networking 5 01-16-2005 05:53 PM
iptables and nat Marcin Giedz Linux Networking 5 07-06-2004 07:05 AM
iptables "can't initialize iptables table `filter'" pete Linux Networking 1 10-10-2003 03:44 AM



1 2 3 4 5 6 7 8 9 10 11