Skip to contentSkip to conversation

HTB problem

LARTC yangrunhua 17 participants 35 messages Dec 11, 2001 – Dec 4, 2003

lore
Share & tools
lore

yangrunhua

author
#0 lore raw

tc class add dev eth1 parent 1: classid 1:1 htb rate 10kbps ceil 10kbps burst 2k
why the client run into 1:1 can keep 430 KB/s ?
PC+ patch HTB + linux2.4.16

#1 lore raw
Quoted 3 lines · yangrunhua

tc class add dev eth1 parent 1: classid 1:1 htb rate 10kbps ceil 10kbps burst 2k
why the client run into 1:1 can keep 430 KB/s ?

Show your entire configuration, please.

Regards,

bert hubert

Signature · 8 lines
http://www.PowerDNS.com          Versatile DNS Software & Services
Trilab                                 The Technology People
Netherlabs BV / Rent-a-Nerd.nl           - Nerd Available -
'SYN! .. SYN|ACK! .. ACK!' - the mating call of the internet

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://ds9a.nl/lartc/
author
#2 lore raw
In reply to yangrunhua

tc qdisc add dev eth0 root handle 1: htb default 2
tc class add dev eth0 parent 1: classid 1:1 htb rate 5kbps ceil 5kbps burst 2k tc class add dev eth0 parent 1: classid 1:2 htb rate 10mbps ceil 10mbps burst 2k
tc filter add dev eth0 protocol ip fw

and use iptables to mark every packet 0x10001,but up to 200KB/s. # tc -s -d qdisc qdisc htb 1: dev eth0 r2q 10 default 2 dcache 0
deq_util 1/1000000 deq_rate 10 trials_per_deq 0 dcache_hits 0 Sent 1213554 bytes 13996 pkts (dropped 0, overlimits 3924)

 # tc -s -d class show dev eth0
 class htb 1:1 root prio 0 rate 40Kbit ceil 40Kbit burst 2Kb/8 mpu 0b
 cburst 2Kb
  Sent 209473 bytes 3364 pkts (dropped 0, overlimits 3367)
  rate 73bps 1pps
  lended: 3364 borrowed: 0 giants: 0 injects: 0
  tokens: 316161 ctokens: 316161

class htb 1:2 root prio 0 rate 80Mbit ceil 80Mbit burst 2Kb/8 mpu 0b cburst 2Kb Sent 1011846 bytes 10712 pkts (dropped 0, overlimits 151)
rate 258bps 1pps
lended: 10712 borrowed: 0 giants: 0 injects: 0
tokens: 155 ctokens: 155

why?
PII400 + 64M + 2.4.16

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of bert hubert
Sent: 2001Äê12ÔÂ11ÈÕ 17:21
To: [email protected]
Subject: Re: [LARTC] HTB problem

Quoted 1 line · yangrunhua

tc class add dev eth1 parent 1: classid 1:1 htb rate 10kbps ceil

10kbps

Quoted 2 lines

burst 2k
why the client run into 1:1 can keep 430 KB/s ?

Show your entire configuration, please.

Regards,

bert hubert

Signature · 14 lines
http://www.PowerDNS.com          Versatile DNS Software & Services
Trilab                                 The Technology People
Netherlabs BV / Rent-a-Nerd.nl           - Nerd Available -
'SYN! .. SYN|ACK! .. ACK!' - the mating call of the internet

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO:
http://ds9a.nl/lartc/


_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://ds9a.nl/lartc/
author
#3 lore raw
In reply to yangrunhua

Sorry,forget sth.
Ifconfig sees:
RX bytes:22970234 (21.9 Mb) TX bytes:1741892 (1.6 Mb) But:

# tc -s -d qdisc
qdisc htb 1: dev eth0 r2q 10 default 2 dcache 0
 deq_util 1/1000000 deq_rate 11 trials_per_deq 0 dcache_hits 0  Sent
1301198 bytes 14448 pkts (dropped 0, overlimits 3944)

Why?

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of bert hubert
Sent: 2001Äê12ÔÂ11ÈÕ 17:21
To: [email protected]
Subject: Re: [LARTC] HTB problem

Quoted 1 line · yangrunhua

tc class add dev eth1 parent 1: classid 1:1 htb rate 10kbps ceil

10kbps

Quoted 2 lines

burst 2k
why the client run into 1:1 can keep 430 KB/s ?

Show your entire configuration, please.

Regards,

bert hubert

Signature · 14 lines
http://www.PowerDNS.com          Versatile DNS Software & Services
Trilab                                 The Technology People
Netherlabs BV / Rent-a-Nerd.nl           - Nerd Available -
'SYN! .. SYN|ACK! .. ACK!' - the mating call of the internet

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO:
http://ds9a.nl/lartc/


_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://ds9a.nl/lartc/
#4 lore raw
In reply to yangrunhua
Quoted 5 lines · yangrunhua

tc qdisc add dev eth0 root handle 1: htb default 2
tc class add dev eth0 parent 1: classid 1:1 htb rate 5kbps ceil 5kbps burst 2k tc class add dev eth0 parent 1: classid 1:2 htb rate 10mbps ceil 10mbps burst 2k
tc filter add dev eth0 protocol ip fw

I still have a very hard time figuring out your configuration. Please list the following:

* your iptables commands
* your tc qdisc add commands
* your tc class add commands
* what kind of traffic you are generating

Thanks.

Signature · 8 lines
http://www.PowerDNS.com          Versatile DNS Software & Services
Trilab                                 The Technology People
Netherlabs BV / Rent-a-Nerd.nl           - Nerd Available -
'SYN! .. SYN|ACK! .. ACK!' - the mating call of the internet

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://ds9a.nl/lartc/
author
#5 lore raw
In reply to yangrunhua

Now, I know the where the problem is.
If I already use SNAT, how could I limit the inbound bandwidth of Every intra-network ip protected by SNAT( with the help of iptables nfmark)?
But mangle at PREROUTING goes before NAT translate.
Is there any method?
Thanks.

-----Original Message-----
From: bert hubert [mailto:[email protected]]
Sent: 2001Äê12ÔÂ11ÈÕ 19:10
To: yangrunhua
Cc: [email protected]
Subject: Re: [LARTC] HTB problem

Quoted 6 lines · yangrunhua

tc qdisc add dev eth0 root handle 1: htb default 2
tc class add dev eth0 parent 1: classid 1:1 htb rate 5kbps ceil 5kbps

burst 2k tc class add dev eth0 parent 1: classid 1:2 htb rate 10mbps ceil 10mbps burst 2k
tc filter add dev eth0 protocol ip fw

I still have a very hard time figuring out your configuration. Please list
the following:

* your iptables commands
* your tc qdisc add commands
* your tc class add commands
* what kind of traffic you are generating

Thanks.

