Search squid archive

Re: Limiting user's bandwidth

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

 



> Thanks Andy for your reply and taking your time to help like always.
> 

No problem at all.

> > > $tc class add dev eth0 parent 1:0  classid 1:1
> > htb rate 900kbit ceil 945kbit
> 
> As I understand, correct me if I'm wrong, this rule is telling the
>  kernel how much bw we want to use globally or how big is the entire
>  bucket.

Yes, but the two are the same, so I would just keep these two parameters
as the same figure. This is the maximum amount of bandwidth that the
whole class can use.

> I know the amount of the leafs don't add up to the root's bw but, not
>  all clients are connected at the same time.

That's the beauty of HTB. Set your leaf rates to be the maximum amount
you would want them to ever have, if they did happen to all be connected
at the same time. Set the maximum to be the maximum that they should
ever have if it was possible. The prio parameter will then share the
excess bandwidth accordingly, should there be any available.

>  I don't know if this is
>  the problem or not but, I have similar rules for the LAN interface
>  which works pretty well.

I don't know, but in accordance with the above, there is no reason to
not have them all add up.

> The weird thing is if I don't use squid caching and just use normal
>  FORWARD chain along with these tc script the upload and download
>  throtle works fine.

Ah, well the difference is that you are using INPUT/OUTPUT chains with
Squid, not FORWARD, so that will be the difference.

Are you just trying to share bandwidth fairly between users? If so, your
best bet is to change to one leaf for all your clients, but attach a
filter to it that will share bandwidth *by IP address* (see below) - the
default is to share by connection. If you want an overall limit you can
apply that to the one leaf, and then everybody within it will get their
fair share within.

If you want people who are downloading/uploading large amounts to get a
reduced share, then set up an iptables rule to set a MARK based on the
amount of date transferred in that connection. There's a good example at
the following web page, although it's currently a work in progress:

http://www.andybev.com/index.php/Fair_traffic_shaping_an_ADSL_line_for_a_local_network_using_Linux

Andy




[Index of Archives]     [Linux Audio Users]     [Samba]     [Big List of Linux Books]     [Linux USB]     [Yosemite News]

  Powered by Linux