[squid-users] Making Squid limit bandwidth for a internet server

From: Xavier Baez <tech@dont-contact.us>
Date: Sun, 11 Apr 2004 05:10:15 -0500

Dear Squid Members

I want to use Squid in a internet server to:
1) work as an http accelerator
2) work as a proxy cache in order to cache frequent objects in my site
3) limi the bandwidth rate to the end users

Here are the lines that I've added to the standar Squid.conf 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 pass_I_choosed 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 .mp3 .vqf .tar.gz .gz .rpm .zip
.rar .avi .mpeg .mpe .mpg .qt .ram .rm .iso .raw .wav .mov
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 2

#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 5000/150000 5000/150000

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

If anybody needs the install commands I used, here they are:

./configure --prefix=/usr/local/squid-2.5.STABLE5 --enable-delay-pools
--enable-cache-digests --enable-poll --disable-ident-lookups
--enable-truncate --enable-removal-policies; make all; make install

Regards

-- 
Xavier Baez C.
www.SoccerAccess.net
ICQ: 9103394
MSN: xbaez@hotmail.com
Received on Sun Apr 11 2004 - 04:09:09 MDT

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