I ''ve been trynig for a long time now to make HTB and GRED to work togethen. The problem beeing that GRED doesn''t use handles (instead it uses DP:1 DP:2 etc) i can not preperly filter traffic to them. Tomas Graf suggested to use the tc_index index of u32 classifier so dear Sant .. i am currently with the following scripts that works! But when i try to add an HTB before the GRED, everything goes to hell. tc qdisc add dev $Dev handle 1:0 root dsmark indices 16 set_tc_index tc filter add dev $Dev parent 1:0 protocol ip prio 1 tcindex mask 0xfc shift 2 pass_on tc filter add dev $Dev parent 1:0 protocol ip prio 1 handle 10 tcindex classid 1:1 tc filter add dev $Dev parent 1:0 protocol ip prio 1 handle 12 tcindex classid 1:2 tc filter add dev $Dev parent 1:0 protocol ip prio 1 handle 14 tcindex classid 1:3 tc qdisc add dev $Dev parent 1:0 gred setup DPs 3 default 30 tc qdisc change dev $Dev parent 1:0 gred limit 6000 min 800 max 1600 burst 12 avpkt 256 bandwidth 10Mbit DP 1probability 0.01 tc qdisc change dev $Dev parent 1:0 gred limit 6000 min 800 max 1600 burst 12 avpkt 256 bandwidth 10Mbit DP 2probability 0.01 tc qdisc change dev $Dev parent 1:0 gred limit 6000 min 800 max 1600 burst 12 avpkt 256 bandwidth 10Mbit DP 3probability 0.01 any ideas guys? Would really apreciate it Thanks alg0 _______________________________________________ LARTC mailing list / LARTC@mailman.ds9a.nl http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
Antonios Chalkiopoulos wrote:> I ''ve been trynig for a long time now to make HTB and GRED to work togethen. > The problem beeing that GRED doesn''t use handles (instead it uses DP:1 DP:2 > etc) i can not preperly filter traffic to them. > > Tomas Graf suggested to use the tc_index index of u32 classifier > > so dear Sant .. i am currently with the following scripts that works!Have you seen this http://www.opalsoft.net/qos/DS-27.htm Though if it works you don''t need it :-)> > But when i try to add an HTB before the GRED, everything goes to hell.You may need to repeat filters to get HTB to go from root to GRED (well you do with PRIO) eg. from a usenet post. > Hi Everyone > > I''m running Fedora Core 2 as a router and am having problems getting the > PRIO qdisc to work. > > I''m using the Iperf utility to generate traffic flows between computers on > either side of the Fedora box. I want traffic destined to port 6001 to be > in band 0, traffic for port 6002 in band 1 and traffic for port 6003 in > band 2. > > I''m using HTB to restrict the overall bandwidth to 5000 kbit. > > So far I''ve developed the following scripts, based on info I''ve picked up > from the LARTC mailing list archives, man pages and Google searches. > > SCRIPT ONE... > > tc qdisc del dev eth1 root > tc qdisc add dev eth1 root handle 1: htb default 1 > tc class add dev eth1 parent 1: classid 1:1 htb rate 5000kbit > tc qdisc add dev eth1 parent 1:1 handle 10: prio > tc filter add dev eth1 parent 1:0 protocol ip handle 1 fw flowid 10:1 > tc filter add dev eth1 parent 1:0 protocol ip handle 2 fw flowid 10:2 > tc filter add dev eth1 parent 1:0 protocol ip handle 3 fw flowid 10:3 This is the bit that doesn''t work as I expected. Seems HTB doesn''t forward direct to prio bands from root so you have to repeat the filters. Below is what just seemed to work for me - It works without the bfifos aswell but you don''t get per band stats with tc -s qdisc ls dev eth0 if you don''t have them. Andy. IPTABLES=/usr/local/sbin/iptables MODPROBE=/sbin/modprobe IP=/usr/sbin/ip TC=/usr/sbin/tc $IPTABLES -t mangle -D POSTROUTING --dst 192.168.0.1 -j MARK --set-mark 2 &>/dev/null $IPTABLES -t mangle -D POSTROUTING --dst 192.168.0.2 -j MARK --set-mark 3 &>/dev/null $IPTABLES -t mangle -D POSTROUTING -m length --length 0:64 -j MARK --set-mark 1 &>/dev/null $TC qdisc del dev eth0 root &>/dev/null if [ "$1" = "stop" ] then echo "stopped" exit fi $IPTABLES -t mangle -A POSTROUTING --dst 192.168.0.1 -j MARK --set-mark 2 $IPTABLES -t mangle -A POSTROUTING --dst 192.168.0.2 -j MARK --set-mark 3 $IPTABLES -t mangle -A POSTROUTING -m length --length 0:64 -j MARK --set-mark 1 $TC qdisc add dev eth0 root handle 1:0 htb default 0 $TC class add dev eth0 parent 1:0 classid 1:1 htb rate 5mbit $TC qdisc add dev eth0 parent 1:1 handle 2: prio $TC qdisc add dev eth0 parent 2:1 handle 10:0 bfifo limit 64k $TC qdisc add dev eth0 parent 2:2 handle 20:0 bfifo limit 64k $TC qdisc add dev eth0 parent 2:3 handle 30:0 bfifo limit 64k $TC filter add dev eth0 parent 1:0 prio 0 protocol ip handle 1 fw flowid 1:1 $TC filter add dev eth0 parent 1:0 prio 1 protocol ip handle 2 fw flowid 1:1 $TC filter add dev eth0 parent 1:0 prio 2 protocol ip handle 3 fw flowid 1:1 $TC filter add dev eth0 parent 2:0 prio 0 protocol ip handle 1 fw flowid 2:1 $TC filter add dev eth0 parent 2:0 prio 1 protocol ip handle 2 fw flowid 2:2 $TC filter add dev eth0 parent 2:0 prio 2 protocol ip handle 3 fw flowid 2:3 Andy. _______________________________________________ LARTC mailing list / LARTC@mailman.ds9a.nl http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
Antonios Chalkiopoulos
2005-Jan-04 17:49 UTC
Re: HTB + GRED (santa clauss plz help me out)
Dear Andy,> > I ''ve been trynig for a long time now to make HTB and GRED to work > > together. The problem beeing that GRED doesn''t use handles (instead it > > uses DP:1 DP:2 etc) i can not preperly filter traffic to them. > > > > Tomas Graf suggested to use the tc_index index of u32 classifier > > > > so dear Sant .. i am currently with the following scripts that works! >> Have you seen this > > http://www.opalsoft.net/qos/DS-27.htm > > Though if it works you don''t need it :-)I am aware of it and have spend a few hours trying to make it work... without any success.> > > But when i try to add an HTB before the GRED, everything goes to hell. > > You may need to repeat filters to get HTB to go from root to GRED (well > you do with PRIO) eg. from a usenet post.That IS EXCACTLY MY PROBLEM. In the case of ordinary qdiscs i repeat my filters to the new handles (3:1 3:2 etc). In the case of GRED there are no handles to play with and i am unuable to filter traffic into GRED... Antonios _______________________________________________ LARTC mailing list / LARTC@mailman.ds9a.nl http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/