Dear reader, I'm not updating these pages anymore. If you have tc or ip related questions, you can post them on the LARTC mailing list.



What I wanna do

TBF can bound the traffic, but has no support for classes. But you can use it as qdisc on a CBQ class to bound that class. CBQ can also bound a class, but is not so accurate. So I tested the accuracy of the tbf qdisc.

Used script

Used script (download)

RATE_MAX=$1`echo kbps`
IP=kriek

DEV="dev eth0"

tc qdisc del $DEV root
tc qdisc add $DEV root handle 10: tbf rate $RATE_MAX buffer 20Kb/8 limit 15Kb
 
iptables -F
iptables -X
iptables -N acc_0
iptables -A OUTPUT -t mangle -j MARK --set-mark 1
iptables -A OUTPUT -j acc_0
iptables -A OUTPUT -j ACCEPT
And I used another script that executes the tbf script with different parameters. Each time the monitor.pl script is executed and when the average speed didn't changed fot 10 times, the value is logged to a file.

Used script (download)

Results

Each time the traffic was allmost perfect bounded. So the results are very good. This setup test the accuracy of tbf on a long periode. How tbf is dealing with short data bursts, is for a next test.

If have a non-duplex 10Mbit connection. When you want to transmit to much data, the link get congested. The maximum throughput is reached when I bound the traffic to 960 Kbyte/s. When you want to transmit more data, you loose bandwidth due to overhead and collisions.

You can download the logfile here.

TODO : try different options.