Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Martijn Lievaart <m@rtij.nl>
To: Vitaly <vitaly_il@yahoo.com>
Cc: netfilter@lists.netfilter.org
Subject: Re: How to combine a few  addresses?
Date: Tue, 11 Sep 2007 19:50:15 +0200	[thread overview]
Message-ID: <46E6D557.7050204@rtij.nl> (raw)
In-Reply-To: <554137.97540.qm@web60322.mail.yahoo.com>

Vitaly wrote:
> --- Martijn Lievaart <m@rtij.nl> wrote:
>
>   
>> Vitaly wrote:
>>     
>>> How I can combine a few addresses in one rule? For
>>> example, I'd like to add two IPs 10.10.10.1 and
>>> 10.10.10.2 to the same rule.
>>>
>>>   
>>>       
>> Either use ipset (needs a patched kernel), or
>> iprange (if the addresses 
>> are consecutive) or use a subchain, e.g:
>>
>> -A -s 10.10.10.1 -j CUSTOM
>> -A -s 10.10.10.2 -j CUSTOM
>> -N CUSTOM
>> -A CUSTOM <rest of rule>
>>
>>     
> Thank you!
> Subchains seem to be OK for my needs. But will
> subchains work in case when I need to *exclude* some
> IPs?
>
> For example, can I add 10.10.10.2 to this rule using
> subchain?
>
> iptables -I INPUT -p tcp --dport 80  ! -s 10.10.10.1  
> -m state --state NEW -m recent --set
>   

Yes.

-I INPUT -p tcp --dport 80  -j CUSTOM
-A CUSTOM -s 10.10.10.1 -j RETURN
-A CUSTOM -s 10.10.10.2 -j RETURN
-A CUSTOM -m state --state NEW -m recent --set


HTH,
M4




  reply	other threads:[~2007-09-11 17:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-11 11:52 How to combine a few addresses? Vitaly
2007-09-11 12:01 ` Martijn Lievaart
2007-09-11 12:27   ` Vitaly
2007-09-11 17:50     ` Martijn Lievaart [this message]
2007-09-17 10:39       ` Kernel crash. Are ipt_recent and ipt_conntrack culprit? Vitaly

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=46E6D557.7050204@rtij.nl \
    --to=m@rtij.nl \
    --cc=netfilter@lists.netfilter.org \
    --cc=vitaly_il@yahoo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox