htb parameter problem

liang jian
Mon, 10 Mar 2003 02:02:02 -0000

>wrote by Stef Coene stef.coene@docum.org
>On Friday 07 March 2003 09:53, liang jian wrote:
>> Sorry,I means that:
> >I configure My out interface bandwidth 10kbps.
> >tc qdisc del dev eth1 root
> >tc qdisc add dev eth1 root handle 30: htb
> >tc class add dev eth1 parent 30: classid 30:1 htb rate 10kbps ceil
10kbps
> >tc class add dev eth1 parent 30:1 classid 30:10 htb rate 5kbps ceil
5kbps
> >tc class add dev eth1 parent 30:10 classid 30:100 htb rate 2.5kbps ceil
> >5kbps tc class add dev eth1 parent 30:100 classid 30:1000 htb rate
1.25kbps
> >ceil 5kbps prio 1 tc qdisc add dev eth1 parent 30:1000 sfq
> >tc class add dev eth1 parent 30:100 classid 30:2000 htb rate 1.25kbps
ceil
> >5kbps prio 2 tc qdisc add dev eth1 parent 30:2000 sfq
> >tc class add dev eth1 parent 30:10 classid 30:200 htb rate 2kbps ceil
5kbps
> >tc qdisc add dev eth1 parent 30:200 sfq
> >tc class add dev eth1 parent 30:1 classid 30:20 htb rate 5kbps ceil
10kbps
> >tc qdisc add dev eth1 parent 30:20 sfq
> >tc filter add dev eth1 parent 30: protocol ip prio 1  handle 8 fw
classid
> >30:20 tc filter add dev eth1 parent 30: protocol ip prio 1  handle 9 fw
> >classid  30:1000 tc filter add dev eth1 parent 30: protocol ip prio 1
> >handle 10 fw classid  30:2000
>>
> >tc -s class ls dev eth1
> >class htb 30:1 root rate 80Kbit ceil 80Kbit burst 1701b cburst 1701b
>  >Sent 3241503 bytes 55558 pkts (dropped 0, overlimits 0)
>  >lended: 0 borrowed: 0 giants: 0
>  >tokens: 132320 ctokens: 132320
> >class htb 30:10 parent 30:1 rate 40Kbit ceil 40Kbit burst 1650b cburst
> >1650b Sent 3235253 bytes 55462 pkts (dropped 0, overlimits 0)
>  >lended: 25964 borrowed: 0 giants: 0
>  >tokens: 256479 ctokens: 256479
> >class htb 30:100 parent 30:10 rate 20Kbit ceil 40Kbit burst 1624b
cburst
> >1650b Sent 3235253 bytes 55462 pkts (dropped 0, overlimits 0)
>  >lended: 12826 borrowed: 25964 giants: 0
>  >tokens: 504639 ctokens: 256479
> >class htb 30:1000 parent 30:100 leaf 802f: prio 1 rate 10Kbit ceil
40Kbit
> >burst 1611b cburst 1650b Sent 3025299 bytes 52329 pkts (dropped 0,
> >overlimits 0)
>  >lended: 14206 borrowed: 38123 giants: 0
>  >tokens: 1000960 ctokens: 256479
> >class htb 30:2000 parent 30:100 leaf 8030: prio 2 rate 10Kbit ceil
40Kbit
> >burst 1611b cburst 1650b Sent 209954 bytes 3133 pkts (dropped 0,
overlimits
> >0)
> > lended: 2466 borrowed: 667 giants: 0
>  >tokens: -317952 ctokens: 243679
> >class htb 30:200 parent 30:10 leaf 8031: prio 0 rate 16Kbit ceil 40Kbit
> >burst 1619b cburst 1650b Sent 0 bytes 0 pkts (dropped 0, overlimits 0)
>  >lended: 0 borrowed: 0 giants: 0
>  >tokens: 647999 ctokens: 264159
> >class htb 30:20 parent 30:1 leaf 8032: prio 0 rate 40Kbit ceil 80Kbit
burst
> >1650b cburst 1701b Sent 6250 bytes 96 pkts (dropped 0, overlimits 0)
>  >lended: 96 borrowed: 0 giants: 0
>  >tokens: 256479 ctokens: 132320
>>
> >http,https traffic from 30:1000 and ftp,ftp-data traffic from 30:2000
> >I download kernel from www.kernel.org use NetAnts.I noted that rate
> >200kbps!!!!? question :
> >1. I don''t know why that rate of NetAnts(200kbps) > out
bandwidth(10kbps).
>Maybe it was locally cached ?
>An other question, are you sure each packets ends in a class?

