[LARTC] CBQ Problem

Ricardo linux@netcomp.com.br
Wed, 28 Jul 2004 15:57:26 -0300


This is a multi-part message in MIME format.

------=_NextPart_000_0037_01C474BB.93FEEB40
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

    Hi.

    I want to shape traffic from some IPs in my lan, but I'm w/ trouble. =
I have a linux box connected to the Internet. In the other side of this =
box is my LAN. I want to create the following scenario:
=20
My root qdisc is attached to a 100Mbit/s NIC
I want to create a class attached to this qdisc that will limit the =
traffic at 384Kbit/s.
I want to create two leaf classes that limits the traffic at 256Kbit/s.
I want to attach two sfq qdiscs so two classes are treated equally.
I want to put one LAN IP for each leaf class.
When one IP is downloading a file from internet it will never be more =
than 256Kbit.
When both IPs is downloading files at the same time, they will never be =
more than 384Kbit.

(I think that is something like the webserver + smtp example  that is in =
the howto)

My config:

tc qdisc add dev eth1 root handle 1:0 cbq bandwidth 100Mbit avpkt 1000 =
cell 8
tc class add dev eth1 parent 1:0 classid 1:1 cbq bandwidth 100Mbit rate =
384Kbit weight 38Kbit prio 8 allot 1514 cell 8 maxburst 20 avpkt 1000 =
bounded

tc class add dev eth1 parent 1:1 classid 1:10 cbq bandwidth 100Mbit rate =
256Kbit weight 25Kbit prio 8 allot 1514 cell 8 maxburst 20 avpkt 1000
tc class add dev eth1 parent 1:1 classid 1:20 cbq bandwidth 100Mbit rate =
256Kbit weight 25Kbit prio 8 allot 1514 cell 8 maxburst 20 avpkt 1000

tc qdisc add dev eth1 parent 1:10 handle 100: sfq
tc qdisc add dev eth1 parent 1:20 handle 200: sfq

tc filter add dev eth1 parent 1:0 protocol ip prio 1 u32 match ip dst =
10.0.0.2/32 flowid 1:10
tc filter add dev eth1 parent 1:0 protocol ip prio 1 u32 match ip dst =
10.0.0.3/32 flowid 1:20

When I start a download from one machine, the speed is limited at =
256Kbit/s (this is OK)
When I start a download from both machines, the speed for each machine =
is limited to 256Kbit/s. They are getting 512Kbit/s together.=20
I want limit this speed at 384Kbit/s, so traffic from each machine will =
never be more than 192Kbps when both are in use.

Why it is not working for me ??? What is the mistake ?
Thank You.

Ricardo
------=_NextPart_000_0037_01C474BB.93FEEB40
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1400" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>
<DIV>&nbsp;&nbsp;&nbsp; Hi.<BR><BR>&nbsp;&nbsp;&nbsp; I want to shape =
traffic=20
from some IPs in my lan, but I'm w/ trouble. I have a linux box =
connected to the=20
Internet. In the other side of this box is my LAN. I want to create the=20
following scenario:<BR>&nbsp;</DIV>
<DIV>My root qdisc is attached to a 100Mbit/s NIC</DIV>
<DIV>I want to create a class attached to this qdisc that will limit=20
the&nbsp;traffic at 384Kbit/s.</DIV>
<DIV>I want to create&nbsp;two leaf classes that limits the&nbsp;traffic =
at=20
256Kbit/s.</DIV>
<DIV>I want to attach two&nbsp;sfq qdiscs so two classes are treated=20
equally.</DIV>
<DIV>I want to&nbsp;put one LAN IP for each leaf class.</DIV>
<DIV>When one IP is downloading a file from internet it will never be =
more than=20
256Kbit.</DIV>
<DIV>When both IPs is downloading files at the same time, they will =
never be=20
more than 384Kbit.</DIV>
<DIV>&nbsp;</DIV>
<DIV>(I think that is something like the webserver + smtp example&nbsp; =
that is=20
in the howto)</DIV>
<DIV>&nbsp;</DIV>
<DIV>My config:</DIV>
<DIV>&nbsp;</DIV>
<DIV>tc qdisc add dev eth1 root handle 1:0 cbq bandwidth 100Mbit avpkt =
1000 cell=20
8<BR>tc class add dev eth1 parent 1:0 classid 1:1 cbq bandwidth 100Mbit =
rate=20
384Kbit weight 38Kbit prio 8 allot 1514 cell 8 maxburst 20 avpkt 1000=20
bounded</DIV>
<DIV>&nbsp;</DIV>
<DIV>tc class add dev eth1 parent 1:1 classid 1:10 cbq bandwidth 100Mbit =
rate=20
256Kbit weight 25Kbit prio 8 allot 1514 cell 8 maxburst 20 avpkt =
1000<BR>tc=20
class add dev eth1 parent 1:1 classid 1:20 cbq bandwidth 100Mbit rate =
256Kbit=20
weight 25Kbit prio 8 allot 1514 cell 8 maxburst 20 avpkt 1000</DIV>
<DIV>&nbsp;</DIV>
<DIV>tc qdisc add dev eth1 parent 1:10 handle 100: sfq<BR>tc qdisc add =
dev eth1=20
parent 1:20 handle 200: sfq</DIV>
<DIV>&nbsp;</DIV>
<DIV>tc filter add dev eth1 parent 1:0 protocol ip prio 1 u32 match ip =
dst=20
10.0.0.2/32 flowid 1:10<BR>tc filter add dev eth1 parent 1:0 protocol ip =
prio 1=20
u32 match ip dst 10.0.0.3/32 flowid 1:20<BR></DIV>
<DIV>When I start a download from one machine, the speed is limited at =
256Kbit/s=20
(this is OK)</DIV>
<DIV>When I start a download from both machines, the speed for each =
machine is=20
limited to 256Kbit/s. They are getting 512Kbit/s together.&nbsp;</DIV>
<DIV>I want limit this speed at 384Kbit/s, so traffic from each machine =
will=20
never be&nbsp;more than&nbsp;192Kbps when both are in use.</DIV>
<DIV>&nbsp;</DIV>
<DIV>Why it is not working for me ??? What is the mistake ?</DIV>
<DIV>Thank You.</DIV>
<DIV>&nbsp;</DIV>
<DIV>Ricardo</DIV></FONT></DIV></BODY></HTML>

------=_NextPart_000_0037_01C474BB.93FEEB40--