HTB rates aren't enforced correctly

Linux Advanced Routing and Traffic Control

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi!

I recently changed my qdisc from CBQ and PRIO to only HTB, and I can't
really seem to get the rates to work as I want them to. I have eight
classes, which I set up as follows:

tc qdisc add dev eth1 root handle 1: htb default 122
tc class add dev eth1 parent 1: classid 1:1 htb rate 1000kbit ceil 1000kbit cburst 1500 burst 50kb
tc class add dev eth1 parent 1:1 classid 1:11 htb prio 0 rate 25kbit ceil 50kbit burst 10kbit
tc class add dev eth1 parent 1:1 classid 1:12 htb prio 1 rate 400kbit ceil 1000kbit burst 10kb
tc class add dev eth1 parent 1:1 classid 1:13 htb prio 1 rate 150kbit ceil 1000kbit burst 50kb
tc class add dev eth1 parent 1:1 classid 1:14 htb prio 1 rate 400kbit ceil 1000kbit burst 10kb
tc class add dev eth1 parent 1:1 classid 1:15 htb prio 2 rate 25kbit ceil 500kbit burst 10kb
tc class add dev eth1 parent 1:12 classid 1:121 htb prio 1 rate 300kbit ceil 1000kbit
tc class add dev eth1 parent 1:12 classid 1:122 htb prio 1 rate 100kbit ceil 1000kbit
tc filter add dev eth1 parent 1: protocol ip prio 1 handle 1 fw flowid 1:15
tc filter add dev eth1 parent 1: protocol ip prio 2 handle 2 fw flowid 1:14
tc filter add dev eth1 parent 1: protocol ip prio 3 u32 match ip tos 0x10 0x1e flowid 1:11
tc filter add dev eth1 parent 1: protocol ip prio 3 u32 match ip tos 0x08 0x1e flowid 1:121
tc filter add dev eth1 parent 1: protocol ip prio 3 u32 match ip sport 80 0xffff flowid 1:13

(Sorry for the long lines)

Along with these iptables rules in the mangle table:
-A POSTROUTING -m tos --tos 0x1e -j MARK --set-mark 0x1 
-A POSTROUTING -m tos --tos 0x1e -j TOS --set-tos 0x00 
-A POSTROUTING -m owner --cmd-owner vsftpd -j MARK --set-mark 0x2 

As you can see, one of the things I'm trying to do is to de-prioritize
traffic with TOS 0x1E (I set this through iptables on other machines
on the network for processes that belong to a certain group) - these
packets go to class 1:15. It doesn't work as I expect it to,
though.

In my test case, I let a friend download something from me over FTP,
which goes through class 1:14, at the same time as I'm letting a
multitude of TCP connections transfer data through the low priority
class (1:15). This friend of mine has a downstream bandwidth of 512
kbit. My upstream bandwidth, in case it is unclear, is 1
mbit. Therefore, I would expect each to go at about 500 kbit
each. When only one of the transfers is running alone, the correct
bandwidth is reached. However, when both are running at the same time,
the low priority goes at 500 kbit (its ceil), while the FTP transfer
drops to only about 300 kbit.

I have verified that everything goes through the right classes (with
tc -s class ls), so the filters are working as they should, at least.

If someone can explain this, I'd be grateful.

Fredrik Tolf

_______________________________________________
LARTC mailing list / LARTC@xxxxxxxxxxxxxxx
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

[Index of Archives]     [LARTC Home Page]     [Netfilter]     [Netfilter Development]     [Network Development]     [Bugtraq]     [GCC Help]     [Yosemite News]     [Linux Kernel]     [Fedora Users]
  Powered by Linux