วันจันทร์ที่ 27 มกราคม พ.ศ. 2557

Control bandwidth using Squid Proxy

To utilise bandwindth among the users equally and efficiently, Bandwidth should be controlled and distributed properly or else on user may downloadlarge files and that effects the browising speed of other uses. Why should others suffer because of one use.

We use delay_pools to control bandwidth in squid, of course delay_pools has 3 classes.  1,2,3 but for now we use class 2 since we want to control bandwindth.


Controlling Bandwidth per system/ip :

[root@squid ~]#  vim  /etc/squid/squid.conf

acl  10k_users  src "/etc/squid/10k_user_pcs.txt"
delay_pools  1
delay_class  1  2
delay_parameters  1  -1/-1  10000/10000
delay_access  1  allow   10k_user_pcs

10k_userlist contains all the ips of the user systems to whom we assign 10kb bandwidth.
-1/-1 is  actual bandwidth of the connections from isp

you can check downloading any file from any of the systems listed in the 10k_userlist.txt file.

Controlling Bandwidth per username :

If you assign bandwidth per system, you have to download the updates at the same speed and you'll be stuck there. so assign it to userid, so that you can use your id while updating and downloading updates and do it fast.


acl  10k_users  src "/etc/squid/10k_user_ids.txt"delay_pools  1
delay_class  1  2
delay_parameters  1  -1/-1  10000/10000
delay_access  1  allow   10k_useri_ds

same like 1st acl 10k_user_ids.txt contains proxy user names list.