第三章 squid delay_pools 限制带宽.docVIP

  • 31
  • 0
  • 约6.22千字
  • 约 6页
  • 2017-07-08 发布于湖北
  • 举报
squid限制带宽 squid限制带宽 关于设定SQUID带宽限制和流量整形,刻利用squid.conf种的delay_pools字段来完成. delay pools里的bucket就像是一个容器,而这个容器就是squid要控制带宽用的,当容器到达所设定的容量时,这个容器的所有者就无法超过我们所设定的带宽限制,所有的bucket则称之为unified bucket. Class分为三种: (1)Class 1:包含一个unified bucket,而这个bucket是给这个class里所定义的host使用. (2)Class 2:包含一个unified bucket和255个buckets,每一个bucket分配给8bit网络的使用者(255 hosts)使用IPv4 class C). (3)Class 3:包含255个buckets,每一个bucket分配给16bit网络的使用者(65535 hosts)使用(IPv4 class B). (1)Class 1:contains a single unified bucket which is used for all requests from hosts subject to the pool (2)Class 2:contains one unified bucket and 255 buckets, one for each host on an 8-bit network (IPv4 class C) (3)Class 3:contains 255 buckets for the subnets in a 16-bit network, and individual buckets for every host on these networks (IPv4 class B) 推测:如果ACL只定义一个class C字段,要限制每个host的单一带宽,可以使用Class 2来做;但如果ACL有定义好几个class C字段,使用Class 3可再对各个class C字段做个别的总带宽限制 delay_parameters语法: class 1 delay pool; delay_parameters pool total class 2 delay pool; delay_parameters pool tatal per-host class 3 delay pool; delay_parameters pool total network per-host 每个delay_parameters的数值是由restore(byte/sec)/max(bytes)组成,restore是表示以bytes/sec的速度下载object到bucket里,而max则表示bucket的bytes值. 备注1:如果要设定为unilit speed的话,将数值设定为-1即可 备注2:SQUID FAQ中有提到,建议max至少要设为restore的两倍(It is recommended that the maximum is at least twice the restore value) [设定文档格式说明] acl all src / acl lan src / # 定义 ACL delay_pools n # 总共有几个 delay_pools delay_class n1 1 # 第 n1 个 delay_pool 的种类是 Class 1 delay_class n2 3 # 第 n2 个 delay_pool 的种类是 Class 3 delay_class n3 2 # 第 n3 个 delay_pool 的种类是 Class 2 delay_access n1 allow lan delay_access n1 deny all # 定义 delay_pool n1 的 access rule delay_parameters n1 64000/64000 # 定义 delay_pool n1 的速度限制,依 class 的不同有不同的定义方式 (请参照上面的说明) [范例说明] 1. 限制限制带宽为 512 Kbps acl all src / # might already be defined delay_pools 1 delay_class 1 1 delay_access 1 allow all delay_parameters 1 64000/64000 # 512 kbits == 64 kbytes per second 2. 限制限制单一的带宽为 128 Kbps acl only128kusers src / acl all src / de

文档评论(0)

1亿VIP精品文档

相关文档