Signature · 9 lines
http://www.PowerDNS.com          Versatile DNS Software & Services
Trilab                                 The Technology People
Netherlabs BV / Rent-a-Nerd.nl           - Nerd Available -
'SYN! .. SYN|ACK! .. ACK!' - the mating call of the internet


_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://ds9a.nl/lartc/
author
#6 lore raw
In reply to yangrunhua

I could manage it now, modified the netfilter src, add another table not mangle,
Which runs after NAT_SRC. :-)
Another problem: We know HTB is a tree structure, does it permit to jump to the
leaf directly?(I use cls_fw which attached to the root, and with no options, so cls_fw would use nfmark of skb as classid and jump directly into leaf, no traverse)

but when I use these:
tc qdisc add dev eth0 root handle 1: htb default 12
tc class add dev eth0 parent 1: classid 1:1 htb rate 100kbps ceil 100kbps burst 2k
tc class add dev eth0 parent 1:1 classid 1:10 htb rate 30kbps ceil 100kbps burst 2k
tc class add dev eth0 parent 1:1 classid 1:11 htb rate 10kbps ceil 100kbps burst 2k
tc class add dev eth0 parent 1:1 classid 1:12 htb rate 60kbps ceil 100kbps burst 2k
tc filter add dev eth0 protocol ip fw

that, packets marked with 0x1000a don't jump into 1:10, why? But when I use these:
tc qdisc add dev eth0 root handle 1: htb default 2
tc class add dev eth0 parent 1: classid 1:1 htb rate 5kbps ceil 5kbps burst 2k
tc class add dev eth0 parent 1: classid 1:2 htb rate 10kbps ceil 10kbps burst 2k
tc filter add dev eth0 protocol ip fw

in this situation, packets marked with 0x10001 succeeded in jumping into 1:1.

Why?

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of yangrunhua
Sent: 2001年12月12日 13:47
To: [email protected]
Subject: RE: [LARTC] HTB problem

Now, I know the where the problem is.
If I already use SNAT, how could I limit the inbound bandwidth of Every intra-network ip protected by SNAT( with the help of iptables nfmark)?
But mangle at PREROUTING goes before NAT translate.
Is there any method?
Thanks.

-----Original Message-----
From: bert hubert [mailto:[email protected]]
Sent: 2001年12月11日 19:10
To: yangrunhua
Cc: [email protected]
Subject: Re: [LARTC] HTB problem

Quoted 6 lines · yangrunhua

tc qdisc add dev eth0 root handle 1: htb default 2
tc class add dev eth0 parent 1: classid 1:1 htb rate 5kbps ceil 5kbps

burst 2k tc class add dev eth0 parent 1: classid 1:2 htb rate 10mbps ceil 10mbps burst 2k
tc filter add dev eth0 protocol ip fw

I still have a very hard time figuring out your configuration. Please list
the following:

* your iptables commands
* your tc qdisc add commands
* your tc class add commands
* what kind of traffic you are generating

Thanks.

Signature · 15 lines
http://www.PowerDNS.com          Versatile DNS Software & Services
Trilab                                 The Technology People
Netherlabs BV / Rent-a-Nerd.nl           - Nerd Available -
'SYN! .. SYN|ACK! .. ACK!' - the mating call of the internet


_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO:
http://ds9a.nl/lartc/


_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://ds9a.nl/lartc/
#7 lore raw
In reply to yangrunhua

try replace 0x0001000a by 0x00010010. IIRC in 1:10 the "10" is in hex.
devik

Quoted 70 lines · yangrunhua

I could manage it now, modified the netfilter src, add another table not mangle,
Which runs after NAT_SRC. :-)
Another problem: We know HTB is a tree structure, does it permit to jump to the
leaf directly?(I use cls_fw which attached to the root, and with no options, so cls_fw would use nfmark of skb as classid and jump directly into leaf, no traverse)

but when I use these:
tc qdisc add dev eth0 root handle 1: htb default 12
tc class add dev eth0 parent 1: classid 1:1 htb rate 100kbps ceil 100kbps burst 2k
tc class add dev eth0 parent 1:1 classid 1:10 htb rate 30kbps ceil 100kbps burst 2k
tc class add dev eth0 parent 1:1 classid 1:11 htb rate 10kbps ceil 100kbps burst 2k
tc class add dev eth0 parent 1:1 classid 1:12 htb rate 60kbps ceil 100kbps burst 2k
tc filter add dev eth0 protocol ip fw

that, packets marked with 0x1000a don't jump into 1:10, why? But when I use these:
tc qdisc add dev eth0 root handle 1: htb default 2
tc class add dev eth0 parent 1: classid 1:1 htb rate 5kbps ceil 5kbps burst 2k
tc class add dev eth0 parent 1: classid 1:2 htb rate 10kbps ceil 10kbps burst 2k
tc filter add dev eth0 protocol ip fw

in this situation, packets marked with 0x10001 succeeded in jumping into 1:1.

Why?

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of yangrunhua
Sent: 2001年12月12日 13:47
To: [email protected]
Subject: RE: [LARTC] HTB problem

Now, I know the where the problem is.
If I already use SNAT, how could I limit the inbound bandwidth of Every intra-network ip protected by SNAT( with the help of iptables nfmark)?
But mangle at PREROUTING goes before NAT translate.
Is there any method?
Thanks.

-----Original Message-----
From: bert hubert [mailto:[email protected]]
Sent: 2001年12月11日 19:10
To: yangrunhua
Cc: [email protected]
Subject: Re: [LARTC] HTB problem

Quoted 6 lines · yangrunhua

tc qdisc add dev eth0 root handle 1: htb default 2
tc class add dev eth0 parent 1: classid 1:1 htb rate 5kbps ceil 5kbps

burst 2k tc class add dev eth0 parent 1: classid 1:2 htb rate 10mbps ceil 10mbps burst 2k
tc filter add dev eth0 protocol ip fw

I still have a very hard time figuring out your configuration. Please list
the following:

Quoted 24 lines

* your iptables commands
* your tc qdisc add commands
* your tc class add commands
* what kind of traffic you are generating

Thanks.

Signature · 15 lines
http://www.PowerDNS.com          Versatile DNS Software & Services
Trilab                                 The Technology People
Netherlabs BV / Rent-a-Nerd.nl           - Nerd Available -
'SYN! .. SYN|ACK! .. ACK!' - the mating call of the internet


_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO:
http://ds9a.nl/lartc/


_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://ds9a.nl/lartc/

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://ds9a.nl/lartc/

#8 lore raw
In reply to yangrunhua
Quoted 2 lines · Martin Devera

try replace 0x0001000a by 0x00010010. IIRC in 1:10 the "10" is in hex.

True. Even the 1 is hex!

Regards,

bert

Signature · 8 lines
http://www.PowerDNS.com          Versatile DNS Software & Services
Trilab                                 The Technology People
Netherlabs BV / Rent-a-Nerd.nl           - Nerd Available -
'SYN! .. SYN|ACK! .. ACK!' - the mating call of the internet

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://ds9a.nl/lartc/
author
#9 lore raw
In reply to yangrunhua

