收藏 分销(赏)

squid delay_pools 限制带宽.doc

上传人:pc****0 文档编号:7427799 上传时间:2025-01-04 格式:DOC 页数:6 大小:38.50KB 下载积分:10 金币
下载 相关 举报
squid delay_pools 限制带宽.doc_第1页
第1页 / 共6页
squid delay_pools 限制带宽.doc_第2页
第2页 / 共6页


点击查看更多>>
资源描述
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 0.0.0.0/0.0.0.0 acl lan src 192.168.1.0/255.255.255.0 # 定义 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 0.0.0.0/0.0.0.0 # 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 192.168.1.0/255.255.192.0 acl all src 0.0.0.0/0.0.0.0 delay_pools 1 delay_class 1 3 delay_access 1 allow only128kusers delay_access 1 deny all delay_parameters 1 64000/64000 -1/-1 16000/64000 3. 对某些特定的网站设置不通的带宽限制 (自己尝试一下,如果有错误请自行修改) acl lan_use src 192.168.1.0/255.255.255.0 # 设置 LAN 使用者的 ACL acl kkbox dstdomain .tw # 设置特定域名的 ACL delay_pools 2 # 设置两个 delay_pools delay_class 1 1 # 第一个是 Class 1 的,用來限制总带宽 delay_class 2 2 # 第二个是 Class 2 的,用来限制单一的带宽 delay_access 1 allow kkbox delay_access 1 deny all delay_access 2 allow lan_use delay_access 2 deny all delay_parameters 1 64000/64000 # 不限制指定域名的单一带宽,但对总带宽速作限制 delay_parameters 2 64000/64000 10000/50000 # 限制 LAN 的所有使用者单一带宽,并对总的带宽作以限制 本文来自: E点废墟(www.xok.la) 详细出处参考:http://xok.la/2008/03/squid_limlit_band.html class类型1为单个IP地址流量 class类型2为C类网段中的每个IP地址流量 class类型3为B类网段中的每个C类网段中的每个IP地址流量 所以 类型1只有一个总带宽流量实际也就是这个IP地址的流量 delay_parameters 1 64000/64000 类型2有两个带宽流量参数,第一个为整个C类型网段流量,第二个为每个IP流量 delay_parameters 1 -1/-1 64000/64000 类型3有三个带宽流量参数,第一个为整个B类网总流量,第二个为每个B类网段中的C类网段总流量,第三个为了B类网段中每个C类网段中的每个IP流量 delay_parameters 1 -1/-1 -1/-1 64000/64000 注:   -1/-1表示流量无限制。 斜杆前后两个参数为最小流量与最大流量. 所以看你的情况需要,你只有一个IP地址就用类型1,有一个C类网段就用类型2,有一个B类网段就用类型3. 似乎可以通过将IP地址分组对分别给予不等的带宽; 原文如下: You can also use delay pools to provide different classes of service. For example, you might have important users and unimportant users. In this case, you could use two class 1 delay pools. Give the important users a higher bandwidth limit than everyone else: delay_pools 2 delay_class 1 1 delay_class 2 1 delay_parameters 1 65536/1048576 delay_parameters 2 10000/50000 acl ImportantUsers src 192.168.8.0/22 acl All src 0/0 delay_access 1 allow ImportantUsers delay_access 2 allow All ---------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------- 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 0.0.0.0/0.0.0.0 acl lan src 192.168.1.0/255.255.255.0 # 定义 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 0.0.0.0/0.0.0.0 # 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 192.168.1.0/255.255.192.0 acl all src 0.0.0.0/0.0.0.0 delay_pools 1 delay_class 1 3 delay_access 1 allow only128kusers delay_access 1 deny all delay_parameters 1 64000/64000 -1/-1 16000/64000 3. 对某些特定的网站设置不通的带宽限制 (自己尝试一下,如果有错误请自行修改) acl lan_use src 192.168.1.0/255.255.255.0 # 设置 LAN 使用者的 ACL acl kkbox dstdomain .tw # 设置特定域名的 ACL delay_pools 2 # 设置两个 delay_pools delay_class 1 1 # 第一个是 Class 1 的,用來限制总带宽 delay_class 2 2 # 第二个是 Class 2 的,用来限制单一的带宽 delay_access 1 allow kkbox delay_access 1 deny all delay_access 2 allow lan_use delay_access 2 deny all delay_parameters 1 64000/64000 # 不限制指定域名的单一带宽,但对总带宽速作限制 delay_parameters 2 64000/64000 10000/50000 # 限制 LAN 的所有使用者单一带宽,并对总的带宽作以限制
展开阅读全文

开通  VIP会员、SVIP会员  优惠大
下载10份以上建议开通VIP会员
下载20份以上建议开通SVIP会员


开通VIP      成为共赢上传

当前位置:首页 > 百科休闲 > 其他

移动网页_全站_页脚广告1

关于我们      便捷服务       自信AI       AI导航        抽奖活动

©2010-2026 宁波自信网络信息技术有限公司  版权所有

客服电话:0574-28810668  投诉电话:18658249818

gongan.png浙公网安备33021202000488号   

icp.png浙ICP备2021020529号-1  |  浙B2-20240490  

关注我们 :微信公众号    抖音    微博    LOFTER 

客服