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

2009-04-23 Thread Wilson Hernandez - MSD, S. A.

I have a similar script but, I'm doing the filtering with iptables:

$iptables -t mangle -A FORWARD -s 192.168.2.100 -j MARK --set-mark 1
$iptables -t mangle -A FORWARD -d 192.168.2.100 -j MARK --set-mark 1

$iptables -t mangle -A FORWARD -d 192.168.2.101 -j MARK --set-mark 2
$iptables -t mangle -A FORWARD -d 192.168.2.101 -j MARK --set-mark 2

... and so on.

$tc qdisc del dev eth1 root

$tc qdisc add dev eth1 root handle 1:0 htb default 20 r2q 1

# Class
$tc class add dev eth1 parent 1:   classid 1:1 htb rate 384kbit ceil 384kbit
$tc class add dev eth1 parent 1:2  classid 1:2 htb rate 200kbit ceil 200kbit
$tc class add dev eth1 parent 1:3  classid 1:3 htb rate 100kbit  ceil 
150kbit


$tc qdisc add dev eth1 parent 1:2 handle 20: sfq perturb 10
$tc qdisc add dev eth1 parent 1:3 handle 30: sfq perturb 10

$tc filter add dev eth1 protocol ip parent 1:0 prio 1 handle 1 fw 
classid 1:2
$tc filter add dev eth1 protocol ip parent 1:0 prio 1 handle 2 fw 
classid 1:3

 more filtering.



Everytime I test with squid running I don't get a correct speed I'm 
supposed to obtain but, when I disable squid and run a test, I get the 
correct speed on both computers: 194 - 200 max for 192.168.1.100 and 96 
- 99 for 192.168.2.101. When I run the test with squid running I get 
different speeds on both machines ranging from 50 to 300.


I know it sounds strange but, I've ran the tests too many times now and 
I get the same results.


I'm using squid 3.0 STABLE 11.

Thanks.

Indunil Jayasooriya wrote:

On Wed, Apr 22, 2009 at 2:55 PM, Amos Jeffries squ...@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
$FULLBANDWIDTHKbit
tc class add dev $INTERFAZ_LAN parent 1:1 classid 1:10 htb rate
$BANDWIDTH4LANKbit
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.







--
*Wilson Hernandez*
Presidente
829.848.9595
809.766.0441
www.msdrd.com http://www.msdrd.com
Conservando el medio ambiente


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

2009-04-22 Thread Amos Jeffries

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?


Answer to both is yes. Though how is not known to me at this point.

Squid is capable of setting a mixture of outbound QoS flags. Information 
about using those with iptables etc seems to be fine. But when people 
throw TC into the mix with newer Squid something appears in the routing 
behavior that we have no documented info about.


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



Amos
--
Please be using
  Current Stable Squid 2.7.STABLE6 or 3.0.STABLE14
  Current Beta Squid 3.1.0.7


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

2009-04-22 Thread Indunil Jayasooriya
On Wed, Apr 22, 2009 at 2:55 PM, Amos Jeffries squ...@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
$FULLBANDWIDTHKbit
tc class add dev $INTERFAZ_LAN parent 1:1 classid 1:10 htb rate
$BANDWIDTH4LANKbit
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