Thanks to everyone, my problem has been solved.
Here is my description:
for BIG ISP, if you have broadband for every client and use NAT_SRC to let them out, and you want to divide bandwidth among all clients. My solution is iproute2 + netfilter.
I've modified netfilter framework's src to hash every client (not like originally,line by line) and also do some accounting based on flow, and add a table(which hacks after NAT_SRC, not like mangle. Mangle hacks before NAT_SRC), then mark the packets with it's classid related with it's intra-network ipaddr, so the dev attached with filter fw with no option will classify directly into the class with that classid, finally control it's bandwidth(I use HTB).
Every step is O(1) in complexity. Excellent!
Thanks for all. Thanks for all the people here and from netfilter mail-list.
Iproute2+ netfilter seems pretty good! I've got good performance! I'm a new here, so very nice to hear from you, you are so kind.

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of bert hubert
Sent: 2001Äê12ÔÂ12ÈÕ 21:51
To: Martin Devera
Cc: yangrunhua; [email protected]
Subject: Re: [LARTC] HTB problem

Quoted 2 lines · Martin Devera

try replace 0x0001000a by 0x00010010. IIRC in 1:10 the "10" is in hex.

True. Even the 1 is hex!

Regards,

bert

Signature · 14 lines
http://www.PowerDNS.com          Versatile DNS Software & Services
Trilab                                 The Technology People
Netherlabs BV / Rent-a-Nerd.nl           - Nerd Available -
'SYN! .. SYN|ACK! .. ACK!' - the mating call of the internet

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO:
http://ds9a.nl/lartc/


_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://ds9a.nl/lartc/
#10 lore raw
In reply to yangrunhua
Quoted 4 lines · yangrunhua

Thanks for all. Thanks for all the people here and from netfilter mail-list.
Iproute2+ netfilter seems pretty good! I've got good performance! I'm a new here, so very nice to hear from you, you are so kind.

Glad we could help!

Signature · 8 lines
http://www.PowerDNS.com          Versatile DNS Software & Services
Trilab                                 The Technology People
Netherlabs BV / Rent-a-Nerd.nl           - Nerd Available -
'SYN! .. SYN|ACK! .. ACK!' - the mating call of the internet

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://ds9a.nl/lartc/
#11 lore raw

[LARTC] htb problem

In reply to yangrunhua

I have a doubt. What's the correct use of mangle for the next network:

eth0: 200.39.190.249 (public)
eth1: 192.168.101.254 (private)

I make nat with iptables and have the following htb script:

tc qdisc add dev eth1 root handle 1: htb default 30
tc class add dev eth1 parent 1: classid 1:1 htb rate 10mbit burst 15k tc class add dev eth1 parent 1:1 classid 1:10 htb rate 15kbit ceil 10mbit burst 15k
tc filter add dev eth1 protocol ip parent 1:0 prio 1 handle 1 fw classid 1:10

(did the same rules for eth0), htb2, kernel 2.4.18 next mangle:

iptables -I PREROUTING -t mangle -i eth1 -j MARK --set-mark 1

Well, I've spent hours changing values to mangle: PREROUTING, FORWARD, POSTROUTING, etc.

But I can't make it work. I want that all packets marked as "1" be limited to 15kb.

Is it a mangle or script problem?
What would be the correct mangle rule?

Thanks,

_______________________
Omar Armas
MPSNet

Telefono: 5559-1211
email: [email protected]
web: http://jabber.mpsnet.net.mx/~oarmas
_______________________

#12 lore raw

Re: [LARTC] htb problem

In reply to yangrunhua
Quoted 8 lines · Omar Armas

tc class add dev eth1 parent 1:1 classid 1:10 htb rate 15kbit ceil 10mbit burst 15k

But I can't make it work. I want that all packets marked as "1" be limited to 15kb.

Is it a mangle or script problem?
What would be the correct mangle rule?

You have inproper ceil rate pointing to 10mbit. Dont touch ceil parameter or setup it at 15kbit value not 10mbit ;)

Regards
tw

Signature · 8 lines
----------------
 ck.eter.tym.pl

"Never let shooling disturb Your education"

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
#13 lore raw

[LARTC] HTB Problem

In reply to yangrunhua

Hello,

I am shaping traffic for ~250 users and i have noticed something is wrong:
Each user is being shaped from 32kbit/s to 2mbit/s.

When i run the script which creates the classes the following error is printed to syslog:

Dec  9 19:53:34 p1 kernel: HTB: quantum of class 10009 is small. Consider r2q 

change.<4>HTB: quantum of class 10055 is small. Consider r2q change.<4>HTB: quantum of class 10082 is small. Consider r2q change.<4>HTB: quantum of class 10103 is small. Consider r2q change.<4>HTB: quantum of class 10106 is small. Consider r2q change.<4>HTB: quantum of class 10109 is small. Consider r2q change.
... etc etc.

I searched google and found some posts on this error, they said to change the r1q quantum value, tho it wasnt clearly said how big the value should be.

Could anyone tell me what r2q value to set if thaffic is shaped to 32kbit, 64 kbit and 128kbit/s?

I read the manual of HTB and it says:
'Normaly you don't need to specify quantums manualy as HTB chooses precomputed values. It computes classe's quantum (when you add or change it) as its rate divided by r2q global parameter. Its default value is 10 and because typical MTU is 1500 the default is good for rates from 15 kBps (120 kbit). For smaller minimal rates specify r2q 1 when creating qdisc - it is good from 12 kbit which should be enough'

So, is
'r2q 3' enough for 32kbit/s
'r2q 6' enough for 64kbit/s
and
'r2q 10' (default) enough for 128kbit/s+?

