Re: htb limiting trouble: no overlimit or dropped packets

Linux Advanced Routing and Traffic Control

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

 



Walter Haidinger wrote:
> Hi!
> 
> I'm trying to limit the uplink bandwidth using htb but no packets are
> overlimit or dropped. :-(
> 
> My router config:
> * Linux kernel 2.4.20-pre10 (htb v3.7) with everything built as
>   modules in QoS, iptables in use.
> * tc binary from htb3.6-020525.tgz
> * external interface eth0: Internet access, 512 kbit/s uplink speed
> * internal interface eth1: internal LAN, 100 Mbit/s
> 
> The hosts in the internal lan should be bandwidth limited and are
> masqueraded by the router.
> 
> Q: Must the versions of the kernel module and the tc utility match?
> 
> Below are my commands to create the qdiscs and classes:
> 
> tc qdisc add dev eth1 root handle 1: htb default 20
> tc class add dev eth1 parent 1:  classid 1:1  htb rate 64kbit ceil 64kbit burst 5k
> tc class add dev eth1 parent 1:1 classid 1:10 htb rate 64kbit ceil 64kbit burst 5k
> tc class add dev eth1 parent 1:1 classid 1:20 htb rate 57kbit ceil 64kbit burst 5k
> tc class add dev eth1 parent 1:1 classid 1:30 htb rate 51kbit ceil 64kbit burst 5k
> tc class add dev eth1 parent 1:1 classid 1:40 htb rate 6kbit burst 0
> tc qdisc add dev eth1 parent 1:10 handle 10: sfq perturb 10
> tc qdisc add dev eth1 parent 1:20 handle 20: sfq perturb 10
> tc qdisc add dev eth1 parent 1:30 handle 30: sfq perturb 10
> tc qdisc add dev eth1 parent 1:40 handle 40: sfq perturb 10
> 
> Notes:
> * No errors from the tc utility
> * All filters are scrapped for testing purposes, leaving only
>   unclassified packets which go the default class (this works)
> * Bandwidths are really low for testing
> * There are four classes with 100%, 90%, 80% and 10% bandwidth
> 
> Next I tried an FTP upload from a machine on the internal LAN to the
> internet, creating the following qdisc and class statistics:
> 
> qdisc sfq 40: quantum 1514b perturb 10sec
>  Sent 0 bytes 0 pkts (dropped 0, overlimits 0)
> 
>  qdisc sfq 30: quantum 1514b perturb 10sec
>  Sent 0 bytes 0 pkts (dropped 0, overlimits 0)
> 
>  qdisc sfq 20: quantum 1514b perturb 10sec
>  Sent 13408020 bytes 12433 pkts (dropped 0, overlimits 0)
> 
>  qdisc sfq 10: quantum 1514b perturb 10sec
>  Sent 0 bytes 0 pkts (dropped 0, overlimits 0)
> 
>  qdisc htb 1: r2q 10 default 20 direct_packets_stat 0
>  Sent 13408020 bytes 12433 pkts (dropped 0, overlimits 13422)
> 
>  class htb 1:1 root rate 64Kbit ceil 64Kbit burst 1023b cburst 1680b
>  Sent 13408020 bytes 12433 pkts (dropped 0, overlimits 0)
>  rate 35bps
>  lended: 1136 borrowed: 0 giants: 0
>  tokens: 51202 ctokens: 116901
> 
> class htb 1:10 parent 1:1 leaf 10: prio 0 rate 64Kbit ceil 64Kbit burst
> 1023b cburst 1680b
>  Sent 0 bytes 0 pkts (dropped 0, overlimits 0)
>  lended: 0 borrowed: 0 giants: 0
>  tokens: 102400 ctokens: 168099
> 
> class htb 1:20 parent 1:1 leaf 20: prio 0 rate 57Kbit ceil 64Kbit burst
> 1671b cburst 1680b
>  Sent 13408020 bytes 12433 pkts (dropped 0, overlimits 0)
>  rate 35bps
>  lended: 11297 borrowed: 1136 giants: 0
>  tokens: 130246 ctokens: 116901
> 
> class htb 1:30 parent 1:1 leaf 30: prio 0 rate 51Kbit ceil 64Kbit burst
> 1664b cburst 1680b
>  Sent 0 bytes 0 pkts (dropped 0, overlimits 0)
>  lended: 0 borrowed: 0 giants: 0
>  tokens: 208941 ctokens: 168099
> 
> class htb 1:40 parent 1:1 leaf 40: prio 0 rate 6Kbit ceil 6Kbit burst
> 1606b cburst 1606b
>  Sent 0 bytes 0 pkts (dropped 0, overlimits 0)
>  lended: 0 borrowed: 0 giants: 0
>  tokens: 1714132 ctokens: 1714132
> 
> Well, everything goes to the default class 1:20 which is OK.
> However, the traffic is *not* limited! No packets overlimit or dropped!
> The FTP upload succeeded with full uplink speed (512 kbit/s).
> 
> Q: What am I missing here? Why isn't the traffic limited by HTB?
> 
> I've read the LARTC Howto, the required manpages, the docs at Martin
> Devera's Homepage and had a look at the Wondershaper. Unfortunately I'm
> still unable to find the bug. :-( Any hints would be appreciated!
> 
> Thanks, Walter
> 
> PS: I've also tried using filters u32 and fwmark but traffic was
>     never limited. I guess there is something wrong with my
>     class/qdisc setup in general, right?
> 
> 
> 
> _______________________________________________
> LARTC mailing list / LARTC@mailman.ds9a.nl
> http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
> 


Walter,

   I'm giving a try on this one, I'm not familiar with HTB at all...

   I think that your only problem is: all classes can borrow bandwidth 
from other classes !!  So there is no bandwidth control !

   You should add the "bounded" modifier to classes that should be limited.

Regards,

Stephane.

_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
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