yuezonghe | 824eb0c | 2024-06-27 02:32:26 -0700 | [diff] [blame] | 1 | The rate estimator can match on estimated rates as collected by the RATEEST |
| 2 | target. It supports matching on absolute bps/pps values, comparing two rate |
| 3 | estimators and matching on the difference between two rate estimators. |
| 4 | .TP |
| 5 | \fB\-\-rateest1\fP \fIname\fP |
| 6 | Name of the first rate estimator. |
| 7 | .TP |
| 8 | \fB\-\-rateest2\fP \fIname\fP |
| 9 | Name of the second rate estimator (if difference is to be calculated). |
| 10 | .TP |
| 11 | \fB\-\-rateest\-delta\fP |
| 12 | Compare difference(s) to given rate(s) |
| 13 | .TP |
| 14 | \fB\-\-rateest1\-bps\fP \fIvalue\fP |
| 15 | .TP |
| 16 | \fB\-\-rateest2\-bps\fP \fIvalue\fP |
| 17 | Compare bytes per second. |
| 18 | .TP |
| 19 | \fB\-\-rateest1\-pps\fP \fIvalue\fP |
| 20 | .TP |
| 21 | \fB\-\-rateest2\-pps\fP \fIvalue\fP |
| 22 | Compare packets per second. |
| 23 | .TP |
| 24 | [\fB!\fP] \fB\-\-rateest\-lt\fP |
| 25 | Match if rate is less than given rate/estimator. |
| 26 | .TP |
| 27 | [\fB!\fP] \fB\-\-rateest\-gt\fP |
| 28 | Match if rate is greater than given rate/estimator. |
| 29 | .TP |
| 30 | [\fB!\fP] \fB\-\-rateest\-eq\fP |
| 31 | Match if rate is equal to given rate/estimator. |
| 32 | .PP |
| 33 | Example: This is what can be used to route outgoing data connections from an |
| 34 | FTP server over two lines based on the available bandwidth at the time the data |
| 35 | connection was started: |
| 36 | .PP |
| 37 | # Estimate outgoing rates |
| 38 | .PP |
| 39 | iptables \-t mangle \-A POSTROUTING \-o eth0 \-j RATEEST \-\-rateest\-name eth0 |
| 40 | \-\-rateest\-interval 250ms \-\-rateest\-ewma 0.5s |
| 41 | .PP |
| 42 | iptables \-t mangle \-A POSTROUTING \-o ppp0 \-j RATEEST \-\-rateest\-name ppp0 |
| 43 | \-\-rateest\-interval 250ms \-\-rateest\-ewma 0.5s |
| 44 | .PP |
| 45 | # Mark based on available bandwidth |
| 46 | .PP |
| 47 | iptables \-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 |
| 50 | .PP |
| 51 | iptables \-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 |
| 54 | .PP |
| 55 | iptables \-t mangle \-A balance \-j CONNMARK \-\-restore\-mark |