Skip to contentSkip to conversation

simple question

DISCUSSION Askar 4 participants 6 messages Apr 27, 2005

lore
Share & tools
lore

Askar

author
#0 lore raw

hi list

If I put "iptables --policy FORWARD ACCEPT" , still I need a line i-e

iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT

Regards

Askar

Signature · 2 lines
I love deadlines. I like the whooshing sound they make as they fly by.
Douglas Adams
#1 lore raw

Yes or No, depends on your rules !!

Quoted 14 lines · Askar

hi list

If I put "iptables --policy FORWARD ACCEPT" , still I need a line i-e

iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT

Regards

Askar
--
I love deadlines. I like the whooshing sound they make as they fly by. Douglas Adams

Signature · 3 lines
Mohamed Eldesoky
www.eldesoky.net
RHCE
author
#2 lore raw

you mean if I have rules like

iptables -P FORWARD ACCEPT

iptables -A FORWARD -p tcp --dport 22 -j ACCEPT

Then putting ESTABLISHED,RELATED thing will helps? however why should I put ACCEPT rules in FORWARD when the default policy for it is already to accept everything.

thanks and regards

Askar

Quoted 23 lines · Mohamed Eldesoky

Yes or No, depends on your rules !!

Quoted 4 lines · Askar

hi list

If I put "iptables --policy FORWARD ACCEPT" , still I need a line i-e

Quoted 10 lines

iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT

Regards

Askar
--
I love deadlines. I like the whooshing sound they make as they fly by. Douglas Adams

--
Mohamed Eldesoky
www.eldesoky.net
RHCE

Signature · 2 lines
I love deadlines. I like the whooshing sound they make as they fly by.
Douglas Adams
#3 lore raw
Quoted 2 lines · Askar

you mean if I have rules like
iptables -P FORWARD ACCEPT

If you have this, then any ACCEPT rule will be useless. As simple as this.

Signature · 2 lines
http://sid.rstack.org/
PGP KeyID: 157E98EE FingerPrint: FA62226DA9E72FA8AECAA240008B480E157E98EE
Quoted 2 lines
Quoted 2 lines

Hi! I'm your friendly neighbourhood signature virus. Copy me to your signature file and help me spread!

#4 lore raw
Quoted 2 lines · Cedric Blancher

If you have this, then any ACCEPT rule will be useless. As simple as this.

Well, not quite.
It is, except if you want to rely on DROP/ACCEPT combinations to make exclusions and related stuff.

Signature · 2 lines
http://sid.rstack.org/
PGP KeyID: 157E98EE FingerPrint: FA62226DA9E72FA8AECAA240008B480E157E98EE
Quoted 2 lines
Quoted 2 lines

Hi! I'm your friendly neighbourhood signature virus. Copy me to your signature file and help me spread!

#5 lore raw
In reply to Askar
Quoted 5 lines · Askar

hi list

If I put "iptables --policy FORWARD ACCEPT" , still I need a line i-e

iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT

two thoughts:

1) if your last rule in the FORWARD chain is:

iptables -A FORWARD -j DROP

then your FORWARD chain POLICY will never be enforced, as all packets will be matched and dropped by the last rule. the only reason i bring this up is that i keep seeing rule sets that do this: POLICY set to ACCEPT and last rule set to DROP.

2) performance. the *vast* majority of packets will match the "-m state --state ESTABLISHED,RELATED" rule. putting it first in your built-in chains means that the vast majority of your packets will only have to traverse one rule before moving on. relying on the chain POLICY to match these packets means these packets have to traverse *every* rule before moving on. for large rule sets, this is just poor design.

final thought: setting the default policy of your firewall to ACCEPT isn't very good "firewalling," IMHO--but that's really more of philosophical debate than a technical one. no matter how permissive the rules end up being, I always start with a default deny, and then allow specific traffic.

-j

--
"Peter: You know, I oughta just give you some beer. Goes straight
through you.
Stewie: Wonderful. And while we're at it, we can light up a doobie and watch porn.
Peter: Eh... yeah?"
--Family Guy