*~ r a K u ~ *
2006-Jun-26 15:22 UTC
Can i attach another qdisc under classes or root qdisc?
now, i''m learning and try to read a lot of article about tc command in linux for setting traffic shaper. but i''m doubt about In the theory about tc command ... In general, we define class under root qdisc but Is it can be possible ???? If we define another qdisc under root qdisc, Can i do it? because i have just read tc command syntax and i found this point ... syntax: tc qdisc [add/del] dev String [handle][root /ingress/ parent CLASSID] [QDISC_KIND] := {fifo /tbf/ prio/ cbq/ htb/ hfsc} from above syntax at [handle][root /ingress/ ****parent CLASSID] Is "parent CLASSID" mean we can define qdisc under class???? so this is my assumption about that. and Could you advise me about Is it can do for real???? //first .. define root qdisc tc qdisc add dev eth0 root handle 1: fifo //second ... define class under root qdisc but algorithm''s not same like root qdisc algorithm tc class add dev eth0 parent 1: classid 1:1 htb rate 100kbps ceil 100kbps tc class add dev eth0 parent 1: classid 1:2 hfsc rate 100kbps ceil 100kbps //later attach qdisc to those classes tc qdisc add dev eth0 parent 1:1 classid 10:11 htb rate 100kbps ceil 100kbps tc qdisc add dev eth0 parent 1:2 classid 10:21 hfsc rate 100kbps ceil 100kbps Is is true or false???? Thank you so much, and so sorry for my bad english language. Express yourself instantly with MSN Messenger! MSN Messenger Download today it''s FREE! _______________________________________________ LARTC mailing list LARTC@mailman.ds9a.nl http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc
Martin A. Brown
2006-Jun-29 14:14 UTC
Re: Can i attach another qdisc under classes or root qdisc?
Greetings, : now, i''m learning and try to read a lot of article about tc : command in linux for setting traffic shaper. but i''m doubt about : In the theory about tc command ... In general, we define class : under root qdisc but Is it can be possible ???? If we define : another qdisc under root qdisc, Can i do it? because i have just : read tc command syntax and i found this point ... [ snip mangled "tc qdisc help" output ] : from above syntax at [handle][root /ingress/ ****parent CLASSID] : Is "parent CLASSID" mean we can define qdisc under class???? so : this is my assumption about that. and Could you advise me about : Is it can do for real???? If I understand your question correctly, the answer is "yes". It is possible to have nested qdiscs. Note that you can nest qdiscs if you are using a classful qdisc [0]. See also my list at the bottom of this message. : //first .. define root qdisc : : tc qdisc add dev eth0 root handle 1: fifo Bzzzt! Sadly, you can''t do this. A fifo qdisc is a classless qdisc, meaning that it cannot have any children. (Poor barren thing!) : //second ... define class under root qdisc but algorithm''s not same like root qdisc algorithm : : tc class add dev eth0 parent 1: classid 1:1 htb rate 100kbps ceil 100kbps : tc class add dev eth0 parent 1: classid 1:2 hfsc rate 100kbps ceil 100kbps Well, you can''t quite mix and match classes without having a parent qdisc of the type you want. An HTB parent qdisc can have any number of children arranged in a tree structure below the parent. Similarly, an HFSC class structure needs to attach to an HFSC qdisc itself. Note, though, you cannot simply change the class name from htb to hfsc and supply the same parameters. HTB uses the rate and ceil parameters, but HFSC uses different parameters (rt, sc and ul). : //later attach qdisc to those classes : : tc qdisc add dev eth0 parent 1:1 classid 10:11 htb rate 100kbps ceil 100kbps : tc qdisc add dev eth0 parent 1:2 classid 10:21 hfsc rate 100kbps ceil 100kbps OK, now, let''s pretend that you have a classful qdisc (e.g. HTB) with two classes, 1:1 and 1:2, AND that you have a good reason for adding a nested qdisc to one of these classes. If that were the case, then you could add the qdiscs to the parent classes in the following fashion: # -- create a new qdisc, attached inside an existing class # hierarchy below class 1:1 # $qdisc_add parent 1:1 handle 10:0 htb # # -- add a class to our newly created qdisc, and set the # rate and ceil parameters # $class_add parent 10:0 classid 10:1 htb rate 100kbps ceil 100kbps Note, that you''d still need filters. If I were you, I''d review the documentation for both HTB and HFSC after understanding the entire Linux traffic control model. Here''s a crash course, starting at the root qdisc: 1. The qdisc can be - classless (e.g., FIFO, SFQ, ESFQ, TBF, GRED) - classful (e.g., HTB, HFSC, CBQ, PRIO) 2. If the qdisc is classful, keep reading. If the root qdisc is classless, stop here. 3. You may add classes to your classful qdisc. If your qdisc is HTB, you can only add HTB classes. If your qdisc is CBQ, you can only add CBQ classes. If your qdisc is HFSC... 4. Now, you may attach a brand-new classful or classless qdisc to one of your existing classes. Repeat from step 1 for each new qdisc. 5. You may add filters to any of your classes (best starting behaviour is to add them to 1:0) Very complex hierarchies are quite possible, even if not always understandable or advisable. Best of luck, -Martin [0] http://tldp.org/HOWTO/Traffic-Control-HOWTO/classful-qdiscs.html (N.B., this documentation was written without any reference to HFSC, a newer classful qdisc. You may also use HFSC with child qdiscs.) -- Martin A. Brown http://linux-ip.net/
*~ r a K u ~ *
2006-Jul-03 18:21 UTC
Re: Can i attach another qdisc under classes or root qdisc?
thank you so much for your reply, but i doubt about ">If I understand your question correctly, the answer is "yes". It is >possible to have nested qdiscs. Note that you can nest qdiscs if >you are using a classful qdisc [0]. See also my list at the bottom >of this message." you mean we can define "nested qdisc" but algorithm in nested qdisc must same as parent class???? i''m not clear it and Is we can define nested qdisc with algorithm different from parent class????? like this example tc command and At step 4 about your advise "> 4. Now, you may attach a brand-new classful or classless qdisc to > one of your existing classes. Repeat from step 1 for each new > qdisc." tc qdisc add dev eth0 root handle 1: htb //this left node hierachy for manage general package tc class add dev eth0 parent 1: classid 1:1 htb rate 100kbps ceil 100kbps //this right node hierachy for manage real time package tc class add dev eth0 parent 1: classid 1:2 htb rate 100kbps ceil 100kbps // from your adivse at step 4, attach brand-new after define class but Is it true??? because algorithm new qdisc are different from class algorithm that qdisc attach it. tc qdisc add dev eth0 parent 1:2 classid 10:11 hfsc rate 100kbps tc class add dev eth0 parent 10:11 classid 1:111 hfsc rate 100kbps ceil 100kbps tc class add dev eth0 parent 10:11 classid 1:112 hfsc rate 100kbps ceil 100kbps please adivse me about my assumption, :) and Can somebody advise me about HOW TO do later in this topic. i want to have got traffic shaper and my solotion is ... i want to manage different traffic package (general package use and real time package) so now i think about have got a problem with tc command, ... i think it can''t setting to manage different package with different algorithm HTB and HFSC Do you have any idea about how to setting tc command example???? thank you From: "Martin A. Brown" To: *~ r a K u ~ * CC: lartc@mailman.ds9a.nl Subject: Re: [LARTC] Can i attach another qdisc under classes or root qdisc? Date: Thu, 29 Jun 2006 09:14:52 -0500 > >Greetings, > > : now, i''m learning and try to read a lot of article about tc > : command in linux for setting traffic shaper. but i''m doubt about > : In the theory about tc command ... In general, we define class > : under root qdisc but Is it can be possible ???? If we define > : another qdisc under root qdisc, Can i do it? because i have just > : read tc command syntax and i found this point ... > >[ snip mangled "tc qdisc help" output ] > > : from above syntax at [handle][root /ingress/ ****parent CLASSID] > : Is "parent CLASSID" mean we can define qdisc under class???? so > : this is my assumption about that. and Could you advise me about > : Is it can do for real???? > >If I understand your question correctly, the answer is "yes". It is >possible to have nested qdiscs. Note that you can nest qdiscs if >you are using a classful qdisc [0]. See also my list at the bottom >of this message. > > : //first .. define root qdisc > : > : tc qdisc add dev eth0 root handle 1: fifo > >Bzzzt! Sadly, you can''t do this. A fifo qdisc is a classless >qdisc, meaning that it cannot have any children. (Poor barren >thing!) > > : //second ... define class under root qdisc but algorithm''s not same like root qdisc algorithm > : > : tc class add dev eth0 parent 1: classid 1:1 htb rate 100kbps ceil 100kbps > : tc class add dev eth0 parent 1: classid 1:2 hfsc rate 100kbps ceil 100kbps > >Well, you can''t quite mix and match classes without having a parent >qdisc of the type you want. An HTB parent qdisc can have any number >of children arranged in a tree structure below the parent. > >Similarly, an HFSC class structure needs to attach to an HFSC qdisc >itself. Note, though, you cannot simply change the class name from >htb to hfsc and supply the same parameters. HTB uses the rate and >ceil parameters, but HFSC uses different parameters (rt, sc and ul). > > : //later attach qdisc to those classes > : > : tc qdisc add dev eth0 parent 1:1 classid 10:11 htb rate 100kbps ceil 100kbps > : tc qdisc add dev eth0 parent 1:2 classid 10:21 hfsc rate 100kbps ceil 100kbps > >OK, now, let''s pretend that you have a classful qdisc (e.g. HTB) >with two classes, 1:1 and 1:2, AND that you have a good reason for >adding a nested qdisc to one of these classes. If that were the >case, then you could add the qdiscs to the parent classes in the >following fashion: > > # -- create a new qdisc, attached inside an existing class > # hierarchy below class 1:1 > # > $qdisc_add parent 1:1 handle 10:0 htb > # > # -- add a class to our newly created qdisc, and set the > # rate and ceil parameters > # > $class_add parent 10:0 classid 10:1 htb rate 100kbps ceil 100kbps > >Note, that you''d still need filters. > >If I were you, I''d review the documentation for both HTB and HFSC >after understanding the entire Linux traffic control model. Here''s >a crash course, starting at the root qdisc: > > 1. The qdisc can be > - classless (e.g., FIFO, SFQ, ESFQ, TBF, GRED) > - classful (e.g., HTB, HFSC, CBQ, PRIO) > 2. If the qdisc is classful, keep reading. If the root qdisc is > classless, stop here. > 3. You may add classes to your classful qdisc. If your qdisc is > HTB, you can only add HTB classes. If your qdisc is CBQ, you > can only add CBQ classes. If your qdisc is HFSC... > 4. Now, you may attach a brand-new classful or classless qdisc to > one of your existing classes. Repeat from step 1 for each new > qdisc. > 5. You may add filters to any of your classes (best starting > behaviour is to add them to 1:0) > >Very complex hierarchies are quite possible, even if not always >understandable or advisable. > >Best of luck, > >-Martin > > [0] http://tldp.org/HOWTO/Traffic-Control-HOWTO/classful-qdiscs.html > > (N.B., this documentation was written without any reference to > HFSC, a newer classful qdisc. You may also use HFSC with > child qdiscs.) > >-- >Martin A. Brown >http://linux-ip.net/ Don''t just search. Find. MSN Search Check out the new MSN Search! _______________________________________________ LARTC mailing list LARTC@mailman.ds9a.nl http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc
*~ r a K u ~ *
2006-Jul-10 09:41 UTC
Can i attach another qdisc under classes or root qdisc?
thank you so much for your reply, but i doubt about ">If I understand your question correctly, the answer is "yes". It is >possible to have nested qdiscs. Note that you can nest qdiscs if >you are using a classful qdisc [0]. See also my list at the bottom >of this message." you mean we can define "nested qdisc" but algorithm in nested qdisc must same as parent class???? i''m not clear it and Is we can define nested qdisc with algorithm different from parent class????? like this example tc command and At step 4 about your advise "> 4. Now, you may attach a brand-new classful or classless qdisc to > one of your existing classes. Repeat from step 1 for each new > qdisc." tc qdisc add dev eth0 root handle 1: htb //this left node hierachy for manage general package tc class add dev eth0 parent 1: classid 1:1 htb rate 100kbps ceil 100kbps //this right node hierachy for manage real time package tc class add dev eth0 parent 1: classid 1:2 htb rate 100kbps ceil 100kbps // from your adivse at step 4, attach brand-new after define class but Is it true??? because algorithm new qdisc are different from class algorithm that qdisc attach it. tc qdisc add dev eth0 parent 1:2 classid 10:11 hfsc rate 100kbps tc class add dev eth0 parent 10:11 classid 1:111 hfsc rate 100kbps ceil 100kbps tc class add dev eth0 parent 10:11 classid 1:112 hfsc rate 100kbps ceil 100kbps please adivse me about my assumption, :) and Can somebody advise me about HOW TO do later in this topic. i want to have got traffic shaper and my solotion is ... i want to manage different traffic package (general package use and real time package) so now i think about have got a problem with tc command, ... i think it can''t setting to manage different package with different algorithm HTB and HFSC Do you have any idea about how to setting tc command example???? thank you ------------------------------------------------------------------------------------------------------------- Greetings, : now, i''m learning and try to read a lot of article about tc : command in linux for setting traffic shaper. but i''m doubt about : In the theory about tc command ... In general, we define class : under root qdisc but Is it can be possible ???? If we define : another qdisc under root qdisc, Can i do it? because i have just : read tc command syntax and i found this point ... [ snip mangled "tc qdisc help" output ] : from above syntax at [handle][root /ingress/ ****parent CLASSID] : Is "parent CLASSID" mean we can define qdisc under class???? so : this is my assumption about that. and Could you advise me about : Is it can do for real???? If I understand your question correctly, the answer is "yes". It is possible to have nested qdiscs. Note that you can nest qdiscs if you are using a classful qdisc [0]. See also my list at the bottom of this message. : //first .. define root qdisc : : tc qdisc add dev eth0 root handle 1: fifo Bzzzt! Sadly, you can''t do this. A fifo qdisc is a classless qdisc, meaning that it cannot have any children. (Poor barren thing!) : //second ... define class under root qdisc but algorithm''s not same like root qdisc algorithm : : tc class add dev eth0 parent 1: classid 1:1 htb rate 100kbps ceil 100kbps : tc class add dev eth0 parent 1: classid 1:2 hfsc rate 100kbps ceil 100kbps Well, you can''t quite mix and match classes without having a parent qdisc of the type you want. An HTB parent qdisc can have any number of children arranged in a tree structure below the parent. Similarly, an HFSC class structure needs to attach to an HFSC qdisc itself. Note, though, you cannot simply change the class name from htb to hfsc and supply the same parameters. HTB uses the rate and ceil parameters, but HFSC uses different parameters (rt, sc and ul). : //later attach qdisc to those classes : : tc qdisc add dev eth0 parent 1:1 classid 10:11 htb rate 100kbps ceil 100kbps : tc qdisc add dev eth0 parent 1:2 classid 10:21 hfsc rate 100kbps ceil 100kbps OK, now, let''s pretend that you have a classful qdisc (e.g. HTB) with two classes, 1:1 and 1:2, AND that you have a good reason for adding a nested qdisc to one of these classes. If that were the case, then you could add the qdiscs to the parent classes in the following fashion: # -- create a new qdisc, attached inside an existing class # hierarchy below class 1:1 # $qdisc_add parent 1:1 handle 10:0 htb # # -- add a class to our newly created qdisc, and set the # rate and ceil parameters # $class_add parent 10:0 classid 10:1 htb rate 100kbps ceil 100kbps Note, that you''d still need filters. If I were you, I''d review the documentation for both HTB and HFSC after understanding the entire Linux traffic control model. Here''s a crash course, starting at the root qdisc: 1. The qdisc can be - classless (e.g., FIFO, SFQ, ESFQ, TBF, GRED) - classful (e.g., HTB, HFSC, CBQ, PRIO) 2. If the qdisc is classful, keep reading. If the root qdisc is classless, stop here. 3. You may add classes to your classful qdisc. If your qdisc is HTB, you can only add HTB classes. If your qdisc is CBQ, you can only add CBQ classes. If your qdisc is HFSC... 4. Now, you may attach a brand-new classful or classless qdisc to one of your existing classes. Repeat from step 1 for each new qdisc. 5. You may add filters to any of your classes (best starting behaviour is to add them to 1:0) Very complex hierarchies are quite possible, even if not always understandable or advisable. Best of luck, -Martin [0] http://tldp.org/HOWTO/Traffic-Control-HOWTO/classful-qdiscs.html (N.B., this documentation was written without any reference to HFSC, a newer classful qdisc. You may also use HFSC with child qdiscs.) -- Martin A. Brown http://linux-ip.net/ Don''t just search. Find. MSN Search Check out the new MSN Search! _______________________________________________ LARTC mailing list LARTC@mailman.ds9a.nl http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc
Martin A. Brown
2006-Jul-14 15:48 UTC
Re: Can i attach another qdisc under classes or root qdisc?
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hello again Raku, : you mean we can define "nested qdisc" but algorithm in nested : qdisc must same as parent class???? i''m not clear it and Is we : can define nested qdisc with algorithm different from parent : class????? Next try at explaining the concept: - qdiscs can be attached to egress (default), ingress and any class - classes may only be defined "underneath" (as children of) existing classful qdiscs (CBQ, HTB, PRIO, HFSC) - a classful qdisc may only have children classes of the same type (e.g., HTB qdisc can only have HTB classes; HFSC qdisc can only have HFSC classes) - classless qdiscs are leaf branches on the tree Be careful to distinguish classes from qdiscs. : tc qdisc add dev eth0 root handle 1: htb : //this left node hierachy for manage general package : tc class add dev eth0 parent 1: classid 1:1 htb rate 100kbps ceil 100kbps : //this right node hierachy for manage real time package : tc class add dev eth0 parent 1: classid 1:2 htb rate 100kbps ceil 100kbps : // from your adivse at step 4, attach brand-new after define class : but Is it true??? because algorithm new qdisc are different from : class algorithm that qdisc attach it. : tc qdisc add dev eth0 parent 1:2 classid 10:11 hfsc rate 100kbps : tc class add dev eth0 parent 10:11 classid 1:111 hfsc rate 100kbps ceil : 100kbps : tc class add dev eth0 parent 10:11 classid 1:112 hfsc rate 100kbps ceil : 100kbps Structurally speaking, there''s nothing wrong with your hierarchy. When you try it out, however, you''ll discover that you are not using the correct parameters for the hfsc qdisc and class specifications. : and Can somebody advise me about HOW TO do later in this topic. i : want to have got traffic shaper and my solotion is ... i want to : manage different traffic package (general package use and real : time package) so now i think about have got a problem with tc : command, ... i think it can''t setting to manage different package : with different algorithm HTB and HFSC Do you have any idea about : how to setting tc command example???? thank you Raku, I don''t know whether HTB or HFSC would be better for your application, but I can tell you that HTB is better-understood by a larger number of people. In the grand scheme of things, HFSC has seen far less use. It''s an excellent concept, and if you''d like to know more about the concepts behind the queuing discipline, I''d suggest the HFSC article by Klaus Rechert and Patrick McHardy [0]. I think a simple hierarchy almost exactly like the one detailed in their article is probably what you want. It sounds like you have "realtime" traffic (e.g., VoIP) and bulk traffic. So, read their documentation, and try to configure your traffic control structures as they suggest. Once you have configured the traffic control structures, then add the filters to separate traffic into the appropriate classes, e.g.: FILTR="tc filter add dev $INTERFACE" # -- structure is built, now select some packets # $FILTR parent 1:0 protocol all prio 1 \ u32 match ip src 192.168.7.0/24 flowid 1:10 # -- example for grabbing anything at all # $FILTR parent 1:0 protocol all prio 1 \ u32 match u32 0x0 0x0 at 0 classid 1:11 # -- example for identifying all UDP traffic # $FILTR parent 1:0 protocol all prio 1 \ u32 match u8 0x11 0xff at 9 classid 1:12 These are just example filters (and probably not great examples at that). You should write your filters to select the traffic you want to place into each class. Finally, let me recommend that you keep your class structure as simple as possible. - -Martin [0] http://linux-ip.net/tc/hfsc.en/ - -- Martin A. Brown http://linux-ip.net/ -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (GNU/Linux) Comment: pgf-0.71 (http://linux-ip.net/sw/pine-gpg-filter/) iD8DBQFEt7zjHEoZD1iZ+YcRAqBEAKCnuuyDblK9pKvG4Og12HJovGt3HQCcD3LD u0rdSUkjmgmBJtJ/gpIfc0M=V1fF -----END PGP SIGNATURE----- _______________________________________________ LARTC mailing list LARTC@mailman.ds9a.nl http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc