Hi, I am attempting to set up some simple outbound shaping following the LARTC HOWTO. The HTB qdisc seems to work as the documentation says, but my filters don''t seem to be working. All of the packets go to the default queue regardless of what filters I set, it seems. (according to tc -s qdisc show) I am trying to get this working on my openwrt box (whiterussian rc6), but when testing it on my Debian etch box for comparison, I see the same behavior. I''m hoping someone can point out what I''m doing wrong with the filters... FYI: "vlan1" is the outbound interface of my wrt54g. Script follows: IF=vlan1 insmod cls_u32 insmod sch_htb insmod sch_prio insmod sch_sfq # # qdisc/class tree # 1: root (HTB) qdisc # | # 1:10 class rate 384000bit # | # 10: prio qdisc # / | \ # 10:1 | 10:3 # | 10:2 | # 101: | | sfq # 102: | sfq # 103: sfq tc qdisc del dev $IF root tc qdisc add dev $IF root handle 1: htb default 10 tc class add dev $IF parent 1: classid 1:10 htb rate 384kbit burst 3k # This automatically creates 10:1, 10:2, 10:3 tc qdisc add dev $IF parent 1:10 handle 10: prio # Add sfq qdisc to each of the priority classes tc qdisc add dev $IF parent 10:1 handle 101: sfq tc qdisc add dev $IF parent 10:2 handle 102: sfq tc qdisc add dev $IF parent 10:3 handle 103: sfq # "bulk" ssh on port 20022 goes to 103: (low priority) tc filter add dev $IF parent 1:0 protocol ip prio 1 u32 \ match ip sport 20022 0xffff flowid 103: tc filter add dev $IF parent 1:0 protocol ip prio 1 u32 \ match ip dport 20022 0xffff flowid 103: # ICMP goes fast? tc filter add dev $IF parent 1:0 protocol ip prio 2 u32 \ match ip protocol 1 0xff flowid 101:
Hi Jim, Try something a little more simple: tc qdisc del dev $IF root tc qdisc add dev $IF root handle 1: htb default 11 tc class add dev $IF parent 1: classid 1:1 htb rate 384kbit tc class add dev $IF parent 1:1 classid 1:10 htb prio 0 rate 384kbit burst 3k tc class add dev $IF parent 1:1 classid 1:11 htb prio 3 rate 384kbit # "bulk" ssh on port 20022 goes to 1:11: (low priority) tc filter add dev $IF parent 1:0 protocol ip prio 1 u32 \ match ip sport 20022 0xffff flowid 1:11 tc filter add dev $IF parent 1:0 protocol ip prio 1 u32 \ match ip dport 20022 0xffff flowid 1:11 # ICMP goes fast: tc filter add dev $IF parent 1:0 protocol ip prio 0 u32 \ match ip protocol 1 0xff flowid 1:10 Some minor changes in numbers there. Class 1:10 is fast, 1:11 is bulk. Bob Jim Lawson wrote:> Hi, > > I am attempting to set up some simple outbound shaping following the > LARTC HOWTO. > > The HTB qdisc seems to work as the documentation says, but my filters > don''t seem to be working. All of the packets go to the default queue > regardless of what filters I set, it seems. (according to tc -s qdisc > show) > > I am trying to get this working on my openwrt box (whiterussian rc6), > but when testing it on my Debian etch box for comparison, I see the same > behavior. > > I''m hoping someone can point out what I''m doing wrong with the filters... > > FYI: "vlan1" is the outbound interface of my wrt54g. > > Script follows: > > IF=vlan1 > > insmod cls_u32 > insmod sch_htb > insmod sch_prio > insmod sch_sfq > > # > # qdisc/class tree > > > # 1: root (HTB) qdisc > # | > # 1:10 class rate 384000bit > # | > # 10: prio qdisc > # / | \ > # 10:1 | 10:3 > # | 10:2 | > # 101: | | sfq > # 102: | sfq > # 103: sfq > > > tc qdisc del dev $IF root > > tc qdisc add dev $IF root handle 1: htb default 10 > > tc class add dev $IF parent 1: classid 1:10 htb rate 384kbit burst 3k > > # This automatically creates 10:1, 10:2, 10:3 > tc qdisc add dev $IF parent 1:10 handle 10: prio > > # Add sfq qdisc to each of the priority classes > > tc qdisc add dev $IF parent 10:1 handle 101: sfq > > tc qdisc add dev $IF parent 10:2 handle 102: sfq > > tc qdisc add dev $IF parent 10:3 handle 103: sfq > > # "bulk" ssh on port 20022 goes to 103: (low priority) > tc filter add dev $IF parent 1:0 protocol ip prio 1 u32 \ > match ip sport 20022 0xffff flowid 103: > tc filter add dev $IF parent 1:0 protocol ip prio 1 u32 \ > match ip dport 20022 0xffff flowid 103: > > # ICMP goes fast? > > tc filter add dev $IF parent 1:0 protocol ip prio 2 u32 \ > match ip protocol 1 0xff flowid 101: > > > > _______________________________________________ > LARTC mailing list > LARTC@mailman.ds9a.nl > http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc >
On Thu, 2007-02-08 at 21:53 -0500, Jim Lawson wrote:> Hi, > > I am attempting to set up some simple outbound shaping following the > LARTC HOWTO. > > The HTB qdisc seems to work as the documentation says, but my filters > don''t seem to be working. All of the packets go to the default queue > regardless of what filters I set, it seems. (according to tc -s qdisc show) > > I am trying to get this working on my openwrt box (whiterussian rc6), > but when testing it on my Debian etch box for comparison, I see the same > behavior. > > I''m hoping someone can point out what I''m doing wrong with the filters... > > FYI: "vlan1" is the outbound interface of my wrt54g. > > Script follows: > > IF=vlan1 > > insmod cls_u32 > insmod sch_htb > insmod sch_prio > insmod sch_sfq > > # > # qdisc/class tree > > > # 1: root (HTB) qdisc > # | > # 1:10 class rate 384000bit > # | > # 10: prio qdisc > # / | \ > # 10:1 | 10:3 > # | 10:2 | > # 101: | | sfq > # 102: | sfq > # 103: sfq > > > tc qdisc del dev $IF root > > tc qdisc add dev $IF root handle 1: htb default 10 > > tc class add dev $IF parent 1: classid 1:10 htb rate 384kbit burst 3k > > # This automatically creates 10:1, 10:2, 10:3 > tc qdisc add dev $IF parent 1:10 handle 10: prio > > # Add sfq qdisc to each of the priority classes > > tc qdisc add dev $IF parent 10:1 handle 101: sfq > > tc qdisc add dev $IF parent 10:2 handle 102: sfq > > tc qdisc add dev $IF parent 10:3 handle 103: sfq > > # "bulk" ssh on port 20022 goes to 103: (low priority) > tc filter add dev $IF parent 1:0 protocol ip prio 1 u32 \ > match ip sport 20022 0xffff flowid 103: > > tc filter add dev $IF parent 1:0 protocol ip prio 1 u32 \ > match ip dport 20022 0xffff flowid 103: > > # ICMP goes fast? > > tc filter add dev $IF parent 1:0 protocol ip prio 2 u32 \ > match ip protocol 1 0xff flowid 101: >At a guess there''s a problem with the filters. Because it''s not always immediately apparent, what I tend to do is match using iptables, but send to target LOG to check that it''s catching what I expect it to. Once you''re happy this is working you can then change the LOG to CLASSIFY instead of using the last few tc filter rules that you have. Regards, Andy Beverley
Hi Bob, Thanks, those filters that you sent do work. So, any tips? Is the "prio" qdisc superfluous if I am already using htb? What was it about my filters that didn''t work? I will fiddle with this a bit... this helps a lot. Jim Bob Puff@NLE wrote:> Hi Jim, > > Try something a little more simple: > > tc qdisc del dev $IF root > tc qdisc add dev $IF root handle 1: htb default 11 > tc class add dev $IF parent 1: classid 1:1 htb rate 384kbit > tc class add dev $IF parent 1:1 classid 1:10 htb prio 0 rate 384kbit burst 3k > tc class add dev $IF parent 1:1 classid 1:11 htb prio 3 rate 384kbit > > # "bulk" ssh on port 20022 goes to 1:11: (low priority) > tc filter add dev $IF parent 1:0 protocol ip prio 1 u32 \ > match ip sport 20022 0xffff flowid 1:11 > tc filter add dev $IF parent 1:0 protocol ip prio 1 u32 \ > match ip dport 20022 0xffff flowid 1:11 > > # ICMP goes fast: > tc filter add dev $IF parent 1:0 protocol ip prio 0 u32 \ > match ip protocol 1 0xff flowid 1:10 > > Some minor changes in numbers there. Class 1:10 is fast, 1:11 is bulk. > > Bob > > > Jim Lawson wrote: > > >> Hi, >> >> I am attempting to set up some simple outbound shaping following the >> LARTC HOWTO. >> >> The HTB qdisc seems to work as the documentation says, but my filters >> don''t seem to be working. All of the packets go to the default queue >> regardless of what filters I set, it seems. (according to tc -s qdisc >> show) >> >> I am trying to get this working on my openwrt box (whiterussian rc6), >> but when testing it on my Debian etch box for comparison, I see the same >> behavior. >> >> I''m hoping someone can point out what I''m doing wrong with the filters... >> >> FYI: "vlan1" is the outbound interface of my wrt54g. >> >> Script follows: >> >> IF=vlan1 >> >> insmod cls_u32 >> insmod sch_htb >> insmod sch_prio >> insmod sch_sfq >> >> # >> # qdisc/class tree >> >> >> # 1: root (HTB) qdisc >> # | >> # 1:10 class rate 384000bit >> # | >> # 10: prio qdisc >> # / | \ >> # 10:1 | 10:3 >> # | 10:2 | >> # 101: | | sfq >> # 102: | sfq >> # 103: sfq >> >> >> tc qdisc del dev $IF root >> >> tc qdisc add dev $IF root handle 1: htb default 10 >> >> tc class add dev $IF parent 1: classid 1:10 htb rate 384kbit burst 3k >> >> # This automatically creates 10:1, 10:2, 10:3 >> tc qdisc add dev $IF parent 1:10 handle 10: prio >> >> # Add sfq qdisc to each of the priority classes >> >> tc qdisc add dev $IF parent 10:1 handle 101: sfq >> >> tc qdisc add dev $IF parent 10:2 handle 102: sfq >> >> tc qdisc add dev $IF parent 10:3 handle 103: sfq >> >> # "bulk" ssh on port 20022 goes to 103: (low priority) >> tc filter add dev $IF parent 1:0 protocol ip prio 1 u32 \ >> match ip sport 20022 0xffff flowid 103: >> tc filter add dev $IF parent 1:0 protocol ip prio 1 u32 \ >> match ip dport 20022 0xffff flowid 103: >> >> # ICMP goes fast? >> >> tc filter add dev $IF parent 1:0 protocol ip prio 2 u32 \ >> match ip protocol 1 0xff flowid 101: >> >> >> >> _______________________________________________ >> LARTC mailing list >> LARTC@mailman.ds9a.nl >> http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc >> >>
> Thanks, those filters that you sent do work. So, any tips? Is the > "prio" qdisc superfluous if I am already using htb?No, prio is used by HTB to decide how it should divide up any spare bandwidth. See the HTB documentation at: http://luxik.cdi.cz/~devik/qos/htb/manual/userg.htm#prio> What was it about > my filters that didn''t work?Not sure. I think what Bob says is the best - start simple and gradually work to what you want testing as you go...