- 论坛徽章:
- 0
|
本帖最后由 花花宝瓶 于 2013-03-14 14:53 编辑
刚注册就来发表一个求助帖
系统环境:centos5.5 搭建squid透明代理服务器+TC限速,squid2.6版本
squid.conf配置如下:
http_port 192.168.0.79:3128 transparent
cache_mem 128 MB
cache_swap_low 85
cache_swap_high 95
maximum_object_size 40960 KB
minimum_object_size 1 bytes
cache_dir ufs /var/spool/squid 20480 16 256
cache_log /var/log/squid/cache.log
cache_access_log /var/log/squid/access.log
cache_store_log /var/log/squid/store.log
cache_mgr abc@qq.com
cache_effective_user squid
cache_effective_group squid
visible_hostname 192.168.0.79
dns_nameservers 202.96.64.68
error_directory /usr/share/squid/errors/Simplify_Chinese
acl all src 0.0.0.0/0.0.0.0
http_access allow all
可以运行正常使用,代理 192.168.0.80的客户端电脑上网
TC写的是脚本,内容如下:
#!/bin/bash
IDEV="eth0"
Download=6kbit
INET="192.168.0."
IPS="70"
IPE="80"
tc qdisc del dev ${IDEV} root 2>/dev/null
tc qdisc add dev ${IDEV} root handle 10: htb default 10
tc class add dev ${IDEV} parent 10: classid 10:1 htb rate 10kbit ceil 10kbit
tc class add dev ${IDEV} parent 10:1 classid 10:10 htb rate 10kbit ceil 10kbit prio 0
tc filter add dev ${IDEV} parent 10: protocol ip prio 1 handle 10 fw classid 10:10
i=$IPS;
while [ $i -le $IPE ]
do
tc class add dev ${IDEV} parent 10:1 classid 10:1${i} htb rate ${Download} ceil ${Download} prio 20
tc filter add dev ${IDEV} parent 10: protocol ip prio 20 handle 2${i} fw classid 10:1${i}
iptables -t mangle -A POSTROUTING -d ${INET}${i} -j MARK --set-mark 2${i}
iptables -t mangle -A POSTROUTING -s ${INET}${i} -j MARK --set-mark 2${i}
i=`expr ${i} + 1`
done
for ip in $VIP
do
iptables -t mangle -A POSTROUTING -d ${ip} -j MARK --set-mark 10
iptables -t mangle -A POSTROUTING -s ${ip} -j MARK --set-mark 10
echo "${ip}"
done
限制内网用户下载速度为6KB/S 最大10KB/S,脚本成功运行
测试,在centos5.5本机下载速度就会达到限制的速度维持在6~15KB/s, 客户端192.168.0.80下载速度却没有限制在6~15kb/s,速度达到总带宽的峰值
客户端IP地址填写如下:
ip 192.168.0.80
掩码 255.255.255.0
网关 192.168.0.79(squid代理服务器地址)
DNS 202.96.64.68
我感觉代理用户可能通过代理服务器绕过带宽限制了
请教一下大神们这是怎么一个原因呢?哪里错了?或者少写语句了?
|
|