squid限速问题
squid和nat结合的形式做了一个服务器,为什么限速不成功代码如下visible_hostname NAT162
#
# Recommended minimum configuration:
#
acl manager proto cache_object
acl localhost src 127.0.0.1/32 ::1
acl to_localhost dst 127.0.0.0/8 0.0.0.0/32 ::1
# Example rule allowing access from your local networks.
# Adapt to list your (internal) IP networks from where browsing
# should be allowed
acl localnet src 10.0.0.0/8 # RFC1918 possible internal network
acl localnet src 172.16.0.0/12# RFC1918 possible internal network
acl localnet src 192.168.0.0/16 # RFC1918 possible internal network
acl localnet src fc00::/7 # RFC 4193 local private network range
acl localnet src fe80::/10 # RFC 4291 link-local (directly plugged) machines
acl SSL_ports port 443
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 CONNECT method CONNECT
delay_pools 1
delay_class 1 1
delay_access 1 allow all
delay_parameters 1 50000/50000 # 限制网速在50K以内
delay_initial_bucket_level 50
#
# Recommended minimum Access Permission configuration:
#
# Only allow cachemgr access from localhost
http_access allow manager localhost
http_access deny manager
# Deny requests to certain unsafe ports
http_access deny !Safe_ports
# Deny CONNECT to other than secure SSL ports
http_access deny CONNECT !SSL_ports
# We strongly recommend the following be uncommented to protect innocent
# web applications running on the proxy server who think the only
# one who can access services on "localhost" is a local user
#http_access deny to_localhost
#
# INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS
#
# Example rule allowing access from your local networks.
# Adapt localnet in the ACL section to list your (internal) IP networks
# from where browsing should be allowed
http_access allow localnet
http_access allow localhost
# And finally deny all other access to this proxy
#http_access deny all
http_access allow all
# Squid normally listens to port 3128
#http_port 3128
http_port 3128 transparent
# Uncomment and adjust the following to add a disk cache directory.
#cache_dir ufs /var/spool/squid 100 16 256
# Leave coredumps in the first cache dir
coredump_dir /var/spool/squid
# Add any of your own refresh_pattern entries above these.
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
refresh_pattern . 0 20% 4320
本帖最后由 shang2010 于 2015-09-09 22:15 编辑
对不起,限速在iptable里面实现的啊
因为nat都抽象屏蔽掉了 回复 2# shang2010
不明白。难道透明代理做不了限速吗?
回复 3# mengcun123
不明白,没有研究过
squid基本不做限速,本来就是个镜像服务器的 本帖最后由 woxizishen 于 2015-09-14 11:04 编辑
流量通过squid的绝对能限速,如果经过iptables里直接nat出去的话,你那个限速参数就没作用啊。不管你squid结合什么玩意nat。没经过squid出去的流量,squid他就管不到。
另外squid限速有一个过程:
笔者亲测试,这个功能完全可以胜任企业里的带宽限速功能。说不准确的用户,八成是没有测试仔细,squid进行带宽限速时候,不会因为用户使用超过他的最大限定带宽时候,就会立即把这些用户加起来的总带宽限制到最大带宽以下,他会有一个调整过程,笔者观察到squid需要一段时间后,会把带宽降低到最大带宽以下。所以既然squid开发了这个功能,有对公司带宽质量稳定性比较在乎的,还是需要开启这个功能的。笔者就打个比方,有一次公司高层开远程视频会议,就因为一个用户下载一个几GB数据,造成远程视频会议奇卡,虽然找到了这个用户,但是我们不可能每次都问题发生了再去找原因吧,所以最好的处理问题方式就是预防问题的发生,也就是俗话说的未雨绸缪。
不过如果你公司有硬件防火墙的话,就在防火墙上做就行了。有硬的就不要软,多此一举。 回复 5# woxizishen
领悟了,我做普通squid代理的时候的确限制的很好,限制到200k就是200k,不会有什么问题,后来做透明代理的时候, 发现了问题,现在想来的确是的。我们公司有还有一条电信线路,这条线路是不是经过防火墙的,只是通过路由上网到该线路,所以没有限制,导致经常性的卡,也没法限制客户,所以才想通过squid透明代理限速,看起来不起作用。
页:
[1]