[squid-users] Limiting the bandwidth of certain fyles

From: Xavier Baez <tech@dont-contact.us>
Date: Tue, 27 Apr 2004 14:36:00 -0500

Dear users

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 xhbc@2004 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

Regards

--------------------
S. A. Tech Department
Received on Tue Apr 27 2004 - 13:35:06 MDT

This archive was generated by hypermail pre-2.1.9 : Fri Apr 30 2004 - 12:00:03 MDT