อยากถามเรื่อง delay_pool ของ squid ครับ
HomeUsers FAQMS Windows 7 & Office 2010Free Software & Open SourcesDonate & AdsCalendar Help Login Register
 



Lenovo Call Center : 02-273-4088 more ... Facebook Pages
@Twitter

Username  
Password

Pages: [1]   Go Down
  Send this topic  |  Print  
Author Topic: อยากถามเรื่อง delay_pool ของ squid ครับ  (Read 454 times)
0 Members and 1 Guest are viewing this topic.
mhoa
ThinkPad R Series
*

Feedback: +0/-0
Offline Offline

Gender: Male
Posts: 69

Thank You
-Given: 0
-Receive: 0

mhoaz@hotmail.com
Email
« on: December 23, 2009, 03:51:23 pm »
Thank YouThank You

OS : Ubuntu Server 9.10
Proxy : Squid 2.7
Database : MySQL

ผมอยากทราบวิธีจำกัดความเร็วในการ Download ไฟล์ต่างๆ ในแต่ละช่วง ip อ่ะครับ
เช่นผมมี ip อยู่ 3 กลุ่ม
กลุ่ม 1 ip 192.168.2.200 - 192.168.2.209
กลุ่ม 2 ip 192.168.2.210 - 192.168.2.219
กลุ่ม 3 ip 192.168.2.220 - 192.168.2.229
โดยอยากให้กลุ่มที่ 1 สามารถเล่นเน็ตโหลดไฟล์ได้ตามปกติ กลุ่ม 2 และ 3 มีการจำกัดความเร็วในการ Download
โดยที่ squid ผมได้ config ไว้ดังนี้ครับ

Code:
# -----------------------------------------------------------------------------
# SQUID 2.7.STABLE6 CONFIGURATION XXX
# -----------------------------------------------------------------------------

# -----------------------------------------------------------------------------
# NETWORK OPTION
# -----------------------------------------------------------------------------

http_port 8080

# -----------------------------------------------------------------------------
# ACCESS CONTROLS
# -----------------------------------------------------------------------------

acl all src all

acl manager proto cache_object
acl localhost src 127.0.0.1/32
acl localnet src 192.168.2.0/24

acl SSL_ports port 443 # https
acl SSL_ports port 563 # snews
acl SSL_ports port 873 # rsync
acl Safe_ports port 80 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 # https
acl Safe_ports port 70 # gopher
acl Safe_ports port 210 # wais
acl Safe_ports port 1025-65535 # unregistered ports
acl Safe_ports port 280 # http-mgmt
acl Safe_ports port 488 # gss-http
acl Safe_ports port 591 # filemaker
acl Safe_ports port 777 # multiling http
acl Safe_ports port 631 # cups
acl Safe_ports port 873 # rsync
acl Safe_ports port 901 # SWAT
acl purge method PURGE
acl CONNECT method CONNECT

http_access allow manager localhost
http_access deny manager
http_access allow purge localhost
http_access deny purge
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports

http_access allow localnet
http_access allow localhost

http_access deny all

icp_access allow localnet
icp_access deny all

# -----------------------------------------------------------------------------
# OPTIONS WHICH AFFECT THE NEIGHBOR SELECTION ALGORITHM
# -----------------------------------------------------------------------------

hierarchy_stoplist cgi-bin ? .acgi .asp .cgi .css .chtml .htm .html .jhtml .js .jsp .perl .phtml .pl .php .php3 .php4 .shtml .xhtml .xml

acl QUERY urlpath_regex cgi-bin \? \.acgi \.asp \.cgi \.css \.chtml \.htm \.html \.jhtml \.js \.jsp \.perl \.phtml \.pl \.php \.php3 \.php4 \.shtml \.xhtml \.xml

no_cache deny QUERY

# -----------------------------------------------------------------------------
# MEMORY CACHE OPTIONS
# -----------------------------------------------------------------------------

cache_mem 32 MB

maximum_object_size_in_memory 16 KB

memory_replacement_policy heap LFUDA

# -----------------------------------------------------------------------------
# DISK CACHE OPTIONS
# -----------------------------------------------------------------------------

cache_dir aufs /var/spool/squid 6144 16 256

maximum_object_size 20480 KB

cache_replacement_policy LFUDA

store_dir_select_algorithm round-robin

cache_swap_low 90

cache_swap_high 95

# -----------------------------------------------------------------------------
# LOGFILE OPTIONS
# -----------------------------------------------------------------------------

logformat common %{%Y-%m-%d %H:%M:%S}tl %6tr %>a %Ss/%03Hs %<st %rm %ru %un %Sh/%<A %mt

access_log /var/log/squid/access.log common

cache_log /var/log/squid/cache.log

cache_store_log none

logfile_daemon /usr/lib/squid/logfile-daemon

mime_table /usr/share/squid/mime.conf

pid_filename /var/run/squid.pid

# -----------------------------------------------------------------------------
# OPTIONS FOR TUNING THE CACHE
# -----------------------------------------------------------------------------

