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@xxxxxxxxxxxxxxx http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/