I don''t know about it.why do that? How to it?

> I never see your marking rules

Below My filter and iptables rules

tc filter add dev eth1 parent 30: protocol ip prio 1  handle 8 fw classid  30:20
tc filter add dev eth1 parent 30: protocol ip prio 1  handle 9 fw classid
30:1000
tc filter add dev eth1 parent 30: protocol ip prio 1  handle 10 fw classid
30:2000

iptables -t mangle -A FORWARD -p tcp -o eth0 -s 0/0 --dport ftp -d 0/0 -j MARK
--set-mark 2
iptables -t mangle -A PREROUTING -p tcp -i eth0 -s 0/0 --dport ftp -d 0/0 -j
MARK --set-mark 2
iptables -t mangle -A FORWARD -p tcp -o eth0 -s 0/0 --dport ftp-data -d 0/0 -j
MARK --set-mark 7
iptables -t mangle -A PREROUTING -p tcp -i eth0 -s 0/0 --dport ftp-data -d 0/0
-j MARK --set-mark 7
iptables -t mangle -A FORWARD -p tcp -o eth0 -s 0/0 --dport http -d 0/0 -j MARK
--set-mark 5
iptables -t mangle -A PREROUTING -p tcp -i eth0 -s 0/0 --dport http -d 0/0 -j
MARK --set-mark 5
iptables -t mangle -A FORWARD -p tcp -o eth0 -s 0/0 --dport https -d 0/0 -j MARK
--set-mark 5
iptables -t mangle -A PREROUTING -p tcp -i eth0 -s 0/0 --dport https -d 0/0 -j
MARK --set-mark 5
iptables -t mangle -A FORWARD -p tcp -o eth1 -s 0/0 --dport ftp -d 0/0 -j MARK
--set-mark 8
iptables -t mangle -A PREROUTING -p tcp -i eth1 -s 0/0 --dport ftp -d 0/0 -j
MARK --set-mark 8
iptables -t mangle -A FORWARD -p tcp -o eth1 -s 0/0 --dport ftp-data -d 0/0 -j
MARK --set-mark 10
iptables -t mangle -A PREROUTING -p tcp -i eth1 -s 0/0 --dport ftp-data -d 0/0
-j MARK --set-mark 10
iptables -t mangle -A FORWARD -p tcp -o eth1 -s 0/0 --dport http -d 0/0 -j MARK
--set-mark 9
iptables -t mangle -A PREROUTING -p tcp -i eth1 -s 0/0 --dport http -d 0/0 -j
MARK --set-mark 9
iptables -t mangle -A FORWARD -p tcp -o eth1 -s 0/0 --dport https -d 0/0 -j MARK
--set-mark 9
iptables -t mangle -A PREROUTING -p tcp -i eth1 -s 0/0 --dport https -d 0/0 -j
MARK --set-mark 9


> and you don''t specified a default class.

I don''t know about it and why do that ? how to do it?

>> 2. I think it maybe dropped packets,but nothing to do .
> >3. tokens: -317952 ctokens: 243679 what''s means about
parameters?what''s
> >representation positive number or negative number?
>Don''t worry about these numbers :)
>ctokens < 0 means the class sent more then the ceil because parent child
>classes are asking too much bandwidth.  Same for tokens and rate.

If I want to fixate every class bandwidth. not lended and not borrow .How to do
it.

cburst play tricks??
On www.docum.org''s FAQ have :

The same story goes for ceil and cburst, you don''t want the class to
send more packets then it''s ceil allows. So removing the cburst is a
good choice for that case.


>Stef

>--





---------------------------------
Do You Yahoo!?
"美女们的秘密武器！"
--0-1052072537-1047261722=:51645
Content-Type: text/html; charset=gb2312
Content-Transfer-Encoding: 8bit

