Re: Limiting bandwidth for internet sites

From: Xavier Baez <tech@dont-contact.us>
Date: Sat, 01 May 2004 15:48:13 -0500

Please take a moment to read the lines I've added/changed to my
squid.conf file. I run squid on port 80 (http accelelator with proxy)
and apache at port 81
I redirect incoming request for port 80 to port 81 using Iptables.
HOwever, I want my site's visitors to download files (such as .exe,
.zip... ) with a limit (say 10 kb/sec during days, and no limit during
the nights)

However, I've read about pools, acls... discussed a lot with no luck. I
think it's a great use of Squid, I'd really like to be able to limit my
user's download rates. Anyway, here's the file:

http_port 80
icp_port 0
acl QUERY urlpath_regex cgi-bin \?
no_cache deny QUERY
cache_mem 5 MB
cache_dir ufs /usr/local/squid/var/cache 500 16 256
emulate_httpd_log on
redirect_rewrites_host_header off
cache_replacement_policy GDSF
http_access allow all
cache_mgr news@socceraccess.com
cache_effective_user squid
cache_effective_group squid
httpd_accel_host virtual
httpd_accel_port 81
log_icp_queries off
cachemgr_passwd my_pass_here all
buffered_logs on
httpd_accel_with_proxy on
httpd_accel_uses_host_header on
httpd_accel_single_host off

logfile_rotate 10
maximum_object_size 20000 KB
store_avg_object_size 50 KB

#We want to limit bandwidth during the day, and allow
#full bandwidth during the night
#Caution! with the acl below your downloads are likely to break
#at 23:59. Read the FAQ in this bandwidth if you want to avoid it.
acl socceraccess url_regex -i 192.168
acl badinternet url_regex -i ftp \.exe \.zip \.rar \.r01 \.r02 \.r03
\.r04 \.r05
acl day time 09:00-23:59

#We have two different delay_pools
delay_pools 2

#First delay pool
#We don't want to delay our local traffic.
#There are three pool classes; here we will deal only with the second.
#First delay class (1) of second type (2).
delay_class 1 2

#-1/-1 mean that there are no limits.
delay_parameters 1 -1/-1 -1/-1

#socceraccess: 192.168 we have set before
delay_access 1 allow socceraccess

#Second delay pool.
#we want to delay downloading files mentioned in badinternet.
#Second delay class (2) of second type (2).
delay_class 2 1

#The numbers here are values in bytes;
#we must remember that Squid doesn't consider start/stop bits
#5000/150000 are values for the whole network
#5000/120000 are values for the single IP
#after downloaded files exceed about 150000 bytes,
#(or even twice or three times as much)
#they will continue to download at about 5000 bytes/s

delay_parameters 2 1250/1250 1250/1250

#We have set day to 09:00-23:59 before.
delay_access 2 allow day
delay_access 2 deny !day
delay_access 2 allow badintern

--------------------
S. A. Tech Department

Francesco Chemolli wrote:

>On Thu, 2004-04-29 at 00:26, Xavier Baez wrote:
>
>
>>Dear Squid staff
>>
>>I have a site that uses squid at port 80 and works as an http
>>accelerator (with proxy on) for Apache, that works on port 81
>>
>>However I want to make Squid limit the ammount of bandwidth that is
>>being downloaded (only for certain types of files)
>>For example, I want users browsing my site to have full bandwidth when
>>browsing, but I want to limit their bandwidth when they download files
>>from the Download Zone (ej: .zip files)
>>
>>
>
>It's surely possible, with a combination of reverse-proxy, delay-pools
>and some ACLs; if you are into testing, you might want to consider using
>squid-3 for the task: in that release the delay-pools have been
>extensively rewritten and should be much more performing, however this
>also means that they are not as well-tested as the 2.5 version.
>
> Francesco
>
>
>
>
Received on Sat May 01 2004 - 14:47:02 MDT

This archive was generated by hypermail pre-2.1.9 : Mon May 31 2004 - 12:00:02 MDT