Blame extensions/libxt_hashlimit.man

Packit 7b22a4
\fBhashlimit\fP uses hash buckets to express a rate limiting match (like the
Packit 7b22a4
\fBlimit\fP match) for a group of connections using a \fBsingle\fP iptables
Packit 7b22a4
rule. Grouping can be done per-hostgroup (source and/or destination address)
Packit 7b22a4
and/or per-port. It gives you the ability to express "\fIN\fP packets per time
Packit 7b22a4
quantum per group" or "\fIN\fP bytes per seconds" (see below for some examples).
Packit 7b22a4
.PP
Packit 7b22a4
A hash limit option (\fB\-\-hashlimit\-upto\fP, \fB\-\-hashlimit\-above\fP) and
Packit 7b22a4
\fB\-\-hashlimit\-name\fP are required.
Packit 7b22a4
.TP
Packit 7b22a4
\fB\-\-hashlimit\-upto\fP \fIamount\fP[\fB/second\fP|\fB/minute\fP|\fB/hour\fP|\fB/day\fP]
Packit 7b22a4
Match if the rate is below or equal to \fIamount\fP/quantum. It is specified either as
Packit 7b22a4
a number, with an optional time quantum suffix (the default is 3/hour), or as
Packit 7b22a4
\fIamount\fPb/second (number of bytes per second).
Packit 7b22a4
.TP
Packit 7b22a4
\fB\-\-hashlimit\-above\fP \fIamount\fP[\fB/second\fP|\fB/minute\fP|\fB/hour\fP|\fB/day\fP]
Packit 7b22a4
Match if the rate is above \fIamount\fP/quantum.
Packit 7b22a4
.TP
Packit 7b22a4
\fB\-\-hashlimit\-burst\fP \fIamount\fP
Packit 7b22a4
Maximum initial number of packets to match: this number gets recharged by one
Packit 7b22a4
every time the limit specified above is not reached, up to this number; the
Packit 7b22a4
default is 5.  When byte-based rate matching is requested, this option specifies
Packit 7b22a4
the amount of bytes that can exceed the given rate.  This option should be used
Packit 7b22a4
with caution -- if the entry expires, the burst value is reset too.
Packit 7b22a4
.TP
Packit 7b22a4
\fB\-\-hashlimit\-mode\fP {\fBsrcip\fP|\fBsrcport\fP|\fBdstip\fP|\fBdstport\fP}\fB,\fP...
Packit 7b22a4
A comma-separated list of objects to take into consideration. If no
Packit 7b22a4
\-\-hashlimit\-mode option is given, hashlimit acts like limit, but at the
Packit 7b22a4
expensive of doing the hash housekeeping.
Packit 7b22a4
.TP
Packit 7b22a4
\fB\-\-hashlimit\-srcmask\fP \fIprefix\fP
Packit 7b22a4
When \-\-hashlimit\-mode srcip is used, all source addresses encountered will be
Packit 7b22a4
grouped according to the given prefix length and the so-created subnet will be
Packit 7b22a4
subject to hashlimit. \fIprefix\fP must be between (inclusive) 0 and 32. Note
Packit 7b22a4
that \-\-hashlimit\-srcmask 0 is basically doing the same thing as not specifying
Packit 7b22a4
srcip for \-\-hashlimit\-mode, but is technically more expensive.
Packit 7b22a4
.TP
Packit 7b22a4
\fB\-\-hashlimit\-dstmask\fP \fIprefix\fP
Packit 7b22a4
Like \-\-hashlimit\-srcmask, but for destination addresses.
Packit 7b22a4
.TP
Packit 7b22a4
\fB\-\-hashlimit\-name\fP \fIfoo\fP
Packit 7b22a4
The name for the /proc/net/ipt_hashlimit/foo entry.
Packit 7b22a4
.TP
Packit 7b22a4
\fB\-\-hashlimit\-htable\-size\fP \fIbuckets\fP
Packit 7b22a4
The number of buckets of the hash table
Packit 7b22a4
.TP
Packit 7b22a4
\fB\-\-hashlimit\-htable\-max\fP \fIentries\fP
Packit 7b22a4
Maximum entries in the hash.
Packit 7b22a4
.TP
Packit 7b22a4
\fB\-\-hashlimit\-htable\-expire\fP \fImsec\fP
Packit 7b22a4
After how many milliseconds do hash entries expire.
Packit 7b22a4
.TP
Packit 7b22a4
\fB\-\-hashlimit\-htable\-gcinterval\fP \fImsec\fP
Packit 7b22a4
How many milliseconds between garbage collection intervals.
Packit 7b22a4
.TP
Packit 7b22a4
\fB\-\-hashlimit\-rate\-match\fP
Packit 7b22a4
Classify the flow instead of rate-limiting it. This acts like a
Packit 7b22a4
true/false match on whether the rate is above/below a certain number
Packit 7b22a4
.TP
Packit 7b22a4
\fB\-\-hashlimit\-rate\-interval\fP \fIsec\fP
Packit 7b22a4
Can be used with \-\-hashlimit\-rate\-match to specify the interval
Packit 7b22a4
at which the rate should be sampled
Packit 7b22a4
.PP
Packit 7b22a4
Examples:
Packit 7b22a4
.TP
Packit 7b22a4
matching on source host
Packit 7b22a4
"1000 packets per second for every host in 192.168.0.0/16" =>
Packit 7b22a4
\-s 192.168.0.0/16 \-\-hashlimit\-mode srcip \-\-hashlimit\-upto 1000/sec
Packit 7b22a4
.TP
Packit 7b22a4
matching on source port
Packit 7b22a4
"100 packets per second for every service of 192.168.1.1" =>
Packit 7b22a4
\-s 192.168.1.1 \-\-hashlimit\-mode srcport \-\-hashlimit\-upto 100/sec
Packit 7b22a4
.TP
Packit 7b22a4
matching on subnet
Packit 7b22a4
"10000 packets per minute for every /28 subnet (groups of 8 addresses)
Packit 7b22a4
in 10.0.0.0/8" =>
Packit 7b22a4
\-s 10.0.0.0/8 \-\-hashlimit\-mask 28 \-\-hashlimit\-upto 10000/min
Packit 7b22a4
.TP
Packit 7b22a4
matching bytes per second
Packit 7b22a4
"flows exceeding 512kbyte/s" =>
Packit 7b22a4
\-\-hashlimit-mode srcip,dstip,srcport,dstport \-\-hashlimit\-above 512kb/s
Packit 7b22a4
.TP
Packit 7b22a4
matching bytes per second
Packit 7b22a4
"hosts that exceed 512kbyte/s, but permit up to 1Megabytes without matching"
Packit 7b22a4
\-\-hashlimit-mode dstip \-\-hashlimit\-above 512kb/s \-\-hashlimit-burst 1mb