>wrote by Stef Coene <A
title="[LARTC] htb parameter problem"
href="mailto:stef.coene%40docum.org">stef.coene@docum.org
>On Friday 07 March 2003 09:53, liang jian
wrote: >> Sorry,I means
that: > >I
configure My out interface bandwidth
10kbps. > >tc
qdisc del dev eth1 root >
>tc qdisc add dev eth1 root handle 30:
htb > >tc class
add dev eth1 parent 30: classid 30:1 htb rate 10kbps ceil
10kbps > >tc
class add dev eth1 parent 30:1 classid 30:10 htb rate 5kbps ceil
5kbps > >tc
class add dev eth1 parent 30:10 classid 30:100 htb rate 2.5kbps
ceil > >5kbps
tc class add dev eth1 parent 30:100 classid 30:1000 htb rate
1.25kbps >
>ceil 5kbps prio 1 tc qdisc add dev eth1 parent
30:1000 sfq >
>tc class ad

 d dev eth1 parent 30:100 classid 30:2000 htb rate 1.25kbps
ceil > >5kbps
prio 2 tc qdisc add dev eth1 parent 30:2000
sfq > >tc class
add dev eth1 parent 30:10 classid 30:200 htb rate 2kbps ceil
5kbps > >tc
qdisc add dev eth1 parent 30:200 sfq >
>tc class add dev eth1 parent 30:1 classid 30:20 htb
rate 5kbps ceil 10kbps >
>tc qdisc add dev eth1 parent 30:20
sfq > >tc
filter add dev eth1 parent 30: protocol ip prio 1&nbsp; handle 8 fw classid
> >30:20 tc
filter add dev eth1 parent 30: protocol ip prio 1&nbsp; handle 9
fw >
>classid 30:1000 tc filter add dev eth1
parent 30: protocol ip prio 1 >
>handle 10 fw classid
30:2000 >> >
>tc -s class ls dev
eth1 > >

 class htb 30:1 root rate 80Kbit ceil 80Kbit burst 1701b cburst
1701b >
>Sent 3241503 bytes 55558 pkts (dropped 0,
overlimits 0) >
>lended: 0 borrowed: 0 giants:
0 >
>tokens: 132320 ctokens:
132320 > >class
htb 30:10 parent 30:1 rate 40Kbit ceil 40Kbit burst 1650b
cburst > >1650b
Sent 3235253 bytes 55462 pkts (dropped 0, overlimits
0) >
>lended: 25964 borrowed: 0 giants:
0 >
>tokens: 256479 ctokens:
256479 > >class
htb 30:100 parent 30:10 rate 20Kbit ceil 40Kbit burst 1624b
cburst > >1650b
Sent 3235253 bytes 55462 pkts (dropped 0, overlimits
0) >
>lended: 12826 borrowed: 25964 giants:
0 >
>tokens: 504639 ctokens:
256479 > &

gt;class htb 30:1000 parent 30:100 leaf 802f: prio 1 rate 10Kbit ceil
40Kbit > >burst
1611b cburst 1650b Sent 3025299 bytes 52329 pkts (dropped
0, >
>overlimits
0) >
>lended: 14206 borrowed: 38123 giants:
0 >
>tokens: 1000960 ctokens:
256479 > >class
htb 30:2000 parent 30:100 leaf 8030: prio 2 rate 10Kbit ceil
40Kbit > >burst
1611b cburst 1650b Sent 209954 bytes 3133 pkts (dropped 0,
overlimits >
>0) > >
lended: 2466 borrowed: 667 giants:
0 >
>tokens: -317952 ctokens:
243679 > >class
htb 30:200 parent 30:10 leaf 8031: prio 0 rate 16Kbit ceil
40Kbit > >burst
1619b cburst 1650b Sent 0 bytes 0 pkts (dropped 0, overlimits
0) >
>

 lended: 0 borrowed: 0 giants:
