blob: 75303c50f9046008ecbb98edf9a628e4af257dbf [file] [log] [blame]
Jan Engelhardta47bb4a2008-08-15 22:13:57 +02001The 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.TP
Jan Engelhardtfea74bf2009-01-12 04:53:18 +01005\fB\-\-rateest1\fP \fIname\fP
Jan Engelhardta47bb4a2008-08-15 22:13:57 +02006Name of the first rate estimator.
7.TP
Jan Engelhardtfea74bf2009-01-12 04:53:18 +01008\fB\-\-rateest2\fP \fIname\fP
Jan Engelhardta47bb4a2008-08-15 22:13:57 +02009Name of the second rate estimator (if difference is to be calculated).
10.TP
Jan Engelhardtfea74bf2009-01-12 04:53:18 +010011\fB\-\-rateest\-delta\fP
Jan Engelhardta47bb4a2008-08-15 22:13:57 +020012Compare difference(s) to given rate(s)
13.TP
Jan Engelhardt2d039bc2011-02-21 02:59:50 +010014\fB\-\-rateest\-bps1\fP [\fIvalue\fP]
Jan Engelhardta47bb4a2008-08-15 22:13:57 +020015.TP
Jan Engelhardt2d039bc2011-02-21 02:59:50 +010016\fB\-\-rateest\-bps2\fP [\fIvalue\fP]
Jan Engelhardta47bb4a2008-08-15 22:13:57 +020017Compare bytes per second.
18.TP
Jan Engelhardt2d039bc2011-02-21 02:59:50 +010019\fB\-\-rateest\-pps1\fP [\fIvalue\fP]
Jan Engelhardta47bb4a2008-08-15 22:13:57 +020020.TP
Jan Engelhardt2d039bc2011-02-21 02:59:50 +010021\fB\-\-rateest\-pps2\fP [\fIvalue\fP]
Jan Engelhardta47bb4a2008-08-15 22:13:57 +020022Compare packets per second.
23.TP
Jan Engelhardtfea74bf2009-01-12 04:53:18 +010024[\fB!\fP] \fB\-\-rateest\-lt\fP
Jan Engelhardta47bb4a2008-08-15 22:13:57 +020025Match if rate is less than given rate/estimator.
26.TP
Jan Engelhardtfea74bf2009-01-12 04:53:18 +010027[\fB!\fP] \fB\-\-rateest\-gt\fP
Jan Engelhardta47bb4a2008-08-15 22:13:57 +020028Match if rate is greater than given rate/estimator.
29.TP
Jan Engelhardtfea74bf2009-01-12 04:53:18 +010030[\fB!\fP] \fB\-\-rateest\-eq\fP
Jan Engelhardta47bb4a2008-08-15 22:13:57 +020031Match if rate is equal to given rate/estimator.
32.PP
33Example: This is what can be used to route outgoing data connections from an
34FTP server over two lines based on the available bandwidth at the time the data
35connection was started:
36.PP
37# Estimate outgoing rates
38.PP
Jan Engelhardtfea74bf2009-01-12 04:53:18 +010039iptables \-t mangle \-A POSTROUTING \-o eth0 \-j RATEEST \-\-rateest\-name eth0
40\-\-rateest\-interval 250ms \-\-rateest\-ewma 0.5s
Jan Engelhardta47bb4a2008-08-15 22:13:57 +020041.PP
Jan Engelhardtfea74bf2009-01-12 04:53:18 +010042iptables \-t mangle \-A POSTROUTING \-o ppp0 \-j RATEEST \-\-rateest\-name ppp0
43\-\-rateest\-interval 250ms \-\-rateest\-ewma 0.5s
Jan Engelhardta47bb4a2008-08-15 22:13:57 +020044.PP
45# Mark based on available bandwidth
46.PP
Jan Engelhardtfea74bf2009-01-12 04:53:18 +010047iptables \-t mangle \-A balance \-m conntrack \-\-ctstate NEW \-m helper \-\-helper ftp
48\-m rateest \-\-rateest\-delta \-\-rateest1 eth0 \-\-rateest\-bps1 2.5mbit \-\-rateest\-gt
49\-\-rateest2 ppp0 \-\-rateest\-bps2 2mbit \-j CONNMARK \-\-set\-mark 1
Jan Engelhardta47bb4a2008-08-15 22:13:57 +020050.PP
Jan Engelhardtfea74bf2009-01-12 04:53:18 +010051iptables \-t mangle \-A balance \-m conntrack \-\-ctstate NEW \-m helper \-\-helper ftp
52\-m rateest \-\-rateest\-delta \-\-rateest1 ppp0 \-\-rateest\-bps1 2mbit \-\-rateest\-gt
53\-\-rateest2 eth0 \-\-rateest\-bps2 2.5mbit \-j CONNMARK \-\-set\-mark 2
Jan Engelhardta47bb4a2008-08-15 22:13:57 +020054.PP
Jan Engelhardtfea74bf2009-01-12 04:53:18 +010055iptables \-t mangle \-A balance \-j CONNMARK \-\-restore\-mark