Re: bandwidth-limiting on LAN interface egress (2)

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

 



On Wed, 2011-11-16 at 23:06 -0600, Lloyd Standish wrote:
> I was under the impression that one could define an HTB qdisc, then set
>  up bandwidth classes for of it, then use u32 filters matching on LAN
>  IP numbers to assign the flows for several IPs to the same HTB class. 
>  I tried that and found that the total bandwidth of the class is shared
>  among the connections, which is not what I wanted or expected!
> 
> Apparently for bandwidth-limiting to work there needs to be a HTB class
>  declared for *each* user IP number!  This certainly makes sense if the
>  sum of classes' rates should total the rate of the containing HTB.
> 
> Andy, you wrote:
> "My personal opinion is that you shouldn't limit per user. You should
> instead prioritise traffic properly. This way you'll have a lot less
> classes and a lot less overhead."
> 
> Now I understand what you mean by "a lot less classes"!
> 
> Unless someone corrects me, I will assume that there is no way to use
>  filters to assign several "flows" (by user IP) to the same class, such
>  that each flow gets the class's full configured rate.

No, I don't think there is any other way. You can use the "flow"
parameter to balance per user IP within a class, but you won't be able
to use that to hard-limit to a particular bandwidth for the IP, just the
overall rate limit of the class:

$TC filter add dev eth0 parent 30: protocol ip \
        handle 1 flow hash keys dst divisor 1024

> This leads me to another question: Consider the case where there are 50
>  users, each with 1 Mbit download rate, but statistics show that all 50
>  *never* require the full bandwidth, and that a total 35 Mbit total
>  connection rate is sufficient.  Should in this case the HTB qdisc be
>  configured to have total 35 Mbit (or slightly less), even though the
>  sum of all classes' rates will be 50 Mbit?

The way to achieve this is to set a root limit of 35 Mbit, then make
sure that all the "rate" values add up to that. You can then set a
"ceil" value to allow the leaf classes to burst up to 1 Mbit.

> 
> This might answer my question, or it is an error on the lartc site:
> 
> http://lartc.org/howto/lartc.qdisc.classful.html#AEN903 shows an
>  example in which the sum of classes' rates is higher than the total
>  HTB qdisc rate:

I personally think that is a mistake. Everything I have read in the past
states that the leaf classes should add up to the total root rate.

Andy


--
To unsubscribe from this list: send the line "unsubscribe netfilter" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Netfilter Development]     [Linux Kernel Networking Development]     [Netem]     [Berkeley Packet Filter]     [Linux Kernel Development]     [Advanced Routing & Traffice Control]     [Bugtraq]

  Powered by Linux