Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Grant Taylor <gtaylor@riverviewtech.net>
To: Mail List - Netfilter <netfilter@vger.kernel.org>
Subject: Re: limit module
Date: Wed, 30 Jan 2008 12:02:17 -0600	[thread overview]
Message-ID: <47A0BBA9.3020703@riverviewtech.net> (raw)
In-Reply-To: <20080130161344.GA33214@diabolo.evga.ru>

On 01/30/08 10:13, Alexey Vlasov wrote:
> # iptables -A INPUT -p tcp -s 111.222.111.222 --syn -m limit --limit 1/s
> --limit-burst 50 -j ACCEPT
> # iptables -A INPUT -p tcp -s 111.222.111.222 --syn -m limit
> --limit-burst 1000 -j LOG
> 
> Do I understand right that according to the first rule through it can
> pass only 50 SYN packets per second. If I am right, then it can be
> checked like this: I launch 50 times all at once "telnet dst_host 80" and
> look at the counter:

It is my (mis)understanding that the limit match extension will allow 
the rate of packets specified with a possible burst of what ever is left 
over out of the burst buffer (if you will).  If there are no packets 
matching the rule, they number of packets that did not come through goes 
in to the burst buffer up to the point the burst buffer is full.

Think of it this way:  You have a bucket that burst buffer in size that 
is filled at limit speed.  You can take packets out of the bucket as 
fast as possible (burst) up to the point that there are no more packets 
in the bucket.  Once the bucket is empty, you can only take the packets 
out of the bucket as fast as they are replenished, thus the limit speed.

The burst is intended to allow short infrequent requests to pass as fast 
as possible up to the limit of a grace (burst).  Once the grace (burst) 
is exceeded, start rate limiting the requests.

> Here goes that 50 packets came, but why only 16 came through the first
> rule?

With out knowing the timing on your tests (down to the millisecond) I 
can only guess.  I'd say that your tests were off based on timing 
between multiple runs.  Had you said X number of packets per minute you 
may be able to get a more accurate test.



Grant. . . .

      reply	other threads:[~2008-01-30 18:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-30 16:13 limit module Alexey Vlasov
2008-01-30 18:02 ` Grant Taylor [this message]

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=47A0BBA9.3020703@riverviewtech.net \
    --to=gtaylor@riverviewtech.net \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox