Skip to contentSkip to conversation

Linux Traffic Control limited to only 1 split of classes??

LARTC Rick Goh Siow Mong [email protected] 1 participant 2 messages Feb 3, 2001 – Feb 4, 2001

lore
Share & tools
lore

Rick Goh Siow Mong [email protected]

author
#0 lore raw

<PRE>Hi all,
The script below works partially. Please help me figure out why.

What happen is this:
1. Split eth0 into 2 classes; Sales and Engine. --&gt; depth 1
2. Split further Sales into 2 classes; SalesMan and SalesManager. --&gt;
depth2

3.    Run the script.
4.    TC to depth 1 Engine works. Limited bandwidth.
5.    TC to depth 2 Sales DOESN'T work. Gets all the bandwidth.

Apparently, after further test, it shows that once I split more than once, traffic control breaks down.
I hope you can help me figure out if my script is missing something... or that is it a bug in the code itself??

Regards,
Rick Goh.

************************************************
#!/bin/sh
#
# Startup script for Linux Traffic Control
#

device=&quot;eth0&quot;
total=&quot;1Mbit&quot;
sales=&quot;500Kbit&quot;
engine=&quot;500Kbit&quot;
sales_man=&quot;100Kbit&quot;
sales_manager=&quot;400Kbit&quot;
ip_salesman=&quot;192.168.1.10&quot;
ip_salesmanager=&quot;192.168.1.20&quot;
ip_engine=&quot;192.168.1.30&quot;

#Del qdisc to eth0
tc qdisc del dev $device root handle 1:

#Attach qdisc to eth0 and 2 different class; sales &amp; engine --&gt; depth 1 tc qdisc add dev $device root handle 1: cbq bandwidth $total avpkt 1000 tc class add dev $device parent 1:0 classid 1:1 cbq bandwidth $total \
rate $total allot 1514 weight 100Kbit prio 8 maxburst 20 avpkt 1000
tc class add dev $device parent 1:1 classid 1:10 cbq bandwidth $total \
rate $sales allot 1514 weight 50Kbit prio 3 maxburst 20 avpkt 1000
bounded
tc class add dev $device parent 1:1 classid 1:20 cbq bandwidth $total \
rate $engine allot 1514 weight 50Kbit prio 7 maxburst 20 avpkt 1000
bounded

###New qdisc for Sales --&gt; depth 2
tc qdisc add dev $device parent 1:10 handle 10: cbq bandwidth $sales avpkt 1000

###2 classes for Sales
tc class add dev $device parent 10:0 classid 10:1 cbq bandwidth $sales \
rate $sales allot 1514 weight 50Kbit prio 6 maxburst 20 avpkt 1000
tc class add dev $device parent 10:1 classid 10:2 cbq bandwidth $sales \
rate $sales_man allot 1514 weight 10Kbit prio 2 maxburst 20 avpkt 1000
tc class add dev $device parent 10:1 classid 10:3 cbq bandwidth $sales \
rate $sales_manager allot 1514 weight 40Kbit prio 1 maxburst 20 avpkt
1000

#############FILTER############

# Depth 1
tc filter add dev $device parent 1:0 protocol ip prio 25 u32 match \
ip dst $ip_engine flowid 1:20

# Depth 2
tc filter add dev $device parent 10:0 protocol ip prio 25 u32 match \
ip dst $ip_salesman flowid 10:2
tc filter add dev $device parent 10:0 protocol ip prio 100 u32 match \
ip dst $ip_salesmanager flowid 10:3

</PRE>

author
#1 lore raw

<PRE>Hi all, problem solved.

Forgot to add the route. =)

Thank you Marian Jancar.

----- Original Message -----
From: &quot;Rick Goh Siow Mong&quot; &lt;<A HREF="mailto:[email protected]">[email protected]</A>&gt;
To: &quot;lartc&quot; &lt;<A HREF="mailto:[email protected]">[email protected]</A>&gt;
Sent: Sunday, February 04, 2001 6:03 AM
Subject: [LARTC] Linux Traffic Control limited to only 1 split of classes??

&gt;<i> Hi all,
</I>&gt;<i> The script below works partially. Please help me figure out why. </I>&gt;<i>
</I>&gt;<i> What happen is this:
</I>&gt;<i> 1. Split eth0 into 2 classes; Sales and Engine. --&gt; depth 1
</I>&gt;<i> 2. Split further Sales into 2 classes; SalesMan and SalesManager. --&gt;
</I>&gt;<i> depth2

</I>&gt;<i> 3.    Run the script.
</I>&gt;<i> 4.    TC to depth 1 Engine works. Limited bandwidth.
</I>&gt;<i> 5.    TC to depth 2 Sales DOESN'T work. Gets all the bandwidth.

