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
line
bandwidth=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 flowing
dir=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 1
tc 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 1000
tc 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 bounded tc 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
|