- 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 totalclass 2 delay pool;delay_parameters pool tatal per-hostclass 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 / # 定义 ACLdelay_pools n # 总共有几个 delay_poolsdelay_class n1 1 # 第 n1 个 delay_pool 的种类是 Class 1delay_class n2 3 # 第 n2 个 delay_pool 的种类是 Class 3delay_class n3 2 # 第 n3 个 delay_pool 的种类是 Class 2delay_access n1 allow landelay_access n1 deny all # 定义 delay_pool n1 的 access ruledelay_parameters n1 64000/64000 # 定义 delay_pool n1 的速度限制,依 class 的不同有不同的定义方式 (请参照上面的说明)[范例说明]1. 限制限制带宽为 512 Kbps
acl all src / # might already be defineddelay_pools 1delay_class 1 1delay_access 1 allow alldelay_parameters 1 64000/64000 # 512 kbits == 64 kbytes per second2. 限制限制单一的带宽为 128 Kbps
acl only128kusers src /acl all src /de
您可能关注的文档
最近下载
- 监理人员的个人工作总结.docx VIP
- 顶管工作井(D=6500)计算书.docx VIP
- 科雷傲驱使用手册.pdf VIP
- 人教版一年级下册数学全册单元教材分析.doc
- 八篇2025年度民主生活会个人“五个方面”对照检查发言材料.docx VIP
- 专题17.阅读理解CD篇专练(新高考地区专用)-2022届新高考英语基础记忆及题型解题技巧(含答案解析).docx VIP
- 义煤集团宜阳义络煤业有限责任公司提升运输系统改造项目环境影响报告书.doc VIP
- 工程拆除安全责任保证书.docx VIP
- 亚洲象人工辅助育幼技术规范.docx VIP
- 2023年青岛远洋船员职业学院单招英语考试题库及答案解析.docx VIP
原创力文档

文档评论(0)