0 >
>tokens: 647999 ctokens:
264159 > >class
htb 30:20 parent 30:1 leaf 8032: prio 0 rate 40Kbit ceil 80Kbit
burst > >1650b
cburst 1701b Sent 6250 bytes 96 pkts (dropped 0, overlimits
0) >
>lended: 96 borrowed: 0 giants:
0 >
>tokens: 256479 ctokens:
132320 >> >
>http,https traffic from 30:1000 and ftp,ftp-data
traffic from 30:2000 >
>I download kernel from www.kernel.org use NetAnts.I
noted that rate >
>200kbps!!!!? question
: > >1. I
don''t know why that rate of NetAnts(200kbps) &gt; out
bandwidth(10kbps). >Maybe it was locally cached
? >An other question, are you sure each packets ends in a
class?
I don''t know about it.why do that? How to it?
> I never see your marking rules
Below My filter and iptables rules
tc filter add dev eth1 parent 30: protocol ip prio 1 handle 8
fw classid 30:20 tc filter add dev eth1 parent 30: protocol
ip prio 1 handle 9 fw classid 30:1000 tc filter add
dev eth1 parent 30: protocol ip prio 1&nbsp; handle 10 fw classid&nbsp;
30:2000
iptables -t mangle -A FORWARD -p tcp -o eth0 -s 0/0 --dport ftp -d 0/0
-j MARK --set-mark 2 iptables -t mangle -A PREROUTING -p tcp -i eth0 -s
0/0 --dport ftp -d 0/0 -j MARK --set-mark 2 iptables -t mangle -A
FORWARD -p tcp -o eth0 -s 0/0 --dport ftp-data -d 0/0 -j MARK --set-mark
7 iptables -t mangle -A PREROUTING -p tcp -i eth0 -s 0/0 --dport
ftp-data -d 0/0 -j MARK --set-mark 7 iptables -t mangle -A FORWARD -p
tcp -o eth0 -s 0/0 --dport http -d 0/0 -j MARK --set-mark 5 iptables -t
mangle -A PREROUTING -p tcp -i eth0 -s 0/0 --dport http -d 0/0 -j MARK
--set-mark 5 iptables -t mangle -A FORWARD -p tcp -o eth0 -s 0/0
--dport https -d 0/0 -j MARK --set-mark 5 iptables -t mangle -A
PREROUTING -p tcp -i eth0 -s 0/0 --dport https -d 0/0 -j MARK --set-mark
5 iptables -t mangle -A FORWARD -p tcp -o eth1 -s 0/0 --dport ftp -d
0/0 -j MARK --set-mark 8 iptables -t mangle -A PREROUTING -p tcp -i
eth1 -s 0/0 --dport ftp -d 0/0 -j MARK --set-mark 8 iptabl

 es -t mangle -A FORWARD -p tcp -o eth1 -s 0/0 --dport ftp-data -d 0/0 -j MARK
--set-mark 10 iptables -t mangle -A PREROUTING -p tcp -i eth1 -s 0/0
--dport ftp-data -d 0/0 -j MARK --set-mark 10 iptables -t mangle -A
FORWARD -p tcp -o eth1 -s 0/0 --dport http -d 0/0 -j MARK --set-mark
9 iptables -t mangle -A PREROUTING -p tcp -i eth1 -s 0/0 --dport http
-d 0/0 -j MARK --set-mark 9 iptables -t mangle -A FORWARD -p tcp -o
eth1 -s 0/0 --dport https -d 0/0 -j MARK --set-mark 9 iptables -t
mangle -A PREROUTING -p tcp -i eth1 -s 0/0 --dport https -d 0/0 -j MARK
--set-mark 9
> and you don''t specified a default
class.
I don''t know about it and why do that ? how to do
it? >> 2. I think it maybe dropped
packets,but nothing to do . >
>3. tokens: -317952 ctokens: 243679 what''s
means about parameters?what''s >
>representation positive number or negative
number? >Don''t worry about these numbers
:) >ctokens < 0 means the class sent more then the ceil
because parent child >classes are asking too much
bandwidth. Same for tokens and rate.
If I want to fixate every class bandwidth. not lended and not borrow
.How to do it.
cburst play tricks?? On <A
href="http://www.docum.org''s">www.docum.org''s
FAQ have :
The same story goes for ceil and cburst, you don''t want the
class to send more packets then it''s ceil allows. So removing the
cburst is a good choice for that case.
>Stef >--
Do
You Yahoo!?
<a
href="http://rd.yahoo.com/mail_cn/tag?http://yahoo.eachnet.com/fu/co/rd.php?http://pages.eachnet.com/st/page/women/women.htm">"美女们的秘密武器！"
--0-1052072537-1047261722=:51645--