On Monday 22 July 2002 10:44, Lumir Unzeitig wrote:
>> Hi
>> I have flat structure of traffic control - 8 children can borrow from a
>> parent.
>> Problem: The rest bandwidth is not divided to children how I expect.
>>I supposed "the rest of bandwidth is divided to the PCs in ratio
of their
>>RATE values". But it isn't.
>But how is the bandwidth divided in your test ? Can be handy to know to
>find
>a solution/answer ...
>And can you post the used htb script?
>Stef
======================
1. Real measurement of bw (also in Calculation in previous mail)
In my test the downstream bw was divided:
class real bw
----------------------------------------
class 1:10-RATE=4kbit....... 12 kbit/s
class 1:40-RATE=4kbit....... 12 kbit/s
class 1:80-RATE=15kbit...... 29.6 kbit/s
----------------------------------------
Used bw .................... 53.6 kbit/s
2. HTB script
----------------------
#!/bin/bash
# chkconfig: 2345 14 89
# description: sets up HTB traffic control and filters
#VLAN
##########
BAND=56 #kbit/s
BURST=2
VBAND1=4
VBAND2=9
VBAND4=4
VBAND5=6
VBAND6=9
VBAND7=4
VBAND8=15
VBAND9=6
#########
case "$1" in
### START ###
start)
#Delete a root qdisc
#********************
tc qdisc del dev eth0 2>/dev/null
#Root handle
#************
tc qdisc add dev eth0 root handle 1: htb default 100
tc qdisc add dev eth1 root handle 1: htb default 100
#Class for 56kbps channel
#************************
tc class add dev eth0 parent 1: classid 1:1 htb \
rate ${BAND}kbit ceil ${BAND}kbit burst 2k
#VLAN #1 - subclass 1:10
#------------------------------
#Downstream
#Subclass definition
tc class add dev eth0 parent 1:1 classid 1:10 htb \
rate ${VBAND1}kbit ceil ${BAND}kbit burst ${BURST}k
#Filter
tc filter add dev eth0 protocol ip parent 1: prio 1 u32 \
match ip dst 192.168.1.0/24 flowid 1:10
#qdisc - SFQ
tc qdisc add dev eth0 parent 1:10 handle 100: sfq
#Upstream
#Subclass definition
tc class add dev eth1 parent 1:1 classid 1:10 htb \
rate ${VBAND1}kbit ceil ${BAND}kbit burst ${BURST}k
#Filter
tc filter add dev eth1 parent 1: protocol ip prio 1 handle 1 \
fw classid 1:10
#qdisc - SFQ
tc qdisc add dev eth1 parent 1:10 handle 100: sfq
#VLAN #2 - subclass 1:20
#------------------------------
#Downstream
#Subclass definition
tc class add dev eth0 parent 1:1 classid 1:20 htb \
rate ${VBAND2}kbit ceil ${BAND}kbit burst ${BURST}k
#Filter
tc filter add dev eth0 protocol ip parent 1: prio 1 u32 \
match ip dst 192.168.2.0/24 flowid 1:20
#qdisc - SFQ
tc qdisc add dev eth0 parent 1:20 handle 200 sfq
#Upstream
#Subclass definition
tc class add dev eth1 parent 1:1 classid 1:20 htb \
rate ${VBAND1}kbit ceil ${BAND}kbit burst ${BURST}k
#Filter
tc filter add dev eth1 parent 1: protocol ip prio 1 handle 2 \
fw classid 1:20
#qdisc - SFQ
tc qdisc add dev eth1 parent 1:20 handle 200: sfq
#VLAN #4 - subclass 1:40
#-------------------------
#Downstream
#Subclass definition
tc class add dev eth0 parent 1:1 classid 1:40 htb \
rate ${VBAND4}kbit ceil ${BAND}kbit burst ${BURST}k
#Filter
tc filter add dev eth0 protocol ip parent 1: prio 1 u32 \
match ip dst 192.168.4.0/24 flowid 1:40
#qdisc - SFQ
tc qdisc add dev eth0 parent 1:40 handle 400: sfq
#Upstream
#Subclass definition
tc class add dev eth1 parent 1:1 classid 1:40 htb \
rate ${VBAND1}kbit ceil ${BAND}kbit burst ${BURST}k
#Filter
tc filter add dev eth1 parent 1: protocol ip prio 1 handle 4 \
fw classid 1:40
#qdisc - SFQ
tc qdisc add dev eth1 parent 1:40 handle 400: sfq
#VLAN #5 - subclass 1:50
#------------------------------
#Downstream
#Subclass definition
tc class add dev eth0 parent 1:1 classid 1:50 htb \
rate ${VBAND5}kbit ceil ${BAND}kbit burst ${BURST}k
#Filter
tc filter add dev eth0 protocol ip parent 1: prio 1 u32 \
match ip dst 192.168.5.0/24 flowid 1:50
#qdisc - SFQ
tc qdisc add dev eth0 parent 1:50 handle 500: sfq
#Upstrean
#Subclass definition
tc class add dev eth1 parent 1:1 classid 1:50 htb \
rate ${VBAND1}kbit ceil ${BAND}kbit burst ${BURST}k
#Filter
tc filter add dev eth1 parent 1: protocol ip prio 1 handle 5 \
fw classid 1:50
#qdisc - SFQ
tc qdisc add dev eth1 parent 1:50 handle 500: sfq
#VLAN #6 - subclass 1:60
#------------------------------
#Downstream
#Subclass definition
tc class add dev eth0 parent 1:1 classid 1:60 htb \
rate ${VBAND6}kbit ceil ${BAND}kbit burst ${BURST}k
#Filter
tc filter add dev eth0 protocol ip parent 1: prio 1 u32 \
match ip dst 192.168.6.0/24 flowid 1:60
#qdisc - SFQ
tc qdisc add dev eth0 parent 1:60 handle 600: sfq
#Upstream
#Subclass definition
tc class add dev eth1 parent 1:1 classid 1:60 htb \
rate ${VBAND1}kbit ceil ${BAND}kbit burst ${BURST}k
#Filter
tc filter add dev eth1 parent 1: protocol ip prio 1 handle 6 \
fw classid 1:60
#qdisc - SFQ
tc qdisc add dev eth1 parent 1:60 handle 600: sfq
#VLAN #7 - subclass 1:70
#------------------------------
#Downstream
#Subclass definition
tc class add dev eth0 parent 1:1 classid 1:70 htb \
rate ${VBAND7}kbit ceil ${BAND}kbit burst ${BURST}k
#Filter
tc filter add dev eth0 protocol ip parent 1: prio 1 u32 \
match ip dst 192.168.7.0/24 flowid 1:70
#qdisc - SFQ
tc qdisc add dev eth0 parent 1:70 handle 700: sfq
#Upstream
#Subclass definition
tc class add dev eth1 parent 1:1 classid 1:70 htb \
rate ${VBAND1}kbit ceil ${BAND}kbit burst ${BURST}k
#Filter
tc filter add dev eth1 parent 1: protocol ip prio 1 handle 7 \
fw classid 1:70
#qdisc - SFQ
tc qdisc add dev eth1 parent 1:70 handle 700: sfq
#VLAN #8 - subclass 1:80
#------------------------------
#Downstream
#Subclass definition
tc class add dev eth0 parent 1:1 classid 1:80 htb \
rate ${VBAND8}kbit ceil ${BAND}kbit burst ${BURST}k
#Filter
tc filter add dev eth0 protocol ip parent 1: prio 1 u32 \
match ip dst 192.168.8.0/24 flowid 1:80
#qdisc - SFQ
tc qdisc add dev eth0 parent 1:80 handle 800: sfq
#Upstream
#Subclass definition
tc class add dev eth1 parent 1:1 classid 1:80 htb \
rate ${VBAND1}kbit ceil ${BAND}kbit burst ${BURST}k
#Filter
tc filter add dev eth1 parent 1: protocol ip prio 1 handle 8 \
fw classid 1:80
#qdisc - SFQ
tc qdisc add dev eth1 parent 1:80 handle 800: sfq
#VLAN #9 - subclass 1:90
#------------------------------
#Downstream
#Subclass definition
tc class add dev eth0 parent 1:1 classid 1:90 htb \
rate ${VBAND9}kbit ceil ${BAND}kbit burst ${BURST}k
#Filter
tc filter add dev eth0 protocol ip parent 1: prio 1 u32 \
match ip dst 192.168.9.0/24 flowid 1:90
#qdisc - SFQ
tc qdisc add dev eth0 parent 1:90 handle 900: sfq
#Upstream
#Subclass definition
tc class add dev eth1 parent 1:1 classid 1:90 htb \
rate ${VBAND1}kbit ceil ${BAND}kbit burst ${BURST}k
#Filter
tc filter add dev eth1 parent 1: protocol ip prio 1 handle 9 \
fw classid 1:90
#qdisc - SFQ
tc qdisc add dev eth1 parent 1:90 handle 900: sfq
;;
stop)
for dev in `ip link| sed -n '/^[0-9]/ { s/^[0-9]\+:
\([a-z0-9]\+\):.*/\1/; p; }'`; do
tc qdisc del dev $dev root &>/dev/null
done
;;
restart)
$0 stop
$0 start
;;
stats)
echo ---[ eth0: queueing
disciplines ]-------------------------
echo; tc -s qdisc show dev eth0; echo
echo ---[ eth0: configured
classes ]---------------------------
echo; tc -s class show dev eth0; echo
echo
==========================================================================
echo ---[ eth1: queueing
disciplines ]-------------------------
echo; tc -s qdisc show dev eth1; echo
echo ---[ eth1: configured
classes ]---------------------------
echo; tc -s class show dev eth1; echo
;;
*)
echo "HTB start|stop|restart|stats"
;;
esac
-----Original Message-----
From: lartc-admin@mailman.ds9a.nl [mailto:lartc-admin@mailman.ds9a.nl]On
Behalf Of Stef Coene
Sent: Monday, July 22, 2002 4:39 PM
To: lumir.unzeitig@gatc.com; lartc@mailman.ds9a.nl
Subject: Re: [LARTC] htb2 with link sharing - the bandwidth dividing
question
_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
> 1. Real measurement of bw (also in Calculation in previous mail) (Sorry, missed that in the prevois mail) > In my test the downstream bw was divided: > class real bw > ---------------------------------------- > class 1:10-RATE=3D4kbit....... 12 kbit/s > class 1:40-RATE=3D4kbit....... 12 kbit/s > class 1:80-RATE=3D15kbit...... 29.6 kbit/s > ---------------------------------------- > Used bw .................... 53.6 kbit/s So class 1:10 and 1:40 get's more bandwidth then they should. =20 Actually, the remaining bandwidth is not divided proportional to the rate= ,=20 but to quantum. Quantum is calculated as rate / r2q with 2rq =3D 10. Bu= t you=20 can overrule r2q when you add the htb qdisc and you can overrule quantum = per=20 class. I have more info on www.docum.org, under FAQ, HTB, quantum. If rate =3D 4kbit/s and r2q =3D 10, then quantum =3D 4kbit/10 =3D 400 byt= e If rate =3D 15kbit/s and r2q =3D 10, then quantum =3D 15kbit/10 =3D 1500 = byte Each class can send an amount of bytes equal to it's quantum. But a pack= et=20 is most of time bigger then 400 byte so for the 4kbit class, more bytes a= re=20 sended then allowed and there is no payback Solution : decrease quantum so the smallest quantum is big enough to send= the=20 bigest packet. So setting r2q =3D 2 will give better results. tc qdisc add dev eth0 root handle 1: htb default 100 r2q 2 You will also find some errors in the log file about htb that's complaini= ng=20 that the quantum is too small. This is triggered because you want to sen= d a=20 packet that's bigger then the quantum. After decreasing the r2q parameter, these errors should disappear. The default r2q parameter is OK for classes with rates > 15kbit/s. (thx to Devik to explain me this some time ago) Stef --=20 stef.coene@docum.org "Using Linux as bandwidth manager" http://www.docum.org/ #lartc @ irc.openprojects.net
On Wednesday 24 July 2002 02:49, Stef Coene wrote: > Actually, the remaining bandwidth is not divided proportional to the rate, > but to quantum. Helo.... I would like to ask about r2q and quantum. I'm using sfq, which has also something named quantum. the question is.... I I want that the remaining bandwidth to be devided proportional to the rate, which one shuld I set... * sfq quantum? * or htb quantum? * or both? Second question, how can we set r2q lower than 1? I would like to set my r2q to 0.1. Thank you in advance, Adi Nugroho
On Monday 23 September 2002 05:29, Adi Nugroho wrote: > On Wednesday 24 July 2002 02:49, Stef Coene wrote: > > Actually, the remaining bandwidth is not divided proportional to the > > rate, but to quantum. > > Helo.... > I would like to ask about r2q and quantum. > I'm using sfq, which has also something named quantum. > the question is.... > I I want that the remaining bandwidth to be devided proportional to the > rate, which one shuld I set... > * sfq quantum? > * or htb quantum? > * or both? Htb quantum is used to between different classes and only for bandwidth t= hat=20 remains after each class get's it's rate. Sfq quantum is used within one class where the sfq qdisc is attached to a= nd=20 determines how many bytes each flow can send when they may send. Setting on quantum is the best. > Second question, how can we set r2q lower than 1? I would like to set m= y > r2q to 0.1. Just try it out. I don't know if it will work. Stef --=20 stef.coene@docum.org "Using Linux as bandwidth manager" http://www.docum.org/ #lartc @ irc.oftc.net