Re: [squid-users] Squid and TC - Traffic Shaping

From: Indunil Jayasooriya <indunil75_at_gmail.com>
Date: Thu, 23 Apr 2009 09:11:35 +0530

On Wed, Apr 22, 2009 at 2:55 PM, Amos Jeffries <squid3_at_treenet.co.nz> wrote:
> Wilson Hernandez - MSD, S. A. wrote:
>>
>> Hello.
>>
>> I was writing a script to control traffic on our network. I created my
>> rules with tc and noticed that it wasn't working correctly.
>>
>> I tried this traffic shaping on a linux router that has squid doing
>> transparent cache.
>>
>> When measuring the download speed on speedtest.net the download speed is
>> 70kbps when is supposed to be over 300kbps. I found it strange since
>> I've done traffic shaping in the past and worked but not on a box with
>> squid. I stopped the squid server and ran the test again and it gave me
>> the speed I assigned to that machine. I assigned different bw and the
>> test gave the correct speed.
>>
>> Have anybody used traffic shaping (TC in linux) on a box with squid? Is
>> there a way to combine both a have them work side by side?

About 2years ago, I used the below script on a CentOS 4.4 box acting
as a firewall (iptables), routing (iproute2) and squid 2.5 transparent
intercepting.

#traffic shaping on eth1 - i.e: LAN INTERFACE (For Downloading). eth0
is connected to the Internet

INTERFAZ_LAN=eth1
FULLBANDWIDTH=256
BANDWIDTH4LAN=64

tc qdisc del root dev $INTERFAZ_LAN

tc qdisc add dev $INTERFAZ_LAN root handle 1: htb r2q 4
tc class add dev $INTERFAZ_LAN parent 1: classid 1:1 htb rate
"$FULLBANDWIDTH"Kbit
tc class add dev $INTERFAZ_LAN parent 1:1 classid 1:10 htb rate
"$BANDWIDTH4LAN"Kbit
tc qdisc add dev $INTERFAZ_LAN parent 1:10 handle 10: sfq perturb 10
tc filter add dev $INTERFAZ_LAN parent 1: protocol ip prio 1 u32 match
ip dst 192.168.100.0/24 classid 1:10

192.168.100.0/24 is my LAN RANGE.

According to the above script, My FULL bandwidth was 256 kbit. I
allocated 64 kbit for downloading. it is actually NOTHING to do with
squid for me. ALL went fine with iproute2 pkg.

> I am also seeking a TC expert to help several users already needing to use
> it with TPROXYv4 and/or WCCP setups.

I am NOT a tc expert. just a guy with an interest.

-- 
Thank you
Indunil Jayasooriya
Received on Thu Apr 23 2009 - 03:41:45 MDT

This archive was generated by hypermail 2.2.0 : Thu Apr 23 2009 - 12:00:01 MDT