Soon after the 'HTB: quantum of class <class> is small' messages in syslog i get the following errors from HTB:
(around 10 minutes after the warnings of 'quantum of class <class> is small':

Dec  9 20:04:43 p1 kernel: HTB: bad diff in events, cl345 diffFCE0000 now87872768 
thenB94934528 j106476
Dec  9 20:04:48 p1 kernel: NET: 189 messages suppressed.
Dec  9 20:04:48 p1 kernel: HTB: bad diff in events, cl054 diffG0D0000 now91976960 
thenB94909952 j106977
Dec  9 20:04:53 p1 kernel: NET: 190 messages suppressed.
Dec  9 20:04:53 p1 kernel: HTB: bad diff in events, cl054 diffG4C0000 now96105728 

thenB94909952 j107481

And it seems the classes start dying one after other, cause the clients start calling me and screaming 'internet doesnt work'.
as soon as i flush qdisc, everything works perfect again.
So for now i have put the traffic script in crontab flushing and adding classes every 15 minutes.

Any suggestions?

I am using HTB 3.6 and Linux 2.4.19

I tried Linux 2.4.20 with HTB included, tho the results were much more poor - if i shaped traffic to 256kbit/s on 2.4.19 the ping was around 200ms (constant), tho on 2.4.20 it was increasing and decreasing dramatically - from 6000ms to 80ms.

P.Krumins
____________________________________________________________

Reìistrç un lieto savu Apollo e-pastu www.e-apollo.lv

www.apollo.lv

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

#14 lore raw

Re: [LARTC] HTB Problem

In reply to yangrunhua
Quoted 14 lines · On Monday 09 December 2002 19:19, [email protected] wrote:

Hello,

I am shaping traffic for ~250 users and i have noticed something is wrong:
Each user is being shaped from 32kbit/s to 2mbit/s.

When i run the script which creates the classes the following error is
printed to syslog: Dec 9 19:53:34 p1 kernel: HTB: quantum of class 10009 is small. Consider r2q change.<4>HTB: quantum of class 10055 is small. Consider r2q change.<4>HTB: quantum of class 10082 is small. Consider r2q change.<4>HTB: quantum of class 10103 is small. Consider r2q change.<4>HTB:
quantum of class 10106 is small. Consider r2q change.<4>HTB: quantum of class 10109 is small. Consider r2q change.
... etc etc.

Quoted 6 lines

I searched google and found some posts on this error, they said to change the r1q quantum value, tho it wasnt clearly said how big the value should be.

Could anyone tell me what r2q value to set if thaffic is shaped to 32kbit, 64 kbit and 128kbit/s?

Quantum = rate / r2q. Quantum should be > 1500 and smaller then 60.000. I have some more info on www.docum.org on the faq page.

Quoted 35 lines

I read the manual of HTB and it says:
'Normaly you don't need to specify quantums manualy as HTB chooses precomputed values. It computes classe's quantum (when you add or change it) as its rate divided by r2q global parameter. Its default value is 10 and because typical MTU is 1500 the default is good for rates from 15 kBps (120 kbit). For smaller minimal rates specify r2q 1 when creating qdisc - it is good from 12 kbit which should be enough'

So, is
'r2q 3' enough for 32kbit/s
'r2q 6' enough for 64kbit/s
and
'r2q 10' (default) enough for 128kbit/s+?

Soon after the 'HTB: quantum of class <class> is small' messages in syslog i get the following errors from HTB:
(around 10 minutes after the warnings of 'quantum of class <class> is small':

Dec  9 20:04:43 p1 kernel: HTB: bad diff in events, cl=10345 diff=46CE0000
now=1187872768 then=4294934528 j=10106476
Dec  9 20:04:48 p1 kernel: NET: 189 messages suppressed.
Dec  9 20:04:48 p1 kernel: HTB: bad diff in events, cl=10054 diff=470D0000
now=1191976960 then=4294909952 j=10106977
Dec  9 20:04:53 p1 kernel: NET: 190 messages suppressed.
Dec  9 20:04:53 p1 kernel: HTB: bad diff in events, cl=10054 diff=474C0000

now=1196105728 then=4294909952 j=10107481

And it seems the classes start dying one after other, cause the clients start calling me and screaming 'internet doesnt work'.
as soon as i flush qdisc, everything works perfect again.
So for now i have put the traffic script in crontab flushing and adding classes every 15 minutes.

Quoted 8 lines

Any suggestions?

I am using HTB 3.6 and Linux 2.4.19

I tried Linux 2.4.20 with HTB included, tho the results were much more poor
- if i shaped traffic to 256kbit/s on 2.4.19 the ping was around 200ms (constant), tho on 2.4.20 it was increasing and decreasing dramatically - from 6000ms to 80ms.

2.4.20 has htb 3.6. So it's the same version. It's strange that you have different results.

Stef

Signature · 8 lines
[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/
#15 lore raw
In reply to yangrunhua

Hi,
Ive been looking at tinkering with the linux traffic control stuff
lately and decided to try out the htb qdisc. My setup is as follows:

2 interfaces: eth0 goes to internet, and eth1 goes to a NAT'd subnet. eth0 has a 7mbit link, but only a 4.5 mbit link to the internet while eth1 is a 100 mbit link to the internal subnet. The box that is doing the routing (and tc soon, hopefully) acts as webserver,dhcp,firewall,NAT,and fileserver for the internal subnet. The internal network (at a college) has heavy
kazaa and other filesharing usage over the internet. I want to use the
lartc utilities to make the bulk traffic from filesharing,etc to be the lowest priority and have interactive (ssh), mail, and http be higher prios (in that order).

Anyway, I dont want to limit the traffic that is going TO the server only, ie. people taking files off my server, and I dont really care who is creating the traffic, I just want priorities on types of traffic. That being the case, I decided to do the shaping on the eth0 interface. Ive setup rules in iptables to mark the different kinds of traffic.

With that done, I created the root htb qdisc with the following:
$TC qdisc add dev eth0 root handle 1: htb default 20

However, I get an error about illegal rate when I try to create a class with:
$TC class add dev eth0 parent 1:1 classid 1:10 htb rate 30kpbs burst 2k
prio 1 ceil 100kbps

I wondered if my tc version wasnt up-to date enough to work with htb, but it was the one downloaded from the htb homepage at
http://luxik.cdi.cz/~devik/qos/htb/v3/htb3.6-020525.tgz

# ./tc -V
tc utility, iproute2-ss991023

is there anything else that might need updating, or is my syntax wrong? any suggestions about my setup would be welcome as well, since this is my first attempt at this

thanks,
jay

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

#16 lore raw
In reply to yangrunhua

You have a typo :- kpbs

Also, it seems that the parent 1:1 is not created yet.

----- Original Message -----
From: "Jay Wineinger" <[email protected]>

Quoted 4 lines

However, I get an error about illegal rate when I try to create a class with:
$TC class add dev eth0 parent 1:1 classid 1:10 htb rate 30kpbs burst

2k

Quoted 2 lines

prio 1 ceil 100kbps

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

#18 lore raw

[LARTC] htb problem

In reply to yangrunhua

Hi,

I have some interesting problem with htb , I set up root class and sub-classess:

$TC qdisc add dev eth0 root handle 1: htb
$TC class add dev eth0 parent 1: classid 1:1 htb rate 1990kbit ceil 2000kbit $TC class add dev eth0 parent 1:1 classid 1:10 htb rate 190kbit ceil 200kbit $TC class add dev eth0 parent 1:1 classid 1:11 htb rate 1400kbit ceil 1600kbit
$TC class add dev eth0 parent 1:1 classid 1:12 htb rate 1000kbit ceil 1500kbit
$TC class add dev eth0 parent 1:1 classid 1:13 htb rate 1000kbit ceil 1500kbit
$TC class add dev eth0 parent 1:1 classid 1:14 htb rate 1000kbit ceil 1200kbit

, filters and queuing disciplines :
#filter
$TC filter add dev eth0 protocol ip parent 1:0 prio 1 handle 2 fw flowid 1:10 classid 1:10
$TC filter add dev eth0 protocol ip parent 1:0 prio 1 handle 3 fw flowid 1:11 classid 1:11
$TC filter add dev eth0 protocol ip parent 1:0 prio 2 handle 4 fw flowid 1:12 classid 1:12
$TC filter add dev eth0 protocol ip parent 1:0 prio 3 handle 5 fw flowid 1:13 classid 1:13
$TC filter add dev eth0 protocol ip parent 1:0 prio 1 handle 6 fw flowid 1:14 classid 1:14
(note the packet marking classifier)

adequate lines from firewall script :
[...]

# ftp
$IPTABLES -A FORWARD -p tcp -s 0/0 -d 0/0 --dport 21 -m state --state
NEW,ESTABLISHED -t mangle -j MARK --set-mark 3
# ssh
$$IPTABLES -A FORWARD -p tcp -s 0/0 -d 0/0 --dport 22 -m state --state
NEW,ESTABLISHED -t mangle -j MARK --set-mark 2
# smtp
$IPTABLES -A FORWARD -p tcp -s 0/0 -d 0/0 --dport 25 -m state --state
NEW,ESTABLISHED -t mangle -j MARK --set-mark 4
[...]

#qdisc
$TC qdisc add dev eth0 parent 1:10 handle 20: sfq perturb 10 $TC qdisc add dev eth0 parent 1:11 handle 30: sfq perturb 10 $TC qdisc add dev eth0 parent 1:12 handle 40: sfq perturb 10 $TC qdisc add dev eth0 parent 1:13 handle 50: sfq perturb 10 $TC qdisc add dev eth0 parent 1:14 handle 60: sfq perturb 10

the problem is - all the traffic goes only through root class '1:'

#tc -s qdisc ls dev eth0
qdisc sfq 60: quantum 1514b perturb 10sec
Sent 0 bytes 0 pkts (dropped 0, overlimits 0)

qdisc pfifo 50: limit 5p
Sent 0 bytes 0 pkts (dropped 0, overlimits 0)

qdisc pfifo 40: limit 5p
Sent 0 bytes 0 pkts (dropped 0, overlimits 0)

qdisc pfifo 30: limit 5p
Sent 0 bytes 0 pkts (dropped 0, overlimits 0)

qdisc pfifo 20: limit 5p
Sent 0 bytes 0 pkts (dropped 0, overlimits 0)

qdisc htb 1: r2q 10 default 0 direct_packets_stat 671 Sent 392890 bytes 671 pkts (dropped 0, overlimits 0)

I'd be very grateful , if you could help me with this.

thanks in advance.

Ratel .at. aonet.pl

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

#19 lore raw

Re: [LARTC] htb problem

In reply to yangrunhua

do you have two nics? the 2megas internet is eth0 right? so you are tc'ing packets going out of interface eth0.

paquets are comming from eth1 for example?
in such case you coutlf -t mangle -I PREROUTING -i eth1 -j MARK --set-mark {1|2|4|} ??

so packets going from internal (eth1) going out (eth0) are previusly marked. im pretty sure about this.
hope it helps, good luck.

Quoting Ratel <[email protected]>:

Quoted 75 lines

Hi,

I have some interesting problem with htb , I set up root class and sub-classess:

$TC qdisc add dev eth0 root handle 1: htb
$TC class add dev eth0 parent 1: classid 1:1 htb rate 1990kbit ceil 2000kbit $TC class add dev eth0 parent 1:1 classid 1:10 htb rate 190kbit ceil 200kbit $TC class add dev eth0 parent 1:1 classid 1:11 htb rate 1400kbit ceil 1600kbit
$TC class add dev eth0 parent 1:1 classid 1:12 htb rate 1000kbit ceil 1500kbit
$TC class add dev eth0 parent 1:1 classid 1:13 htb rate 1000kbit ceil 1500kbit
$TC class add dev eth0 parent 1:1 classid 1:14 htb rate 1000kbit ceil 1200kbit

, filters and queuing disciplines :
#filter
$TC filter add dev eth0 protocol ip parent 1:0 prio 1 handle 2 fw flowid 1:10 classid 1:10
$TC filter add dev eth0 protocol ip parent 1:0 prio 1 handle 3 fw flowid 1:11 classid 1:11
$TC filter add dev eth0 protocol ip parent 1:0 prio 2 handle 4 fw flowid 1:12 classid 1:12
$TC filter add dev eth0 protocol ip parent 1:0 prio 3 handle 5 fw flowid 1:13 classid 1:13
$TC filter add dev eth0 protocol ip parent 1:0 prio 1 handle 6 fw flowid 1:14 classid 1:14
(note the packet marking classifier)

adequate lines from firewall script :
[...]

# ftp
$IPTABLES -A FORWARD -p tcp -s 0/0 -d 0/0 --dport 21 -m state --state
NEW,ESTABLISHED -t mangle -j MARK --set-mark 3
# ssh
$$IPTABLES -A FORWARD -p tcp -s 0/0 -d 0/0 --dport 22 -m state --state
NEW,ESTABLISHED -t mangle -j MARK --set-mark 2
# smtp
$IPTABLES -A FORWARD -p tcp -s 0/0 -d 0/0 --dport 25 -m state --state
NEW,ESTABLISHED -t mangle -j MARK --set-mark 4
[...]

#qdisc
$TC qdisc add dev eth0 parent 1:10 handle 20: sfq perturb 10 $TC qdisc add dev eth0 parent 1:11 handle 30: sfq perturb 10 $TC qdisc add dev eth0 parent 1:12 handle 40: sfq perturb 10 $TC qdisc add dev eth0 parent 1:13 handle 50: sfq perturb 10 $TC qdisc add dev eth0 parent 1:14 handle 60: sfq perturb 10

the problem is - all the traffic goes only through root class '1:'

#tc -s qdisc ls dev eth0
qdisc sfq 60: quantum 1514b perturb 10sec
Sent 0 bytes 0 pkts (dropped 0, overlimits 0)

qdisc pfifo 50: limit 5p
Sent 0 bytes 0 pkts (dropped 0, overlimits 0)

qdisc pfifo 40: limit 5p
Sent 0 bytes 0 pkts (dropped 0, overlimits 0)

qdisc pfifo 30: limit 5p
Sent 0 bytes 0 pkts (dropped 0, overlimits 0)

qdisc pfifo 20: limit 5p
Sent 0 bytes 0 pkts (dropped 0, overlimits 0)

qdisc htb 1: r2q 10 default 0 direct_packets_stat 671 Sent 392890 bytes 671 pkts (dropped 0, overlimits 0)

I'd be very grateful , if you could help me with this.

Quoted 9 lines

thanks in advance.

Ratel .at. aonet.pl

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

#20 lore raw

Re: [LARTC] htb problem

In reply to yangrunhua
Quoted 5 lines · Ratel

Hi,

I have some interesting problem with htb , I set up root class and sub-classess:

Quoted 11 lines

$TC qdisc add dev eth0 root handle 1: htb
$TC class add dev eth0 parent 1: classid 1:1 htb rate 1990kbit ceil 2000kbit $TC class add dev eth0 parent 1:1 classid 1:10 htb rate 190kbit ceil 200kbit $TC class add dev eth0 parent 1:1 classid 1:11 htb rate 1400kbit ceil 1600kbit
$TC class add dev eth0 parent 1:1 classid 1:12 htb rate 1000kbit ceil 1500kbit
$TC class add dev eth0 parent 1:1 classid 1:13 htb rate 1000kbit ceil 1500kbit
$TC class add dev eth0 parent 1:1 classid 1:14 htb rate 1000kbit ceil 1200kbit

The sum of the rates of the childs should be <= rate of parent. In your case 1400 + 1000 + 1000 + 1000 = 4400 and your parent rate is 1990. It's not needed, but I recommend it.

Quoted 5 lines

, filters and queuing disciplines :
#filter
$TC filter add dev eth0 protocol ip parent 1:0 prio 1 handle 2 fw flowid 1:10 classid 1:10
$TC filter add dev eth0 protocol ip parent 1:0 prio 1 handle 3 fw flowid

Quoted 8 lines

1:11 classid 1:11
$TC filter add dev eth0 protocol ip parent 1:0 prio 2 handle 4 fw flowid 1:12 classid 1:12
$TC filter add dev eth0 protocol ip parent 1:0 prio 3 handle 5 fw flowid 1:13 classid 1:13
$TC filter add dev eth0 protocol ip parent 1:0 prio 1 handle 6 fw flowid 1:14 classid 1:14
(note the packet marking classifier)

And I also note the different prios. That's not needed. Prio determines the order the filters are checked. In your case it doesn't matter.

Quoted 12 lines

adequate lines from firewall script :
[...]

# ftp
$IPTABLES -A FORWARD -p tcp -s 0/0 -d 0/0 --dport 21 -m state --state
NEW,ESTABLISHED -t mangle -j MARK --set-mark 3
# ssh
$$IPTABLES -A FORWARD -p tcp -s 0/0 -d 0/0 --dport 22 -m state --state
NEW,ESTABLISHED -t mangle -j MARK --set-mark 2
# smtp
$IPTABLES -A FORWARD -p tcp -s 0/0 -d 0/0 --dport 25 -m state --state
NEW,ESTABLISHED -t mangle -j MARK --set-mark 4
[...]

Mhh. Can you check with iptables -L -v -n that your packets are marked? And can you tell us what's your setup ? I mean wich nic is connected to the internet, what do you want to shape, is this also a firewall? And try marking in the PREROUTING tables.

Stef

Signature · 8 lines
[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/
#21 lore raw

RE: [LARTC] htb problem

In reply to yangrunhua
Quoted 20 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Stef Coene
Sent: 12. juni 2003 21:35
To: Ratel; [email protected]
Subject: Re: [LARTC] htb problem

Quoted 12 lines

adequate lines from firewall script :
[...]

# ftp
$IPTABLES -A FORWARD -p tcp -s 0/0 -d 0/0 --dport 21 -m state --state
NEW,ESTABLISHED -t mangle -j MARK --set-mark 3
# ssh
$$IPTABLES -A FORWARD -p tcp -s 0/0 -d 0/0 --dport 22 -m state --state
NEW,ESTABLISHED -t mangle -j MARK --set-mark 2
# smtp
$IPTABLES -A FORWARD -p tcp -s 0/0 -d 0/0 --dport 25 -m state --state
NEW,ESTABLISHED -t mangle -j MARK --set-mark 4
[...]
Quoted 5 lines

Mhh. Can you check with iptables -L -v -n that your packets are marked? And
can you tell us what's your setup ? I mean wich nic is connected to the internet, what do you want to shape, is this also a firewall? And try marking in the PREROUTING tables.

I have the same problem. According to iptables the packets are marked but all the traffic goes to the root htb class.

--
Morten Isaksen
[email protected] - http://www.aub.dk/~misak

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

#22 lore raw

Re: [LARTC] htb problem

In reply to yangrunhua
Quoted 20 lines · Morten Isaksen
Quoted 20 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Stef Coene
Sent: 12. juni 2003 21:35
To: Ratel; [email protected]
Subject: Re: [LARTC] htb problem

Quoted 12 lines

adequate lines from firewall script :
[...]

# ftp
$IPTABLES -A FORWARD -p tcp -s 0/0 -d 0/0 --dport 21 -m state --state
NEW,ESTABLISHED -t mangle -j MARK --set-mark 3
# ssh
$$IPTABLES -A FORWARD -p tcp -s 0/0 -d 0/0 --dport 22 -m state --state
NEW,ESTABLISHED -t mangle -j MARK --set-mark 2
# smtp
$IPTABLES -A FORWARD -p tcp -s 0/0 -d 0/0 --dport 25 -m state --state
NEW,ESTABLISHED -t mangle -j MARK --set-mark 4
[...]
Quoted 8 lines
Quoted 5 lines

Mhh. Can you check with iptables -L -v -n that your packets are marked? And
can you tell us what's your setup ? I mean wich nic is connected to the internet, what do you want to shape, is this also a firewall? And try marking in the PREROUTING tables.

I have the same problem. According to iptables the packets are marked but all the traffic goes to the root htb class.

Mhh. Some commands that works for me :

tc filter add dev eth0 parent 1: protocol ip handle 1 fw classid 1:100 iptables -A OUTPUT -t mangle -p tcp --dport 2000 -j MARK --set-mark 1

Stef

Signature · 8 lines
[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/
#23 lore raw

Re: [LARTC] htb problem

In reply to yangrunhua
Quoted 3 lines · Esteban

Stef! please explain me this:
When i use traffic shaper, i apply the root to the innterface i want to controll the packets that are leaving right?

Yes.

Quoted 9 lines

The sum of classes "should"
not be greater than the root one.
Supossing i have 2 nics. One for internal (eth1) and other for internet (eth0). i can mangle packets:
-t mangle -I PREROUTING -i eth1 -j MARK --set-mark 1

and then filter them all on the eth0 device with:
tc filter add dev $DEV protocol ip parent 1:0 prio 1 handle 0x1 fw flowid 1:20 is this okay?

Yes.

Quoted 5 lines

Cause for me, is not working.
jeje..i see packets accounting on the right class, but they dont go to the speed i want (i see that in that class are much packets "lended")..that might be that that class is asking for BW to greater classes? if you can would be a great help to clear out this doubts!

So your filters are working. The lended packets are not important. For your htb setup, have you read the docs I collected on www.docum.org ?

Stef

Signature · 8 lines
[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/
#24 lore raw

Re: [LARTC] htb problem

In reply to yangrunhua
Quoted 18 lines · Esteban

my set up is like this:

#!/bin/bash
DEV=eth1

tc qdisc del dev $DEV root 2> /dev/null > /dev/null
tc qdisc del dev $DEV ingress 2> /dev/null > /dev/null

tc qdisc add dev $DEV root handle 1: htb

tc class add dev $DEV parent 1: classid 1:1 htb rate 512kbit burst 6k tc class add dev $DEV parent 1:1 classid 1:10 htb rate 512kbit burst 6k prio 1 tc class add dev $DEV parent 1:1 classid 1:20 htb rate 50kbit burst 6k prio 3

tc qdisc add dev $DEV parent 1:10 handle 10: sfq perturb 10 tc qdisc add dev $DEV parent 1:20 handle 20: sfq perturb 10

Quoted 7 lines

tc filter add dev $DEV protocol ip parent 1:0 prio 1 handle 0x1 fw flowid 1:20

iptables -t mangle -A FORWARD -i eth1 -j MARK --set-mark 1

os?? any idea?

Remove burst and prio parameter from your commands. And make sure the sum of child rates <= parent rate. In your case 512 + 50 >> 512.
And all non-classified packets have to go somewhere. This can be done with the default parameter if you add the htb root disc or a catch all filter rule.

Stef

Signature · 8 lines
[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/
#25 lore raw

Re: [LARTC] htb problem

In reply to yangrunhua

Hey I hve the same problem. My packets are marked, my classes are OK
my filters are set OK
and all packets are passing through the root class!!
I think that this is a big problem. A know 1 more person that has the same
problem!<br><br>
------------------- изпратено от mail.bG<br>
<li>Силна Анти-спам защита
<li>12MB Място за поща
<li>SMS за нов емeйл и към двата оператора!
<li>POP3/WAP Достъп<br>
_________________________________________<br>
<a target='_blank' href="/ads/adclick.php?banneridg1&amp;zoneid&amp;source=&amp;dest=http%3A%2F%2Fmail.bg%2F&amp;ismap=">HOB БEЗПЛATEH AДPEC</a>

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

#26 lore raw

Re: [LARTC] htb problem

In reply to yangrunhua
Quoted 5 lines · On Saturday 14 June 2003 23:46, [email protected] wrote:

Hey I hve the same problem. My packets are marked, my classes are OK my filters are set OK
and all packets are passing through the root class!!
I think that this is a big problem. A know 1 more person that has the same problem!

Ok. I don't understand. I do all my test using iptables and fw filter. This works for me :
tc filter add dev eth0 parent 1: protocol ip handle 1 fw classid 1:100 iptables -A OUTPUT -t mangle -p tcp --dport 2000 -j MARK --set-mark 1

This is on a simple pc. No router, no bridge, no firewall. It's only used to shape outgoing locally bandwidth.

Stef

Signature · 8 lines
[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/
#27 lore raw

Re: [LARTC] htb problem

In reply to yangrunhua

Thx a lot for help , I finally managed to rebuild my firewall script,

for people who have same problem as I had, I can say that
the problem lies in propper packet marking (iptables) , sample lines from my firewall script :

iptables -t mangle -I PREROUTING -i eth0 -p tcp --dport 21 -j MARK --set-mark 2
iptables -t mangle -I PREROUTING -i eth0 -p tcp --dport 443 -j MARK --set-mark 3

it's ofcourse not the only way to mark them,
http://www.docum.org/stef.coene/qos/kptd/ is very useful with that.

regards, Ratel <[email protected]>

----- Original Message -----
From: "Stef Coene" <[email protected]>
To: "Ratel" <[email protected]>; <[email protected]>
Sent: Thursday, June 12, 2003 9:35 PM
Subject: Re: [LARTC] htb problem

Quoted 17 lines · Ratel
Quoted 5 lines

Hi,

I have some interesting problem with htb , I set up root class and sub-classess:

Quoted 11 lines

$TC qdisc add dev eth0 root handle 1: htb
$TC class add dev eth0 parent 1: classid 1:1 htb rate 1990kbit ceil 2000kbit $TC class add dev eth0 parent 1:1 classid 1:10 htb rate 190kbit ceil 200kbit $TC class add dev eth0 parent 1:1 classid 1:11 htb rate 1400kbit ceil 1600kbit
$TC class add dev eth0 parent 1:1 classid 1:12 htb rate 1000kbit ceil 1500kbit
$TC class add dev eth0 parent 1:1 classid 1:13 htb rate 1000kbit ceil 1500kbit
$TC class add dev eth0 parent 1:1 classid 1:14 htb rate 1000kbit ceil 1200kbit

Quoted 1 line

The sum of the rates of the childs should be <= rate of parent. In your

case

Quoted 16 lines

1400 + 1000 + 1000 + 1000 = 4400 and your parent rate is 1990. It's not needed, but I recommend it.

Quoted 5 lines

, filters and queuing disciplines :
#filter
$TC filter add dev eth0 protocol ip parent 1:0 prio 1 handle 2 fw flowid 1:10 classid 1:10
$TC filter add dev eth0 protocol ip parent 1:0 prio 1 handle 3 fw flowid

Quoted 8 lines

1:11 classid 1:11
$TC filter add dev eth0 protocol ip parent 1:0 prio 2 handle 4 fw flowid 1:12 classid 1:12
$TC filter add dev eth0 protocol ip parent 1:0 prio 3 handle 5 fw flowid 1:13 classid 1:13
$TC filter add dev eth0 protocol ip parent 1:0 prio 1 handle 6 fw flowid 1:14 classid 1:14
(note the packet marking classifier)

Quoted 1 line

And I also note the different prios. That's not needed. Prio determines

the

Quoted 14 lines

order the filters are checked. In your case it doesn't matter.

Quoted 12 lines

adequate lines from firewall script :
[...]

# ftp
$IPTABLES -A FORWARD -p tcp -s 0/0 -d 0/0 --dport 21 -m state --state
NEW,ESTABLISHED -t mangle -j MARK --set-mark 3
# ssh
$$IPTABLES -A FORWARD -p tcp -s 0/0 -d 0/0 --dport 22 -m state --state
NEW,ESTABLISHED -t mangle -j MARK --set-mark 2
# smtp
$IPTABLES -A FORWARD -p tcp -s 0/0 -d 0/0 --dport 25 -m state --state
NEW,ESTABLISHED -t mangle -j MARK --set-mark 4
[...]
Quoted 1 line

Mhh. Can you check with iptables -L -v -n that your packets are marked?

And

Quoted 9 lines

can you tell us what's your setup ? I mean wich nic is connected to the internet, what do you want to shape, is this also a firewall? And try marking in the PREROUTING tables.

Stef

--

Quoted 9 lines

[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 mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

#28 lore raw

[LARTC] htb problem

In reply to yangrunhua

Hello,
I have a problem with my htb in linux gateway machine. Wana make this borrow to and from internet:
every user must be shaped to 32Kbit,max number of users are 6 in one subnet /29
and all subnet must be shaped to 92Kbit,e.i every user will download with 32Kbit,but when
all 6 user download do not over 92Kbit! I make some classes /attache them/ but every user download with 32Kbit and over many up 92Kbit. The script:

tc qdisc add dev eth1 root handle 1: htb default 2
tc class add dev eth1 parent 1: classid 1:2 htb rate 100Mbit
ceil 100Mbit burst 1k
tc class add dev eth1 parent 1:2 classid 1:11 htb rate
92Kbit ceil 92Kbit burst 1k
tc qdisc add dev eth1 parent 1:11 handle 11 sfq perturb 10
tc class add dev eth1 parent 1:11 classid 1:30 htb rate
32Kbit ceil 32Kbit burst 1k
tc qdisc add dev eth1 parent 1:30 handle 30 sfq perturb 10
tc filter add dev eth1 parent 1:0 protocol ip prio 1 u32
match ip dst 192.168.1.17 classid 1:30
tc class add dev eth1 parent 1:11 classid 1:40 htb rate
32Kbit ceil 32Kbit burst 1k
tc qdisc add dev eth1 parent 1:40 handle 40 sfq perturb 10
tc filter add dev eth1 parent 1:0 protocol ip prio 1 u32
match ip dst 192.168.1.18 classid 1:40
........
tc class add dev eth1 parent 1:11 classid 1:80 htb rate
32Kbit ceil 32Kbit burst 1k
tc qdisc add dev eth1 parent 1:80 handle 80 sfq perturb 10
tc filter add dev eth1 parent 1:0 protocol ip prio 1 u32
match ip dst 192.168.1.22 classid 1:80

May be there is mistake but where.....?
Please help and thanks!
Reagrds

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

#29 lore raw

Re: [LARTC] htb problem

In reply to yangrunhua
Quoted 34 lines · Delcho

Hello,
I have a problem with my htb in linux gateway machine. Wana make this borrow to and from internet:
every user must be shaped to 32Kbit,max number of users are 6 in one subnet /29
and all subnet must be shaped to 92Kbit,e.i every user will download with 32Kbit,but when
all 6 user download do not over 92Kbit! I make some classes /attache them/ but every user download with 32Kbit and over many up 92Kbit. The script:

tc qdisc add dev eth1 root handle 1: htb default 2
tc class add dev eth1 parent 1: classid 1:2 htb rate 100Mbit
ceil 100Mbit burst 1k
tc class add dev eth1 parent 1:2 classid 1:11 htb rate
92Kbit ceil 92Kbit burst 1k
tc qdisc add dev eth1 parent 1:11 handle 11 sfq perturb 10
tc class add dev eth1 parent 1:11 classid 1:30 htb rate
32Kbit ceil 32Kbit burst 1k
tc qdisc add dev eth1 parent 1:30 handle 30 sfq perturb 10
tc filter add dev eth1 parent 1:0 protocol ip prio 1 u32
match ip dst 192.168.1.17 classid 1:30
tc class add dev eth1 parent 1:11 classid 1:40 htb rate
32Kbit ceil 32Kbit burst 1k
tc qdisc add dev eth1 parent 1:40 handle 40 sfq perturb 10
tc filter add dev eth1 parent 1:0 protocol ip prio 1 u32
match ip dst 192.168.1.18 classid 1:40
........
tc class add dev eth1 parent 1:11 classid 1:80 htb rate
32Kbit ceil 32Kbit burst 1k
tc qdisc add dev eth1 parent 1:80 handle 80 sfq perturb 10
tc filter add dev eth1 parent 1:0 protocol ip prio 1 u32
match ip dst 192.168.1.22 classid 1:80

Quoted 1 line

May be there is mistake but where.....?

Take a look at the faq pages on docum.org. There is a section with htb rules. The problem is that the rate is a minium and the parent ceil is not respected if the child classes are asking more then the ceil.

Stef

Signature · 8 lines
[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/
#31 lore raw

Re: [LARTC] HTB Problem

In reply to yangrunhua
Quoted 14 lines · Guilherme Benkenstein

Hi all!!

I'm new in the list.

I'm using Slackware 9.0 with 2.4.21

HTB 0.8.3

eth0

DEFAULT0

eth0-2:30.dfl

Quoted 7 lines

RATE%6Kbit
BURST2Kb
LEAF=sfq

This is my configuration, but, the shaper dosen't works in 32Kbps...

Anybody can help me?

Yes and no.
I think you are using htb.init and this is not the htb.init mailing list.

Stef

Signature · 8 lines
[email protected]
 "Using Linux as bandwidth manager"
     http://www.docum.org/
     #lartc @ irc.openprojects.net

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
#32 lore raw
In reply to yangrunhua

Hello,

I'm having some problems using HTB to prioritize traffic on my linux router. The main problem is as follows:
I have a 6Mbits channel on the metropolitan network and a 64kbps link for the sites outside my country.

These 64kbps are dynamically allocated by my ISP so I usually get something like 128kbps , sometimes 512kbps and even 1 Mbit; it varies all the time.

Because of this I don't know how to automatically adjust my HTB script depending on the total bandwidth available on the external link (without specifying the maximum to 64kbps thus limitting every connection even if my ISP grants me more than this bandwidth).

Anyone got any ideas ?

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

#33 lore raw
In reply to yangrunhua

Doesn't anyone have any ideas regarding my problem ?

Quoted 17 lines · Mihai Tanasescu

Hello,

I'm having some problems using HTB to prioritize traffic on my linux router.
The main problem is as follows:
I have a 6Mbits channel on the metropolitan network and a 64kbps link for the sites outside my country.

These 64kbps are dynamically allocated by my ISP so I usually get something like 128kbps , sometimes 512kbps and even 1 Mbit; it varies all the time.

Because of this I don't know how to automatically adjust my HTB script depending on the total bandwidth available on the external link (without specifying the maximum to 64kbps thus limitting every connection even if my ISP grants me more than this bandwidth).

Quoted 7 lines

Anyone got any ideas ?

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

#34 lore raw
In reply to yangrunhua
Quoted 12 lines
Quoted 12 lines

Hello,

I'm having some problems using HTB to prioritize traffic on my linux router.
The main problem is as follows:
I have a 6Mbits channel on the metropolitan network and a 64kbps link for the sites outside my country.

These 64kbps are dynamically allocated by my ISP so I usually get something like 128kbps , sometimes 512kbps and even 1 Mbit; it varies all the time.

Quoted 6 lines
Quoted 6 lines

Because of this I don't know how to automatically adjust my HTB script depending on the total bandwidth available on the external link (without specifying the maximum to 64kbps thus limitting every connection even if my ISP grants me more than this bandwidth).

Anyone got any ideas ?

You cannot have a variable bandwidth with htb.
Count on the minimum bandwidth.

Quoted 12 lines
Quoted 6 lines

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

---
Catalin(ux) BOIE
[email protected]
_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/