Hello all, Please could someone help me with this, I have been trying for days to get this to work. I would like to have BE, AF & EF classes with HTB qdisc. I can''t find any scripts online where this has been done. If I enable this filter: #tc filter add dev eth0 parent 2:0 protocol ip prio 1 \ #tcindex mask 0xf0 shift 4 pass_on then BE & AF classification seems to be fine but EF breaks & no packets go under that class. I the filter is commented out then EF & BE classes are fine. Script excerpt: # Main DS Marker & Classifier (1:0) echo -e "Installing root DS marker, queue discipline and filter...\n" tc qdisc add dev $DEVICE handle 1:0 root dsmark indices 64 set_tc_index tc filter add dev $DEVICE parent 1:0 protocol ip prio 1 tcindex mask 0xfc shift 2 # Main HTB Queue Discipline (2:0) & Class (2:1) echo -e "Installing main HTB queue discipline and class...\n" tc qdisc add dev $DEVICE parent 1:0 handle 2:0 htb tc class add dev $DEVICE parent 2:0 classid 2:1 htb rate 120Kbit ceil 120Kbit # EF Class (2:10) echo -e "Installing EF class, PFIFO queue discipline and filter...\n" tc class add dev $DEVICE parent 2:1 classid 2:10 htb rate 60Kbit ceil 120Kbit tc qdisc add dev $DEVICE parent 2:10 pfifo limit 5 tc filter add dev $DEVICE parent 2:0 protocol ip prio 1 handle 46 tcindex \ classid 2:10 # BE Class (2:20) echo -e "Installing BE class, RED queue discipline and filter...\n" tc class add dev $DEVICE parent 2:1 classid 2:20 htb rate 40Kbit ceil 120Kbit tc qdisc add dev $DEVICE parent 2:20 red limit 60KB min 3KB max 7.5KB \ burst 10 avpkt 1000 bandwidth 120Kbit probability 0.02 ecn tc filter add dev $DEVICE parent 2:0 protocol ip prio 2 handle 0 tcindex \ mask 0 classid 2:20 # AF Class 1 tc class add dev eth0 parent 2:1 classid 2:30 htb rate 20Kbit ceil 120Kbit tc qdisc add dev eth0 parent 2:30 gred setup DPs 3 default 2 grio tc qdisc change dev eth0 parent 2:30 gred limit 60KB min 15KB max 45KB \ burst 20 avpkt 1000 bandwidth 120Kbit DP 1 probability 0.02 prio 2 tc qdisc change dev eth0 parent 2:30 gred limit 60KB min 15KB max 45KB \ burst 20 avpkt 1000 bandwidth 120Kbit DP 2 probability 0.04 prio 3 tc qdisc change dev eth0 parent 2:30 gred limit 60KB min 15KB max 45KB \ burst 20 avpkt 1000 bandwidth 120Kbit DP 3 probability 0.06 prio 4 tc filter add dev eth0 parent 2:0 protocol ip prio 1 \ handle 1 tcindex classid 2:30 pass_on tc filter add dev eth0 parent 1:0 protocol ip prio 1 \ handle 10 tcindex classid 1:111 tc filter add dev eth0 parent 1:0 protocol ip prio 1 \ handle 12 tcindex classid 1:112 tc filter add dev eth0 parent 1:0 protocol ip prio 1 \ handle 14 tcindex classid 1:113 #tc filter add dev eth0 parent 2:0 protocol ip prio 1 \ #tcindex mask 0xf0 shift 4 pass_on
Hi Robert! If I get you right, you wish to use HTB at a node for doing some QoS for packets based the DSCP they already have, and NOT marking them to have that AF, etc. ( have you checked http://www.opalsoft.net/qos/DS-310.htm? he has some nice scripts ) Why not simply use an u32 match on the TOS field for filtering under your main htb? Why do you need DSMARK? (haven''t tried, but should work fine) For ex. having htb main shaper at 1:0 gives tc filter add dev eth0 parent 1:0 protocol ip prio 2 u32 match ip tos 0xb8 0xff flowid 1:10 (the EF htb branch is at 1:10) tc filter add dev eth0 parent 1:0 protocol ip prio 3 u32 match ip tos 0x28 0xff flowid 1:20 (the AF11 htb branch is at 1:20) At for bulk, create the htb main with: "default 30", and add an 1:30 class with needed rate + burst and red/sfq/etc. U won''t need any filter for this, anything unclassified (anything other than EF or AF11) will get there. If I get you wrong, and you wish to re-mark those packets, I have some scripts for that, too. Contact me at forgamedev@yahoo.com, and I will send them to you. PS: since I also have some scripts to test, and they resemble yours, can you tell me whether they are correct? First I wish to re-mark packets based on u32 ip src match, with: tc qdisc add dev eth0 handle 1:0 root dsmark indices 4 tc class change dev eth0 classid 1:1 dsmark mask 0x3 value 0xb8 ..some filters under 1:0 to send packets to 1:1 to remark them... and then comes a htb at 2:0 having 1:0 (the dsmark qdisc) as parent with few branches. Can I expect that htb qdisc at 2:0 will already have the effects of dsmark at 1:0 (remarked packets)? Thanks, Ferenc __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
Hello Ferenc, The big picture is to put voice in EF class, have AF classes & BE class. Asterisk can mark packets, but I''m marking with ''iptables'' & classifying (filtering) as per the requested help. We want HTB for EF class to guarantee the bandwidth & to be able to borrow/lend between classes should there be no voice or data on the link. We are looking to roll this out at many sites & to partake in DS domains, hence the need to fully understand DiffServ. . My biggest issue was understanding how to filter packets to their correct classes, then I found this: http://kabru.eecs.umich.edu/qos_network/diffserv/DiffServ_prototype/qdisc and explained very nicely: http://kabru.eecs.umich.edu/qos_network/diffserv/DiffServ_prototype/setting_qdisc.ps What you have shown me is good, it''s simpler & will work just as well. Look at the above link for the script, I would like to run something like that but with HTB & PFIFO for the EF class. Their explanation helps, I''m busy trying to put something together now. I haven''t tried to remark packets yet so I''m unsure as to what the exact procedure is. What frustrates me is that there is no debug or logging to test scenarios. Has anyone done voice HTB with EF, AF & BE classes? On 10/04/06, pfer <forgamedev@yahoo.com> wrote:> Hi Robert! > > If I get you right, you wish to use HTB at a node > for doing some QoS for packets based the DSCP they > already have, and NOT marking them to have that AF, > etc. > > ( > have you checked > http://www.opalsoft.net/qos/DS-310.htm? > he has some nice scripts > ) > > Why not simply use an u32 match on the TOS field for > filtering under your main htb? Why do you need DSMARK? > (haven''t tried, but should work fine) > > For ex. having htb main shaper at 1:0 gives > > tc filter add dev eth0 parent 1:0 protocol ip prio 2 > u32 match ip tos 0xb8 0xff flowid 1:10 > (the EF htb branch is at 1:10) > > tc filter add dev eth0 parent 1:0 protocol ip prio 3 > u32 match ip tos 0x28 0xff flowid 1:20 > (the AF11 htb branch is at 1:20) > > At for bulk, create the htb main with: "default 30", > and add an 1:30 class with needed rate + burst and > red/sfq/etc. > U won''t need any filter for this, anything > unclassified > (anything other than EF or AF11) will get there. > > If I get you wrong, and you wish to re-mark those > packets, I have some scripts for that, too. > > Contact me at forgamedev@yahoo.com, and I will send > them to you. > > PS: > since I also have some scripts to test, and they > resemble yours, can you tell me whether they are > correct? > > First I wish to re-mark packets based on u32 ip src > match, with: > > tc qdisc add dev eth0 handle 1:0 root dsmark indices 4 > > tc class change dev eth0 classid 1:1 dsmark mask 0x3 > value 0xb8 > > ..some filters under 1:0 to send packets to 1:1 to > remark them... > > and then comes a htb at 2:0 having 1:0 (the dsmark > qdisc) as parent with few branches. > > Can I expect that htb qdisc at 2:0 will already have > the effects of dsmark at 1:0 (remarked packets)? > > Thanks, > > Ferenc > > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com > _______________________________________________ > LARTC mailing list > LARTC@mailman.ds9a.nl > http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc >
Hello again, Many thanks for your help. I have done as you suggested, I can''t get the other way to work. I guess keep it simple, right? We might need to remark at a later stage, I want to test this. Have you looked at http://www.opalsoft.net/qos/DS-29.htm yet? Please could you confirm something? Is the below right in terms of flowids for the AF1 class? With another example they use flowid 1:111, flowid 1:112, flowid 1:113. # HTB echo -e "Installing HTB queue discipline...\n" tc qdisc add dev $DEVICE handle 1:0 root htb tc class add dev $DEVICE parent 1:0 classid 1:1 htb rate 128Kbit ceil 128Kbit # EF echo -e "Installing EF class...\n" tc class add dev $DEVICE parent 1:1 classid 1:10 htb rate 60Kbit ceil 128Kbit tc qdisc add dev $DEVICE parent 1:10 pfifo limit 5 tc filter add dev $DEVICE parent 1:0 protocol ip prio 1 u32 match ip tos 0xb8 0xff flowid 1:10 # AF 1 echo -e "Installing AF11, AF12, AF13 classes...\n" tc class add dev $DEVICE parent 1:1 classid 1:11 htb rate 12Kbit ceil 128Kbit tc qdisc add dev $DEVICE parent 1:11 gred setup DPs 3 default 2 grio tc qdisc change dev $DEVICE parent 1:11 gred limit 60KB min 15KB max 45KB \ burst 20 avpkt 1000 bandwidth 128Kbit DP 1 probability 0.02 prio 2 tc qdisc change dev $DEVICE parent 1:11 gred limit 60KB min 15KB max 45KB \ burst 20 avpkt 1000 bandwidth 128Kbit DP 2 probability 0.04 prio 3 tc qdisc change dev $DEVICE parent 1:11 gred limit 60KB min 15KB max 45KB \ burst 20 avpkt 1000 bandwidth 128Kbit DP 3 probability 0.06 prio 4 tc filter add dev $DEVICE parent 1:0 protocol ip prio 2 u32 match ip tos 0x28 0xff flowid 1:11 tc filter add dev $DEVICE parent 1:0 protocol ip prio 2 u32 match ip tos 0x30 0xff flowid 1:11 tc filter add dev $DEVICE parent 1:0 protocol ip prio 2 u32 match ip tos 0x38 0xff flowid 1:11 On 10/04/06, pfer <forgamedev@yahoo.com> wrote:> Hi Robert! > > If I get you right, you wish to use HTB at a node > for doing some QoS for packets based the DSCP they > already have, and NOT marking them to have that AF, > etc. > > ( > have you checked > http://www.opalsoft.net/qos/DS-310.htm? > he has some nice scripts > ) > > Why not simply use an u32 match on the TOS field for > filtering under your main htb? Why do you need DSMARK? > (haven''t tried, but should work fine) > > For ex. having htb main shaper at 1:0 gives > > tc filter add dev eth0 parent 1:0 protocol ip prio 2 > u32 match ip tos 0xb8 0xff flowid 1:10 > (the EF htb branch is at 1:10) > > tc filter add dev eth0 parent 1:0 protocol ip prio 3 > u32 match ip tos 0x28 0xff flowid 1:20 > (the AF11 htb branch is at 1:20) > > At for bulk, create the htb main with: "default 30", > and add an 1:30 class with needed rate + burst and > red/sfq/etc. > U won''t need any filter for this, anything > unclassified > (anything other than EF or AF11) will get there. > > If I get you wrong, and you wish to re-mark those > packets, I have some scripts for that, too. > > Contact me at forgamedev@yahoo.com, and I will send > them to you. > > PS: > since I also have some scripts to test, and they > resemble yours, can you tell me whether they are > correct? > > First I wish to re-mark packets based on u32 ip src > match, with: > > tc qdisc add dev eth0 handle 1:0 root dsmark indices 4 > > tc class change dev eth0 classid 1:1 dsmark mask 0x3 > value 0xb8 > > ..some filters under 1:0 to send packets to 1:1 to > remark them... > > and then comes a htb at 2:0 having 1:0 (the dsmark > qdisc) as parent with few branches. > > Can I expect that htb qdisc at 2:0 will already have > the effects of dsmark at 1:0 (remarked packets)? > > Thanks, > > Ferenc > > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com > _______________________________________________ > LARTC mailing list > LARTC@mailman.ds9a.nl > http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc >
Hi Robert! It''s good to see that I could help :). It took me a while to figure things out too. As for opalsoft.net, I suggest you to read all the linux diffserv stuff, it is very useful. I based many of my scripts on what can found there (read that site month ago and still I find new things), though I believe some examles, like af-htb are there for educational reasons, as he also claims it, not for practical usage. To sum up, I would suggest to only use EF and BE, or EF and AF11 first, test it with ping/iperf/etc. and tc qdisc/class/filter -s -d show, ethereal... Only then go for complex stuff. Script: Overall it looks good for me. Why not use 1:20 for AF if you used 1:10 for EF? Just clearer, I believe. I never used gred, so I can''t help much on that. Anyway if you asked for that, I do not see why would you use 1:111 or such. Classids are only guidelines. parent ".." says where to attach the rule, flowid ".." says where to send the packet for classification. As your AF filters say, AF11,AF12,AF13 packets will all be directed to 1:11, and share the default 12kbit. To add: I believe you can concatenate matches if all will direct packets to same class, so can have a filter like: tc filter add dev $DEVICE parent 1:0 protocol ip prio 2 u32 match ip tos 0x28 0xff match ip tos 0x30 0xff match ip tos 0x38 0xff flowid 1:11 But check this, I''m not sure. Finally, I do not know what will happen to BE if you run this setup. Where will it go? I would create the main htb under 1:0 with default 30, so send anything unmatched (BE) to 1:30. Hope somewhere I wrote something you wanted,or I don''t get your question. Ferenc __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com