要實(shí)現(xiàn)限制網(wǎng)速的功能,你得重新編譯squid,激活-enable-delay-pools選項(xiàng) 。方法如下:
1、下載squid源碼 (到官方網(wǎng)站)
2、編譯squid
1)安裝 gcc make
2)準(zhǔn)備編譯,即配置源碼中的configure
#cd 源碼目錄
#chmod a+x ./configure
#./configure -prefix=/usr -localstatedir=/var -libexecdir=${prefix}/lib/squid -datadir=${prefix}/share/squid -sysconfdir=/etc/squid -enable-delay-pools -enable-snmp -enable-cache-digests -enable-basic-auth-helpers=NCSA -enable-external-acl-helpers=wbinfo_group -enable-external-acl-helpers=winbind_group -enable-ntlm-auth-helpers=SMB
這是我的服務(wù)器的配置,你可以根據(jù)你的情況來(lái)選擇激活那些選項(xiàng)。
3)編譯并安裝
#make
#make install
4)配置squid.conf
添加以下行:
delay_pools 1
delay_class 1 1
delay_access 1 allow all
delay_parameters 1 50000/50000 # 限制網(wǎng)速在50K以內(nèi)
delay_initial_bucket_level 50
以上僅是為了實(shí)現(xiàn)限制網(wǎng)速而添加的配置,其他的配置就不提了。
5)啟動(dòng)squid
#squid