Re: [LARTC] wee humble school (CBQ/SFQ problems)

2002-10-01 Thread Wojtek Sawasciuk

On Tue, 1 Oct 2002, William Diehl III wrote:

> Greetings!
> 
> As the network administrator of a small private university in Riverside, CA with 
>little funding for bandwidth but 1500 on-campus students, I find it necessary to 
>shape our 3mbit bonded T1s so that students don't clobber the staff (and perhaps vice 
>versa). I've been a huge fan of linux traffic shaping since forever but have always 
>had issues with the priority and the fairness.
> 
> I come to you today with a problem. I need to be able to shape traffic and ensure 
>fairness. Consequently, I have the following script which enables 3 cbq's with 3 
>levels of priority, the lowest (student queue) being limited to ony 2/3rds of the 
>bandwidth (2mbit). Each class has an SFQ attached as well as an SFQ on the top class.
> 
> The limit to 2mbit seems to function properly. However, neither the priority or the 
>fairness seem to work. I get students downloading at 40-50KB/s, out performing a 
>"high priority" address by 10x!! Also, one or two students can dominate the entire 
>student class which says to me the SFQ is not doing its job.
try with esfq (www.ssi.bg/~alex/esfq/) or rebuild your flows with wrr 
(wipl-wrr.sourceforge.net/wrr.html).
you can read about this things in list archive.
 


-- 
Wojtek Sawasciuk, net & sys administrator, ALT MAIL: [EMAIL PROTECTED]
http://GAD.pl - e-biznes, e-multimedia, | tel.: 077 44 14 105,
http://PUNKT.pl - lacza, hosting| fax:  077 45 31 222,


___
LARTC mailing list / [EMAIL PROTECTED]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/



Re: [LARTC] wee humble school (CBQ/SFQ problems)

2002-10-01 Thread Stef Coene

On Tuesday 01 October 2002 19:58, William Diehl III wrote:
> Greetings!
>
> As the network administrator of a small private university in Riverside, CA
> with little funding for bandwidth but 1500 on-campus students, I find it
> necessary to shape our 3mbit bonded T1s so that students don't clobber the
> staff (and perhaps vice versa). I've been a huge fan of linux traffic
> shaping since forever but have always had issues with the priority and the
> fairness.
>
> I come to you today with a problem. I need to be able to shape traffic and
> ensure fairness. Consequently, I have the following script which enables 3
> cbq's with 3 levels of priority, the lowest (student queue) being limited
> to ony 2/3rds of the bandwidth (2mbit). Each class has an SFQ attached as
> well as an SFQ on the top class.
>
> The limit to 2mbit seems to function properly. However, neither the
> priority or the fairness seem to work. I get students downloading at
> 40-50KB/s, out performing a "high priority" address by 10x!! Also, one or
> two students can dominate the entire student class which says to me the SFQ
> is not doing its job.
Sfq uses a ip-address AND ports to sepearate the flows.  You can use efsq if 
you want.  Efsq is sfq but you can configure it so it uses only the 
ip-address as hash key.


> Here is my script, if any kind soul would help and let me know the issue,
> we here would be eternally grateful (not to mention you would save us from
> buying a packeteer which is VERY expensive!) Perhaps my understanding of
> priority is off, but as I see it, if there's traffic in the high priority
> queues, the lower queues must wait until dequeued. And the SFQs are
> supposed to prevent one host from dominating traffic. I supposed if the
> host has many simultaneous connections to different hosts this might be
> construed as multiple streams in which case such a host could defeat the
> SFQ. Is this what's happening? I have also tried with HTB and had similiar
> results.
I don't know about cbq, but the prio in htb is only used for excess bandwidth.  
So each class will get his rate no mather what the prio is.  If each class is 
served, the remaining bandwidth is devided with the lowest prio class first.
If you use htb, make sure the sum of the rate of the class = the ceil of the 
parent class.  Same for cbq.


> ##
> tc class add dev $eth parent 1:0 classid 1:1 cbq rate $bandwidth allot 1500
> bounded prio 1
> tc qdisc add dev $eth parent 1:1 handle 11: sfq perturb 5
This qdisc is useless.  A qdisc is only usefull in leaf classes.

For cbq, each time you add a class, you also should provide a weight 
parameter.  As thumb rule : weight = rate / 10.  Also provide a bandwidth 
parameter with value = link bandwdith = 10 Mbit when you add a class.


Stef

-- 

[EMAIL PROTECTED]
 "Using Linux as bandwidth manager"
 http://www.docum.org/
 #lartc @ irc.oftc.net

___
LARTC mailing list / [EMAIL PROTECTED]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/



[LARTC] wee humble school (CBQ/SFQ problems)

