Blame extensions/libxt_rateest.man

Packit 7b22a4
The rate estimator can match on estimated rates as collected by the RATEEST
Packit 7b22a4
target. It supports matching on absolute bps/pps values, comparing two rate
Packit 7b22a4
estimators and matching on the difference between two rate estimators.
Packit 7b22a4
.PP
Packit 7b22a4
For a better understanding of the available options, these are all possible
Packit 7b22a4
combinations:
Packit 7b22a4
.\" * Absolute:
Packit 7b22a4
.IP \(bu 4
Packit 7b22a4
\fBrateest\fP \fIoperator\fP \fBrateest-bps\fP
Packit 7b22a4
.IP \(bu 4
Packit 7b22a4
\fBrateest\fP \fIoperator\fP \fBrateest-pps\fP
Packit 7b22a4
.\" * Absolute + Delta:
Packit 7b22a4
.IP \(bu 4
Packit 7b22a4
(\fBrateest\fP minus \fBrateest-bps1\fP) \fIoperator\fP \fBrateest-bps2\fP
Packit 7b22a4
.IP \(bu 4
Packit 7b22a4
(\fBrateest\fP minus \fBrateest-pps1\fP) \fIoperator\fP \fBrateest-pps2\fP
Packit 7b22a4
.\" * Relative:
Packit 7b22a4
.IP \(bu 4
Packit 7b22a4
\fBrateest1\fP \fIoperator\fP \fBrateest2\fP \fBrateest-bps\fP(without rate!)
Packit 7b22a4
.IP \(bu 4
Packit 7b22a4
\fBrateest1\fP \fIoperator\fP \fBrateest2\fP \fBrateest-pps\fP(without rate!)
Packit 7b22a4
.\" * Relative + Delta:
Packit 7b22a4
.IP \(bu 4
Packit 7b22a4
(\fBrateest1\fP minus \fBrateest-bps1\fP) \fIoperator\fP
Packit 7b22a4
(\fBrateest2\fP minus \fBrateest-bps2\fP)
Packit 7b22a4
.IP \(bu 4
Packit 7b22a4
(\fBrateest1\fP minus \fBrateest-pps1\fP) \fIoperator\fP
Packit 7b22a4
(\fBrateest2\fP minus \fBrateest-pps2\fP)
Packit 7b22a4
.TP
Packit 7b22a4
\fB\-\-rateest\-delta\fP
Packit 7b22a4
For each estimator (either absolute or relative mode), calculate the difference
Packit 7b22a4
between the estimator-determined flow rate and the static value chosen with the
Packit 7b22a4
BPS/PPS options. If the flow rate is higher than the specified BPS/PPS, 0 will
Packit 7b22a4
be used instead of a negative value. In other words, "max(0, rateest#_rate -
Packit 7b22a4
rateest#_bps)" is used.
Packit 7b22a4
.TP
Packit 7b22a4
[\fB!\fP] \fB\-\-rateest\-lt\fP
Packit 7b22a4
Match if rate is less than given rate/estimator.
Packit 7b22a4
.TP
Packit 7b22a4
[\fB!\fP] \fB\-\-rateest\-gt\fP
Packit 7b22a4
Match if rate is greater than given rate/estimator.
Packit 7b22a4
.TP
Packit 7b22a4
[\fB!\fP] \fB\-\-rateest\-eq\fP
Packit 7b22a4
Match if rate is equal to given rate/estimator.
Packit 7b22a4
.PP
Packit 7b22a4
In the so-called "absolute mode", only one rate estimator is used and compared
Packit 7b22a4
against a static value, while in "relative mode", two rate estimators are
Packit 7b22a4
compared against another.
Packit 7b22a4
.TP
Packit 7b22a4
\fB\-\-rateest\fP \fIname\fP
Packit 7b22a4
Name of the one rate estimator for absolute mode.
Packit 7b22a4
.TP
Packit 7b22a4
\fB\-\-rateest1\fP \fIname\fP
Packit 7b22a4
.TP
Packit 7b22a4
\fB\-\-rateest2\fP \fIname\fP
Packit 7b22a4
The names of the two rate estimators for relative mode.
Packit 7b22a4
.TP
Packit 7b22a4
\fB\-\-rateest\-bps\fP [\fIvalue\fP]
Packit 7b22a4
.TP
Packit 7b22a4
\fB\-\-rateest\-pps\fP [\fIvalue\fP]
Packit 7b22a4
.TP
Packit 7b22a4
\fB\-\-rateest\-bps1\fP [\fIvalue\fP]
Packit 7b22a4
.TP
Packit 7b22a4
\fB\-\-rateest\-bps2\fP [\fIvalue\fP]
Packit 7b22a4
.TP
Packit 7b22a4
\fB\-\-rateest\-pps1\fP [\fIvalue\fP]
Packit 7b22a4
.TP
Packit 7b22a4
\fB\-\-rateest\-pps2\fP [\fIvalue\fP]
Packit 7b22a4
Compare the estimator(s) by bytes or packets per second, and compare against
Packit 7b22a4
the chosen value. See the above bullet list for which option is to be used in
Packit 7b22a4
which case. A unit suffix may be used - available ones are: bit, [kmgt]bit,
Packit 7b22a4
[KMGT]ibit, Bps, [KMGT]Bps, [KMGT]iBps.
Packit 7b22a4
.PP
Packit 7b22a4
Example: This is what can be used to route outgoing data connections from an
Packit 7b22a4
FTP server over two lines based on the available bandwidth at the time the data
Packit 7b22a4
connection was started:
Packit 7b22a4
.PP
Packit 7b22a4
# Estimate outgoing rates
Packit 7b22a4
.PP
Packit 7b22a4
iptables \-t mangle \-A POSTROUTING \-o eth0 \-j RATEEST \-\-rateest\-name eth0
Packit 7b22a4
\-\-rateest\-interval 250ms \-\-rateest\-ewma 0.5s
Packit 7b22a4
.PP
Packit 7b22a4
iptables \-t mangle \-A POSTROUTING \-o ppp0 \-j RATEEST \-\-rateest\-name ppp0
Packit 7b22a4
\-\-rateest\-interval 250ms \-\-rateest\-ewma 0.5s
Packit 7b22a4
.PP
Packit 7b22a4
# Mark based on available bandwidth
Packit 7b22a4
.PP
Packit 7b22a4
iptables \-t mangle \-A balance \-m conntrack \-\-ctstate NEW \-m helper \-\-helper ftp
Packit 7b22a4
\-m rateest \-\-rateest\-delta \-\-rateest1 eth0 \-\-rateest\-bps1 2.5mbit \-\-rateest\-gt
Packit 7b22a4
\-\-rateest2 ppp0 \-\-rateest\-bps2 2mbit \-j CONNMARK \-\-set\-mark 1
Packit 7b22a4
.PP
Packit 7b22a4
iptables \-t mangle \-A balance \-m conntrack \-\-ctstate NEW \-m helper \-\-helper ftp
Packit 7b22a4
\-m rateest \-\-rateest\-delta \-\-rateest1 ppp0 \-\-rateest\-bps1 2mbit \-\-rateest\-gt
Packit 7b22a4
\-\-rateest2 eth0 \-\-rateest\-bps2 2.5mbit \-j CONNMARK \-\-set\-mark 2
Packit 7b22a4
.PP
Packit 7b22a4
iptables \-t mangle \-A balance \-j CONNMARK \-\-restore\-mark