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.



Setup

I created 1 parent class with rate = 100 and added 2 subclasses with ceil = 100kbps. I changed the quantum and the rate for the classes to see what happens if you change the quantum parameter.

Used script (download)

tc qdisc del dev eth0 root
tc qdisc add dev eth0 root handle 1: htb default 10
tc class add dev eth0 parent 1: classid 1:1 htb rate 100kbps

tc class add dev eth0 parent 1:1 classid 1:10 htb rate 10kbps ceil 100kbps quantum 2000

tc class add dev eth0 parent 1:1 classid 1:11 htb rate 10kbps ceil 100kbps quantum 20000

tc filter add dev eth0 parent 1: protocol ip handle 0x10 fw classid 1:10
tc filter add dev eth0 parent 1: protocol ip handle 0x11 fw classid 1:11

iptables -F
iptables -F -t mangle
iptables -X
iptables -N acc_0
iptables -N acc_1
iptables -A OUTPUT -t mangle -p tcp --dport 2000 -j MARK --set-mark 0x0010
iptables -A OUTPUT -t mangle -p tcp --dport 2001 -j MARK --set-mark 0x0011
iptables -A OUTPUT -p tcp --dport 2000 -j acc_0
iptables -A OUTPUT -p tcp --dport 2001 -j acc_1
iptables -A OUTPUT -j ACCEPT
	

Results

rate class 1:10 and 1:11Expected 1:10 - 1:11Result
10kbps 17.27 - 82.722 - 78
20kbps 25.45 - 74.536 - 64
30kbps 33.63 - 66.350 - 50

The influence of the quantum parameter is not so accurate, but without the quantum setting each class gets 50%.