2002-10-01 Thread William Diehl III



Greetings!
 
As the network administrator of a small private 
university in Riverside, CA with little funding for bandwidth but 1500 on-campus 
students, I find it necessary to shape our 3mbit bonded T1s so that students 
don't clobber the staff (and perhaps vice versa). I've been a huge fan of linux 
traffic shaping since forever but have always had issues with the priority and 
the fairness.
 
I come to you today with a problem. I need to be 
able to shape traffic and ensure fairness. Consequently, I have the following 
script which enables 3 cbq's with 3 levels of priority, the lowest (student 
queue) being limited to ony 2/3rds of the bandwidth (2mbit). Each class has an 
SFQ attached as well as an SFQ on the top class.
 
The limit to 2mbit seems to function properly. 
However, neither the priority or the fairness seem to work. I get students 
downloading at 40-50KB/s, out performing a "high priority" address by 10x!! 
Also, one or two students can dominate the entire student class which says to me 
the SFQ is not doing its job.
 
Here is my script, if any kind soul would help and 
let me know the issue, we here would be eternally grateful (not to mention you 
would save us from buying a packeteer which is VERY expensive!)
Perhaps my understanding of priority is off, but as 
I see it, if there's traffic in the high priority queues, the lower queues must 
wait until dequeued. And the SFQs are supposed to prevent one host from 
dominating traffic. I supposed if the host has many simultaneous connections to 
different hosts this might be construed as multiple streams in which case such a 
host could defeat the SFQ. Is this what's happening? I have also tried with HTB 
and had similiar results.
 
Thank you,
William Diehl
Network Administrator
La Sierra University
 

#!/bin/bash
 
#total available bandwidth on the 
linebandwidth=3mbit
 
#Which ethernet interface#   
NOTE: On this machine, at this time 
(4/24/01),#   eth0 is external 
(public)#   eth1 is internal 
(private)eth=eth1
 
#Which direction are the packets flowingdir=dst
 
### Clean up any old 
settings##tc qdisc del root dev 
$eth
 Create "Root" 
Queue Discipline# Queue running on 10mbit fiber card
###
tc qdisc add dev $eth root handle 1:0 cbq bandwidth 10Mbit avpkt 1000
 
 Create topmost 
class#   (throttled at the speed 
of#    our 
bandwidth)###
tc class add dev $eth parent 1:0 classid 1:1 cbq rate $bandwidth allot 1500 
bounded prio 1tc qdisc add dev $eth parent 1:1 handle 11: sfq perturb 
5
 
 Create priority 
class#   (un-throttled)# Priority 1 
(high)###
tc class add dev $eth parent 1:1 classid 1:10 cbq rate $bandwidth prio 1 
allot 1500 avpkt 1000tc qdisc add dev $eth parent 1:10 handle 10: sfq 
perturb 5
 
 Create general 
class#   (unthrottled)# Priority 4 
(medium)###
tc class add dev $eth parent 1:1 classid 1:20 cbq rate $bandwidth prio 4 
allot 1500 avpkt 1000
tc qdisc add dev $eth parent 1:20 handle 20: sfq perturb 5
 
 Create student 
class#   (throttled)# Priority 7 
(low)###tc class add dev 
$eth parent 1:1 classid 1:30 cbq rate 2Mbit prio 7 allot 1500 avpkt 1000 
boundedtc qdisc add dev $eth parent 1:30 handle 30: sfq perturb 5
 
 Special Hosts with 
HIGH priority# [1:10 = high priority 
class]###tc filter add dev 
$eth parent 1:0 protocol ip prio 10 u32 match ip $dir xxx.xxx.xxx.xxx 
flowid 1:10
.
.
.
tc filter add dev $eth parent 1:0 protocol ip prio 10 u32 match ip 
$dir xxx.xxx.xxx.xxx flowid 1:10
 General Classes 
with MEDIUM priority# (Includes all non student subnets)
# [1:20 = medium priority 
class]###
 
tc filter add dev $eth parent 1:0 protocol ip prio 20 u32 match ip $dir 
xxx.xxx.xxx.0/24 flowid 1:20.
.
.
tc filter add dev $eth parent 1:0 protocol ip prio 20 u32 match ip $dir 
xxx.xxx.xxx.0/24 flowid 1:20
 Student Classes with 
LOW priority# (Matches the dormitory subnets)# [1:30 = low priority 
class]###
 
tc filter add dev $eth parent 1:0 protocol ip prio 30 u32 match ip $dir 
xxx.xxx.xxx.0/24 flowid 1:30.
.
.
tc filter add dev $eth parent 1:0 protocol ip prio 30 u32 match ip $dir 
xxx.xxx.xxx.0/24 flowid 1:30