The rate estimator can match on estimated rates as collected by the RATEEST target. It supports matching on absolute bps/pps values, comparing two rate estimators and matching on the difference between two rate estimators.

--rateest1 name
    Name of the first rate estimator.

--rateest2 name
    Name of the second rate estimator (if difference is to be calculated).

--rateest-delta
    Compare difference(s) to given rate(s)

--rateest1-bps value

--rateest2-bps value
    Compare bytes per second.

--rateest1-pps value

--rateest2-pps value
    Compare packets per second.

[!] --rateest-lt
    Match if rate is less than given rate/estimator.

[!] --rateest-gt
    Match if rate is greater than given rate/estimator.

[!] --rateest-eq
    Match if rate is equal to given rate/estimator.

Example: This is what can be used to route outgoing data connections from an FTP server over two lines based on the available bandwidth at the time the data connection was started:

# Estimate outgoing rates

iptables -t mangle -A POSTROUTING -o eth0 -j RATEEST --rateest-name eth0 --rateest-interval 250ms --rateest-ewma 0.5s

iptables -t mangle -A POSTROUTING -o ppp0 -j RATEEST --rateest-name ppp0 --rateest-interval 250ms --rateest-ewma 0.5s

# Mark based on available bandwidth

iptables -t mangle -A balance -m conntrack --ctstate NEW -m helper --helper ftp -m rateest --rateest-delta --rateest1 eth0 --rateest-bps1 2.5mbit --rateest-gt --rateest2 ppp0 --rateest-bps2 2mbit -j CONNMARK --set-mark 1

iptables -t mangle -A balance -m conntrack --ctstate NEW -m helper --helper ftp -m rateest --rateest-delta --rateest1 ppp0 --rateest-bps1 2mbit --rateest-gt --rateest2 eth0 --rateest-bps2 2.5mbit -j CONNMARK --set-mark 2

iptables -t mangle -A balance -j CONNMARK --restore-mark