Linux Netfilter discussions
 help / color / mirror / Atom feed
* can i have boolean OR between multiple addresses in iptables expression?
@ 2006-06-09  0:32 prosolutions
  2006-06-09 13:18 ` can i have boolean OR between multiple addresses in iptablesexpression? Pablo Sanchez
  0 siblings, 1 reply; 4+ messages in thread
From: prosolutions @ 2006-06-09  0:32 UTC (permalink / raw)
  To: netfilter



for example i would like to have a rule with -s !127.0.0.1 OR !172.16.0.0/24   

how can this be done?


-- 
.. Synthetic a-priori judgements should not be patentable ..



^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: can i have boolean OR between multiple addresses in iptablesexpression?
  2006-06-09  0:32 can i have boolean OR between multiple addresses in iptables expression? prosolutions
@ 2006-06-09 13:18 ` Pablo Sanchez
  2006-06-10  7:34   ` can i have boolean OR between multiple addresses in iptables expression? Pascal Hambourg
  0 siblings, 1 reply; 4+ messages in thread
From: Pablo Sanchez @ 2006-06-09 13:18 UTC (permalink / raw)
  To: netfilter

 

> -----Original Message-----
> From: netfilter-bounces@lists.netfilter.org 
> [mailto:netfilter-bounces@lists.netfilter.org] On Behalf Of 
> prosolutions@gmx.net
> Sent: Thursday, June 08, 2006 8:33 PM
> To: netfilter@lists.netfilter.org
> Subject: can i have boolean OR between multiple addresses in 
> iptablesexpression?
> 
> 
> 
> for example i would like to have a rule with -s !127.0.0.1 OR 
> !172.16.0.0/24   

I believe you can't.  What I've done is simply create several rules with the
predicate slightly different in each to accomplish an OR.  If you'd like to
make it obvious, you can create a new chain and place your different rules
there.
---
Pablo Sanchez - Blueoak Database Engineering, Inc
Ph:    819.459.1926          Toll free:  888.459.1926
Cell:  819.918.9731                Pgr:  pablo_p@blueoakdb.com
Fax:   603.720.7723 (US)           Fax:  514.371.1255 (Canada)



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: can i have boolean OR between multiple addresses in iptables expression?
  2006-06-09 13:18 ` can i have boolean OR between multiple addresses in iptablesexpression? Pablo Sanchez
@ 2006-06-10  7:34   ` Pascal Hambourg
  2006-06-10 10:56     ` Pablo Sanchez
  0 siblings, 1 reply; 4+ messages in thread
From: Pascal Hambourg @ 2006-06-10  7:34 UTC (permalink / raw)
  To: netfilter

Hello,

Pablo Sanchez a écrit :
>>
>>for example i would like to have a rule with -s !127.0.0.1 OR 
>>!172.16.0.0/24   
> 
> I believe you can't.  What I've done is simply create several rules with the
> predicate slightly different in each to accomplish an OR.  If you'd like to
> make it obvious, you can create a new chain and place your different rules
> there.

I think that using a user defined chain is not only a matter of 
obviousness, in some case the result may be different from using two 
separate rules. For example :

iptables -A INPUT -s 127.0.0.1 -m limit -j ACCEPT
iptables -A INPUT -s 172.16.0.0/24 -m limit -j ACCEPT

and :

iptables -A INPUT -s 127.0.0.1 -j user_chain
iptables -A INPUT -s 172.16.0.0/24 -j user_chain
iptables -A user_chain -m limit -j ACCEPT

behave differently because, if I understand correctly, each 'limit' 
match has its own counters and timers. Am I right ?


^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: can i have boolean OR between multiple addresses in iptables expression?
  2006-06-10  7:34   ` can i have boolean OR between multiple addresses in iptables expression? Pascal Hambourg
@ 2006-06-10 10:56     ` Pablo Sanchez
  0 siblings, 0 replies; 4+ messages in thread
From: Pablo Sanchez @ 2006-06-10 10:56 UTC (permalink / raw)
  To: netfilter

 

> -----Original Message-----
> From: netfilter-bounces@lists.netfilter.org 
> [mailto:netfilter-bounces@lists.netfilter.org] On Behalf Of 
> Pascal Hambourg
> Sent: Saturday, June 10, 2006 3:34 AM
> To: netfilter@lists.netfilter.org
> Subject: Re: can i have boolean OR between multiple addresses 
> in iptables expression?
> 
> I think that using a user defined chain is not only a matter of 
> obviousness, in some case the result may be different from using two 
> separate rules. For example :
> 
> iptables -A INPUT -s 127.0.0.1 -m limit -j ACCEPT
> iptables -A INPUT -s 172.16.0.0/24 -m limit -j ACCEPT
> 
> and :
> 
> iptables -A INPUT -s 127.0.0.1 -j user_chain
> iptables -A INPUT -s 172.16.0.0/24 -j user_chain
> iptables -A user_chain -m limit -j ACCEPT
> 
> behave differently because, if I understand correctly, each 'limit' 
> match has its own counters and timers. Am I right ?

Absolutely.  You do have to be certain to 'play computer' correctly when you
write the rules.  Know that each rule is an AND and apply OR's correctly
with judicious use of the -j ACCEPT target.
---
Pablo Sanchez - Blueoak Database Engineering, Inc
Ph:    819.459.1926          Toll free:  888.459.1926
Cell:  819.918.9731                Pgr:  pablo_p@blueoakdb.com
Fax:   603.720.7723 (US)           Fax:  514.371.1255 (Canada)



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-06-10 10:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-06-09  0:32 can i have boolean OR between multiple addresses in iptables expression? prosolutions
2006-06-09 13:18 ` can i have boolean OR between multiple addresses in iptablesexpression? Pablo Sanchez
2006-06-10  7:34   ` can i have boolean OR between multiple addresses in iptables expression? Pascal Hambourg
2006-06-10 10:56     ` Pablo Sanchez

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox