From mboxrd@z Thu Jan 1 00:00:00 1970 From: "William Diehl III" Date: Tue, 01 Oct 2002 17:58:52 +0000 Subject: [LARTC] wee humble school (CBQ/SFQ problems) MIME-Version: 1 Content-Type: multipart/mixed; boundary="----=_NextPart_000_0025_01C26939.87593CE0" Message-Id: List-Id: To: lartc@vger.kernel.org This is a multi-part message in MIME format. ------=_NextPart_000_0025_01C26939.87593CE0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable 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=3D3mbit #Which ethernet interface # NOTE: On this machine, at this time (4/24/01), # eth0 is external (public) # eth1 is internal (private) eth=3Deth1 #Which direction are the packets flowing dir=3Ddst ########################################## # 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 =3D 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 =3D 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 =3D 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 ------=_NextPart_000_0025_01C26939.87593CE0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Greetings!
 
As the network administrator of a small = private=20 university in Riverside, CA with little funding for bandwidth but 1500 = on-campus=20 students, I find it necessary to shape our 3mbit bonded T1s so that = students=20 don't clobber the staff (and perhaps vice versa). I've been a huge fan = of linux=20 traffic shaping since forever but have always had issues with the = priority and=20 the fairness.
 
I come to you today with a problem. I = need to be=20 able to shape traffic and ensure fairness. Consequently, I have the = following=20 script which enables 3 cbq's with 3 levels of priority, the lowest = (student=20 queue) being limited to ony 2/3rds of the bandwidth (2mbit). Each class = has an=20 SFQ attached as well as an SFQ on the top class.
 
The limit to 2mbit seems to function = properly.=20 However, neither the priority or the fairness seem to work. I get = students=20 downloading at 40-50KB/s, out performing a "high priority" address by = 10x!!=20 Also, one or two students can dominate the entire student class which = says to me=20 the SFQ is not doing its job.
 
Here is my script, if any kind soul = would help and=20 let me know the issue, we here would be eternally grateful (not to = mention you=20 would save us from buying a packeteer which is VERY = expensive!)
Perhaps my understanding of priority is = off, but as=20 I see it, if there's traffic in the high priority queues, the lower = queues must=20 wait until dequeued. And the SFQs are supposed to prevent one host from=20 dominating traffic. I supposed if the host has many simultaneous = connections to=20 different hosts this might be construed as multiple streams in which = case such a=20 host could defeat the SFQ. Is this what's happening? I have also tried = with HTB=20 and had similiar results.
 
Thank you,
William Diehl
Network Administrator
La Sierra University
 
--------------------------------
#!/bin/bash
 
#total available bandwidth on the=20 line
bandwidth=3D3mbit
 

#Which ethernet = interface
#      =20 NOTE: On this machine, at this time=20 (4/24/01),
#       eth0 is external=20 (public)
#       eth1 is internal=20 (private)
eth=3Deth1
 
#Which direction are the packets flowing
dir=3Ddst
 
##########################################
# Clean up any old=20 settings
##########################################
tc qdisc del = root dev=20 $eth

##########################################
#
# Create = "Root"=20 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=20 of
#        our=20 bandwidth)
#
##########################################
tc class add dev $eth parent 1:0 classid 1:1 cbq rate $bandwidth = allot 1500=20 bounded prio 1
tc qdisc add dev $eth parent 1:1 handle 11: sfq = perturb=20 5
 
##########################################
#
# Create = priority=20 class
#       (un-throttled)
# = Priority 1=20 (high)
#
##########################################
tc class add dev $eth parent 1:1 classid 1:10 cbq rate $bandwidth = prio 1=20 allot 1500 avpkt 1000
tc qdisc add dev $eth parent 1:10 handle 10: = sfq=20 perturb 5
 
##########################################
#
# Create general = class
#       (unthrottled)
# = Priority 4=20 (medium)
#
##########################################
tc class add dev $eth parent 1:1 classid 1:20 cbq rate $bandwidth = prio 4=20 allot 1500 avpkt 1000
tc qdisc add dev $eth parent 1:20 handle 20: sfq perturb 5
 
##########################################
#
# Create student = class
#       (throttled)
# Priority = 7=20 (low)
#
##########################################
tc class add = dev=20 $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=20 HIGH priority
# [1:10 =3D high priority=20 class]
#
##########################################
tc filter = add dev=20 $eth parent 1:0 protocol ip prio 10 u32 match ip = $dir xxx.xxx.xxx.xxx=20 flowid 1:10
.
.
.
tc filter add dev $eth parent 1:0 protocol ip prio 10 u32 match ip=20 $dir xxx.xxx.xxx.xxx flowid 1:10

##########################################
#
# General = Classes=20 with MEDIUM priority
# (Includes all non student subnets)
# [1:20 =3D medium priority=20 class]
#
##########################################
 
tc filter add dev $eth parent 1:0 protocol ip prio 20 u32 match ip = $dir=20 xxx.xxx.xxx.0/24 flowid 1:20
.
.
.
tc filter add dev $eth parent 1:0 protocol ip prio 20 u32 match ip = $dir=20 xxx.xxx.xxx.0/24 flowid 1:20
##########################################
#
# Student = Classes with=20 LOW priority
# (Matches the dormitory subnets)
# [1:30 =3D low = priority=20 class]
#
##########################################
 
tc filter add dev $eth parent 1:0 protocol ip prio 30 u32 match ip = $dir=20 xxx.xxx.xxx.0/24 flowid 1:30
.
.
.
tc filter add dev $eth parent 1:0 protocol ip prio 30 u32 match ip = $dir=20 xxx.xxx.xxx.0/24 flowid 1:30

 
------=_NextPart_000_0025_01C26939.87593CE0-- _______________________________________________ LARTC mailing list / LARTC@mailman.ds9a.nl http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/