</I>&gt;<i>
</I>&gt;<i> Apparently, after further test, it shows that once I split more than once,
</I>&gt;<i> traffic control breaks down.
</I>&gt;<i> I hope you can help me figure out if my script is missing something... or
</I>&gt;<i> that is it a bug in the code itself??
</I>&gt;<i>
</I>&gt;<i> Regards,
</I>&gt;<i> Rick Goh.
</I>&gt;<i>
</I>&gt;<i> ************************************************
</I>&gt;<i> #!/bin/sh
</I>&gt;<i> #
</I>&gt;<i> # Startup script for Linux Traffic Control
</I>&gt;<i> #
</I>&gt;<i>
</I>&gt;<i> device=&quot;eth0&quot;
</I>&gt;<i> total=&quot;1Mbit&quot;
</I>&gt;<i> sales=&quot;500Kbit&quot;
</I>&gt;<i> engine=&quot;500Kbit&quot;
</I>&gt;<i> sales_man=&quot;100Kbit&quot;
</I>&gt;<i> sales_manager=&quot;400Kbit&quot;
</I>&gt;<i> ip_salesman=&quot;192.168.1.10&quot;
</I>&gt;<i> ip_salesmanager=&quot;192.168.1.20&quot;
</I>&gt;<i> ip_engine=&quot;192.168.1.30&quot;
</I>&gt;<i>
</I>&gt;<i> #Del qdisc to eth0
</I>&gt;<i> tc qdisc del dev $device root handle 1:
</I>&gt;<i>
</I>&gt;<i> #Attach qdisc to eth0 and 2 different class; sales &amp; engine --&gt; depth 1
</I>&gt;<i> tc qdisc add dev $device root handle 1: cbq bandwidth $total avpkt 1000
</I>&gt;<i> tc class add dev $device parent 1:0 classid 1:1 cbq bandwidth $total \
</I>&gt;<i> rate $total allot 1514 weight 100Kbit prio 8 maxburst 20 avpkt 1000
</I>&gt;<i> tc class add dev $device parent 1:1 classid 1:10 cbq bandwidth $total \
</I>&gt;<i> rate $sales allot 1514 weight 50Kbit prio 3 maxburst 20 avpkt 1000
</I>&gt;<i> bounded
</I>&gt;<i> tc class add dev $device parent 1:1 classid 1:20 cbq bandwidth $total \
</I>&gt;<i> rate $engine allot 1514 weight 50Kbit prio 7 maxburst 20 avpkt 1000
</I>&gt;<i> bounded
</I>&gt;<i>
</I>&gt;<i>
</I>&gt;<i> ###New qdisc for Sales --&gt; depth 2
</I>&gt;<i> tc qdisc add dev $device parent 1:10 handle 10: cbq bandwidth $sales avpkt
</I>&gt;<i> 1000
</I>&gt;<i>
</I>&gt;<i> ###2 classes for Sales
</I>&gt;<i> tc class add dev $device parent 10:0 classid 10:1 cbq bandwidth $sales \
</I>&gt;<i> rate $sales allot 1514 weight 50Kbit prio 6 maxburst 20 avpkt 1000
</I>&gt;<i> tc class add dev $device parent 10:1 classid 10:2 cbq bandwidth $sales \
</I>&gt;<i> rate $sales_man allot 1514 weight 10Kbit prio 2 maxburst 20 avpkt 1000
</I>&gt;<i> tc class add dev $device parent 10:1 classid 10:3 cbq bandwidth $sales \
</I>&gt;<i> rate $sales_manager allot 1514 weight 40Kbit prio 1 maxburst 20 avpkt
</I>&gt;<i> 1000
</I>&gt;<i>
</I>&gt;<i>
</I>&gt;<i> #############FILTER############
</I>&gt;<i>
</I>&gt;<i> # Depth 1
</I>&gt;<i> tc filter add dev $device parent 1:0 protocol ip prio 25 u32 match \
</I>&gt;<i> ip dst $ip_engine flowid 1:20
</I>&gt;<i>
</I>&gt;<i> # Depth 2
</I>&gt;<i> tc filter add dev $device parent 10:0 protocol ip prio 25 u32 match \
</I>&gt;<i> ip dst $ip_salesman flowid 10:2
</I>&gt;<i> tc filter add dev $device parent 10:0 protocol ip prio 100 u32 match \
</I>&gt;<i> ip dst $ip_salesmanager flowid 10:3
</I>&gt;<i>
</I>&gt;<i>
</I>&gt;<i>
</I>&gt;<i>
</I>&gt;<i> _______________________________________________
</I>&gt;<i> LARTC mailing list / <A HREF="mailto:[email protected]">[email protected]</A> </I>&gt;<i> <A HREF="http://mailman.ds9a.nl/mailman/listinfo/lartc">http://mailman.ds9a.nl/mailman/listinfo/lartc</A> HOWTO:
</I><A HREF="http://ds9a.nl/2.4Routing/">http://ds9a.nl/2.4Routing/</A>

</PRE>