Got the following test rule setup:
tc qdisc add dev wlan0 root handle 1: htb
tc class add dev wlan0 parent 1: classid 1:1 htb rate 1000Mbps
tc class add dev wlan0 parent 1:1 classid 1:5 htb rate 50Kbps ceil 50Kbps burst 1kbit cburst 1kbit
tc qdisc add dev wlan0 parent 1:5 handle 5:0 sfq perturb 5
tc filter add dev wlan0 parent 1:0 protocol ip u32 match ip dport 80 0xffff classid 1:5
tc filter add dev wlan0 parent 1:0 protocol ip u32 match ip sport 80 0xffff classid 1:5
(I've tried this with iptables --set-mark as well but without any real luck so i defaulted back to plain "simple" tc rules.)
This example works in the sense that, it does mark my :80 packages and throttles them but not to 50Kbps...
wgetsays:0% [ ] 4,142,336 490K/stc -s class show dev wlan0says:root@bt:~/Desktop/tk_net# tc -s class show dev wlan0 class htb 1:5 parent 1:1 leaf 5: prio 0 rate 400000bit ceil 400000bit burst 128b cburst 128b Sent 7234 bytes 113 pkt (dropped 0, overlimits 0 requeues 0) rate 3584bit 7pps backlog 0b 0p requeues 0 lended: 113 borrowed: 0 giants: 0 tokens: 17500 ctokens: 17500 class htb 1:1 root rate 8000Mbit ceil 8000Mbit burst 0b cburst 0b Sent 7234 bytes 113 pkt (dropped 0, overlimits 0 requeues 0) rate 3584bit 7pps backlog 0b 0p requeues 0 lended: 0 borrowed: 0 giants: 0 tokens: 15 ctokens: 15Changing:
classid 1:5 htb rate 50Kbps ceil 50Kbpsto
classid 1:5 htb rate 1Kbps ceil 1Kbpsgenerates ~ 34.7K/s in wget
and
tcsays:root@bt:~/Desktop/tk_net# tc -s class show dev wlan0 class htb 1:5 parent 1:1 leaf 5: prio 0 rate 8000bit ceil 8000bit burst 127b cburst 127b Sent 44799 bytes 644 pkt (dropped 112, overlimits 0 requeues 0) rate 2544bit 4pps backlog 0b 0p requeues 0 lended: 641 borrowed: 0 giants: 0 tokens: 1124984 ctokens: 1124984 class htb 1:1 root rate 8000Mbit ceil 8000Mbit burst 0b cburst 0b Sent 44601 bytes 641 pkt (dropped 0, overlimits 0 requeues 0) rate 4208bit 7pps backlog 0b 0p requeues 0 lended: 0 borrowed: 0 giants: 0 tokens: 15 ctokens: 15
I followed these instructions:
- http://lartc.org/howto/lartc.cookbook.fullnat.intro.html
- http://luxik.cdi.cz/~devik/qos/htb/manual/userg.htm
- http://www.adeptus-mechanicus.com/codex/tshape/tshape.html
- http://www.rlogix.com/node/16
What am I doing wrong trying to limit in/outbound :80 traffic?