i'm trying set traffic shaping with tc and tbf qdisk on my wireless interface, to limit download bandwidth. By now I successfully wrote wondershaper, which use HTB. I'd like to use classless shaping, and read that the right qdisk for this job is TBF.
But when I try to set it, had no effect: download keeps going fast.
I tried different ways to do it, but it never worked:
tc qdisc add dev wlan0 root tbf rate 0.5mbit burst 5kb latency 70ms peakrate 1mbit minburst 1540
tc qdisc add dev wlan0 handle 1:0 root dsmark indices 1 default_index 0
tc qdisc add dev wlan0 handle 2:0 parent 1:0 tbf burst 20480 limit 20480 mtu 1514 rate 32000bps
tc qdisc add dev wlan0 root tbf rate 10Mbit burst 10kb latency 5ms
tc qdisc add dev wlan0 root tbf rate 220kbit latency 50ms burst 1540
Could anyone give me any advice on how to do it, or where I'm doing wrong??
You need to distinguish the packet direction. The two directions are:
Since your use case is downloading, we are talking about ingress. The token bucket filter is a queuing algorithm, so it does not apply here. The only way to influence a download is to drop packets (or simulate dropping by using ECN). You can find more information about policing in LARTC.