All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: John Lister <john.lister@kickstone.com>
Cc: netfilter@vger.kernel.org
Subject: Re: Problem with statistic module nth mode
Date: Tue, 25 Aug 2009 14:48:32 +0200	[thread overview]
Message-ID: <4A93DDA0.6000900@trash.net> (raw)
In-Reply-To: <58261217A1E14FCCB2F0CF27FA977252@squarepi.com>

John Lister wrote:
> Hi, I have a set of rules as follows
> 
> iptables -t nat -N SNAT1
> iptables -t nat -A SNAT1 -m statistic --mode nth --every 5 --packet 0 -j
> SNAT --to-source 87.194.x.1
> iptables -t nat -A SNAT1 -m statistic --mode nth --every 5 --packet 1 -j
> SNAT --to-source 87.194.x.2
> iptables -t nat -A SNAT1 -m statistic --mode nth --every 5 --packet 2 -j
> SNAT --to-source 87.194.x.3
> iptables -t nat -A SNAT1 -m statistic --mode nth --every 5 --packet 3 -j
> SNAT --to-source 87.194.x.4
> iptables -t nat -A SNAT1 -m statistic --mode nth --every 5 --packet 4 -j
> SNAT --to-source 87.194.x.5
> 
> iptables -t nat -A POSTROUTING -o eth1 -j SNAT1
> ...
> iptables -t nat -A POSTROUTING -o eth1 -j LOG --log-prefix "Failed to nat"
> 
> 
> The last rule is occasionally triggered, is this a bug? I could put a
> catch all there, but the 5 "nth" rules should cover all possible cases
> or have I missed something obvious??

This is a common misunderstanding - the counters are not shared and
since the rules are all terminal, the second rule will only see the
packets not caught by the first rule etc. So the proportions need to
be adjusted for the "missing" packets:

... --mode nth --every 5 ...
... --mode nth --every 4 ...
... --mode nth --every 3 ...
... --mode nth --every 2 ...
... <unconditional> ...

  reply	other threads:[~2009-08-25 12:48 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-25 11:33 really need your help about iptables J. Bakshi
2009-08-25 12:27 ` Problem with statistic module nth mode John Lister
2009-08-25 12:48   ` Patrick McHardy [this message]
2009-08-25 12:55     ` John Lister
2009-09-02  9:23     ` Checking line status John Lister
2009-09-02 10:23       ` Gáspár Lajos
2009-09-02 11:21         ` John Lister
2009-09-02 12:47       ` Thomas Jacob
2009-09-02 13:54         ` John Lister
2009-09-02 14:02         ` John Lister
2009-09-02 14:29           ` Pascal Hambourg
2009-09-02 14:42             ` John Lister
2009-09-02 15:16               ` Pascal Hambourg
2009-09-02 16:48                 ` John Lister
2009-09-02 14:30           ` Thomas Jacob
2009-09-02 15:02             ` John Lister
2009-09-02 14:13       ` Tormod Nygård
2009-08-25 14:09 ` really need your help about iptables Oskar Berggren
2009-08-26 12:14   ` J. Bakshi
2009-08-26 12:36     ` Re:[possible solution] " J. Bakshi

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=4A93DDA0.6000900@trash.net \
    --to=kaber@trash.net \
    --cc=john.lister@kickstone.com \
    --cc=netfilter@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.