Linux Netfilter discussions
 help / color / mirror / Atom feed
From: "Rob Sterenborg" <rob@sterenborg.info>
To: netfilter@lists.netfilter.org
Subject: RE: how can i combine these 2 iprules
Date: Fri, 5 Mar 2004 20:17:14 +0100	[thread overview]
Message-ID: <20040305191716.DD886DBC@sterenborg.info> (raw)
In-Reply-To: <3590.128.59.176.161.1078512825.squirrel@sojourn.dyndns.org>

> > On Friday 05 March 2004 6:27 pm, Technical wrote:
> >
> >> -A RH-Firewall-1-INPUT ! -s cnnp1.com  -j LOG --log-prefix 
> "IPTABLES: "
> >> -A RH-Firewall-1-INPUT ! -s cnnp2.com  -j LOG --log-prefix 
> "IPTABLES: "
> >
> > iptables -N mychain
> > iptables -A mychain -s cnnp1.com  -j RETURN
> > iptables -A mychain -s cnnp2.com  -j RETURN
> > iptables -A mychain -j LOG --log-prefix "IPTABLES: "
> > iptables -A RH-Firewall-1-INPUT -j mychain
>
> What is -j Return doing

Your match is reversed.
You matched everything that does not cnnp1.com and LOGged it. After that you
matched everything that does not match cnnp2.com and LOGged it.
So, you logged everything that matched cnnp1.com or cnnp2.com once, else
twice.

Antony's solution redirects a packet to the "mychain" user chain.
If a packet matches either cnnp1.com or cnnp2.com, it RETURNs to the
"RH-Firewall-1-INPUT" chain.
If a packet didn't match, it gets logged and the "mychain" chain ends, thus
the packet returns to the chain that called it ; the "RH-Firewall-1-INPUT"
chain.


Gr,
Rob



  reply	other threads:[~2004-03-05 19:17 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-05 18:27 how can i combine these 2 iprules Technical
2004-03-05 18:33 ` Antony Stone
2004-03-05 18:53   ` Technical
2004-03-05 19:17     ` Rob Sterenborg [this message]
2004-03-05 20:04       ` Technical
2004-03-05 20:24         ` Antony Stone
2004-03-05 23:16 ` Luciano Miguel Ferreira Rocha

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=20040305191716.DD886DBC@sterenborg.info \
    --to=rob@sterenborg.info \
    --cc=netfilter@lists.netfilter.org \
    /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