htb traffic control misfunction
I am asking for your help in debugging my htb configuration.
I am behind a d-link router, so I have to do the traffic control in my
machine. What I am trying to achieve is that if I am uploading to the
internet, then upload with 128kbit/s, and if I am uploading to my localnet,
then upload with full speed (100mbit/s).
I imagine this with htb like this:
( ROOT QDISC 1:0 )
[ class 1:1 | 100mbit ] <=> Filter: handle 2
[ class 1:10 | 128kbit ] <=> Filter: handle 1
So I wrote this script:
iptables -t mangle -A POSTROUTING -d ! 192.168.0.0/24 -j MARK --set-mark 1
iptables -t mangle -A POSTROUTING -d 192.168.0.0/24 -j MARK --set-mark 2
tc qdisc add dev eth0 root handle 1:0 htb default 1
tc class add dev eth0 parent 1:0 classid 1:1 htb rate 100mbit
tc class add dev eth0 parent 1:1 classid 1:10 htb rate 128kbit
# mark 1, this is internet
tc filter add dev eth0 parent 1:0 protocol ip prio 0 handle 1 fw classid 1:10
# mark 2, this is localnet
tc filter add dev eth0 parent 1:0 protocol ip prio 0 handle 2 fw classid 1:1
With this configuration, my upload speed is 128kbit/s, no matter what is the
destination. It seems, that the filter for handle 2 is getting ignored, and I
get 128kbit/s upload speed on my localnet too.
Please someone could point me out the problem with this configuration?