Blame extensions/libxt_hashlimit.man

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