• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1The rate estimator can match on estimated rates as collected by the RATEEST
2target. It supports matching on absolute bps/pps values, comparing two rate
3estimators and matching on the difference between two rate estimators.
4.PP
5For a better understanding of the available options, these are all possible
6combinations:
7.TP
8Absolute:
9.IP \(bu 4
10\fBrateest\fP \fIoperator\fP \fBrateest-bps\fP
11.IP \(bu 4
12\fBrateest\fP \fIoperator\fP \fBrateest-pps\fP
13.TP
14Absolute + Delta:
15.IP \(bu 4
16(\fBrateest\fP minus \fBrateest-bps1\fP) \fIoperator\fP \fBrateest-bps2\fP
17.IP \(bu 4
18(\fBrateest\fP minus \fBrateest-pps1\fP) \fIoperator\fP \fBrateest-pps2\fP
19.TP
20Relative:
21.IP \(bu 4
22\fBrateest1\fP \fIoperator\fP \fBrateest2\fP \fBrateest-bps\fP(without rate!)
23.IP \(bu 4
24\fBrateest1\fP \fIoperator\fP \fBrateest2\fP \fBrateest-pps\fP(without rate!)
25.TP
26Relative + Delta:
27.IP \(bu 4
28(\fBrateest1\fP minus \fBrateest-bps1\fP) \fIoperator\fP
29(\fBrateest2\fP minus \fBrateest-bps2\fP)
30.IP \(bu 4
31(\fBrateest1\fP minus \fBrateest-pps1\fP) \fIoperator\fP
32(\fBrateest2\fP minus \fBrateest-pps2\fP)
33.TP
34\fB\-\-rateest\-delta\fP
35For each estimator (either absolute or relative mode), calculate the difference
36between the estimator-determined flow rate and the static value chosen with the
37BPS/PPS options. If the flow rate is higher than the specified BPS/PPS, 0 will
38be used instead of a negative value. In other words, "max(0, rateest#_rate \-
39rateest#_bps)" is used.
40.TP
41[\fB!\fP] \fB\-\-rateest\-lt\fP
42Match if rate is less than given rate/estimator.
43.TP
44[\fB!\fP] \fB\-\-rateest\-gt\fP
45Match if rate is greater than given rate/estimator.
46.TP
47[\fB!\fP] \fB\-\-rateest\-eq\fP
48Match if rate is equal to given rate/estimator.
49.PP
50In the so-called "absolute mode", only one rate estimator is used and compared
51against a static value, while in "relative mode", two rate estimators are
52compared against another.
53.TP
54\fB\-\-rateest\fP \fIname\fP
55Name of the one rate estimator for absolute mode.
56.TP
57\fB\-\-rateest1\fP \fIname\fP
58.TP
59\fB\-\-rateest2\fP \fIname\fP
60The names of the two rate estimators for relative mode.
61.TP
62\fB\-\-rateest\-bps\fP [\fIvalue\fP]
63.TP
64\fB\-\-rateest\-pps\fP [\fIvalue\fP]
65.TP
66\fB\-\-rateest\-bps1\fP [\fIvalue\fP]
67.TP
68\fB\-\-rateest\-bps2\fP [\fIvalue\fP]
69.TP
70\fB\-\-rateest\-pps1\fP [\fIvalue\fP]
71.TP
72\fB\-\-rateest\-pps2\fP [\fIvalue\fP]
73Compare the estimator(s) by bytes or packets per second, and compare against
74the chosen value. See the above bullet list for which option is to be used in
75which case. A unit suffix may be used \(em available ones are: bit, [kmgt]bit,
76[KMGT]ibit, Bps, [KMGT]Bps, [KMGT]iBps.
77.PP
78Example: This is what can be used to route outgoing data connections from an
79FTP server over two lines based on the available bandwidth at the time the data
80connection was started:
81.PP
82# Estimate outgoing rates
83.PP
84iptables \-t mangle \-A POSTROUTING \-o eth0 \-j RATEEST \-\-rateest\-name eth0
85\-\-rateest\-interval 250ms \-\-rateest\-ewma 0.5s
86.PP
87iptables \-t mangle \-A POSTROUTING \-o ppp0 \-j RATEEST \-\-rateest\-name ppp0
88\-\-rateest\-interval 250ms \-\-rateest\-ewma 0.5s
89.PP
90# Mark based on available bandwidth
91.PP
92iptables \-t mangle \-A balance \-m conntrack \-\-ctstate NEW \-m helper \-\-helper ftp
93\-m rateest \-\-rateest\-delta \-\-rateest1 eth0 \-\-rateest\-bps1 2.5mbit \-\-rateest\-gt
94\-\-rateest2 ppp0 \-\-rateest\-bps2 2mbit \-j CONNMARK \-\-set\-mark 1
95.PP
96iptables \-t mangle \-A balance \-m conntrack \-\-ctstate NEW \-m helper \-\-helper ftp
97\-m rateest \-\-rateest\-delta \-\-rateest1 ppp0 \-\-rateest\-bps1 2mbit \-\-rateest\-gt
98\-\-rateest2 eth0 \-\-rateest\-bps2 2.5mbit \-j CONNMARK \-\-set\-mark 2
99.PP
100iptables \-t mangle \-A balance \-j CONNMARK \-\-restore\-mark
101