This is a discussion on [Fwd: [squid-users] Making Squid limit bandwidth for a internet server] - squid ; Does anybody has any idea of how to limit bandwidth (specially when downloading files: ZIP, EXE... from my site) for my end users? Please read my previous post if you need config info Dear Squid Members I want to use ...
Does anybody has any idea of how to limit bandwidth (specially when
downloading files: ZIP, EXE... from my site) for my end users?
Please read my previous post if you need config info
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:
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
http_access allow all
cachemgr_passwd pass_I_choosed all
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
#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
Xavier Baez C.
Xavier Baez C.