refresh_pattern -i .(class|pdf|rtf|doc|wp|wp5|ps|prn)$ 1440 90% 1440 override-lastmod override-expire reload-into-ims ignore-reload
refresh_pattern -i .(mov|avi|mpg|wav|au|mid|mp3)$ 1440 100% 1440 override-lastmod override-expire reload-into-ims ignore-reload
refresh_pattern -i .(zip|gz|arj|lha|lzh|rar|tgz|tar|Z)$ 1440 80% 1440 override-lastmod override-expire reload-into-ims ignore-reload
refresh_pattern -i .(jpg|gif|jpeg|png|css|js)$ 1440 19000% 1440 override-lastmod override-expire reload-into-ims ignore-reload
refresh_pattern -i .(bmp|tif|tiff|xbm)$ 1440 17000% 1440 override-lastmod override-expire reload-into-ims ignore-reload
refresh_pattern -i .(png|swf)$ 1440 18000% 1440 override-lastmod override-expire reload-into-ims ignore-reload
refresh_pattern ^http://.*\.*$ 0 20% 1440
refresh_pattern ^ftp://.*\.*$ 0 20% 1440
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
refresh_pattern (Release|Package(.gz)*)$ 0 20% 2880
refresh_pattern . 0 20% 4320

# -----------------------------------------------------------------------------
# HTTP OPTIONS
# -----------------------------------------------------------------------------

ie_refresh on

vary_ignore_expire on

extension_methods REPORT MERGE MKACTIVITY CHECKOUT

# -----------------------------------------------------------------------------
# TIMEOUTS
# -----------------------------------------------------------------------------

half_closed_clients on

# -------------------------------------------------------------------------------------------------------------------------------------------------------------------- #
# MISCELLANEOUS
# -------------------------------------------------------------------------------------------------------------------------------------------------------------------- #

reload_into_ims on

# -----------------------------------------------------------------------------
# DELAY POOL PARAMETERS
# -----------------------------------------------------------------------------

delay_pools 3

delay_class 1 2
delay_parameters 1 -1/-1 -1/-1
delay_access 1 allow ip_programmer !all

delay_class 2 2
delay_parameters 2 20480/20480 20480/20480
delay_access 2 allow ip_support !all

delay_class 3 2
delay_parameters 3 20480/20480 20480/20480
delay_access 3 allow ip_print !all

# -----------------------------------------------------------------------------
# ICP OPTIONS
# -----------------------------------------------------------------------------

icp_port 3128

# -----------------------------------------------------------------------------
# DNS OPTIONS
# -----------------------------------------------------------------------------

hosts_file /etc/hosts

# -----------------------------------------------------------------------------
# Copyright 2009 XXX All Rights Reserved
# -----------------------------------------------------------------------------

ปัญหาที่เจอคือ
1. ทำไมมันไม่ยอมบีบ bandwith ตามที่เรากำหนดแต่ละช่วงอ่ะครับ
2. ทำยังไงเพื่อไม่ให้ ip ที่ไม่อยู่ในช่วงที่แบ่งกลุ่มไว้เล่นเน็ตได้ครับ หรือว่าต้อง config ที่ตัว acl localnet src 192.168.2.0/24
3. จะจำกัดเวลาในการบีบ bandwith ทำยังไงครับ
   เช่น จะจำกัด ให้บีบ bandwith ในช่วง MTWHF 07:30-18:00 อ่ะครับ นอกวันเวลานี้สามารเล่นได้ตามปกติเลยครับ

ถ้ายาวไปขออภัยด้วยครับ

รบกวนขอตัวอย่างในการเซ็ต บางส่วนที่สงสัยด้วยครับ
« Last Edit: December 23, 2009, 03:59:00 pm by mhoa » Report to moderator   Logged

T400 2767-CTO Intel Core 2 Duo P8400 + DDR3 4GB + HDD 160GB 5400rpm + 14.1" WXGA + WLAN Intel 5100 + VGA Intel X4500M HD / ATI3470 + Windows 7 Pro 64 Bit MSDN
tsunin
ThinkPad R Series
*

Feedback: +5/-0
Offline Offline

Posts: 69

Thank You
-Given: 0
-Receive: 0


« Reply #1 on: February 21, 2010, 10:27:34 pm »
Thank YouThank You

1 กะ 2 นี่ไม่รู้ครับเพราะไม่เคยทำ แต่ 3 ใช้ Crontab ช่วย โดยการที่มี squid.conf มากกว่า 1 อันเช่น

9.00-17.00 = peakhour-squid.conf
18.00 - 07.00 = offpeak-squid.conf

แล้วทำ shell script ง่าย ทำการ rename conf file ไปเป็น squid.conf แล้วตามด้วย squid -k reconfigure
จากนั้นก็เอา shell script ตัวนี้ไปไว้ใน crontab เพราะให้สามารถ rename file ได้ตามกำหนดเวลา

Report to moderator   Logged
Pages: [1]   Go Up
  Send this topic  |  Print  
 
Jump to:  



This web page has NOTHING what-so-ever to do with IBM or Lenovo. About Trademarks.

Powered Web Hosting by MyStck with Dell PowerEdge SC1425 Server, Memory for Server by Memory Today and Operating System by Ubuntu Server 8.10.