I spent some time today experimenting with traffic shaping on ddwrt. My VOIP calls were still stuttery due to packet congestion. Although this time I traced the congestion back to my wireless bridge. Good thing it runs linux and I was able to install the following script. It simply prioritises packets in and out of my wireless gateway on both the wired and wireless interfaces. This is nice because people I call will no longer hear a stuttering or voice drop out when there are large file transfers going on. It simply creates 3 queues (mobile, laptop, all other) on both interfaces and sets up a simple prio between them. All classes are guaranteed at least 200kbps (should the wireless connection be really bad and the PHY drop down to 500k. But the beauty of the HTB shaping model is that it will borrow. So in this case classes (laptop and “all other”) can borrow from “mobile” when they need more “tokens”. IE the right to transmit a packet.
Did I mention DDWRT was cool?
#eth0 is wired #eth1 is wireless #everything heading from wired to wireless tc qdisc del dev eth1 root tc qdisc add dev eth1 root handle 2: htb default 30 tc class add dev eth1 parent 2: classid 2:1 htb rate 100mbit tc class add dev eth1 parent 2:1 classid 2:10 htb rate 100mbit ceil 100mbit prio 1 tc class add dev eth1 parent 2:1 classid 2:20 htb rate 200kbit ceil 100mbit prio 2 tc class add dev eth1 parent 2:1 classid 2:30 htb rate 200kbit ceil 100mbit prio 3 tc qdisc add dev eth1 parent 2:10 handle 10: sfq perturb 10 tc qdisc add dev eth1 parent 2:20 handle 20: sfq perturb 10 tc qdisc add dev eth1 parent 2:30 handle 30: sfq perturb 10 tc filter add dev eth1 parent 2: protocol ip prio 16 u32 match ip dst 10.15.11.8 flowid 2:10 # mobile tc filter add dev eth1 parent 2: protocol ip prio 16 u32 match ip dst 10.15.11.7 flowid 2:20 # laptop wireless #everything heading from wireless to wired (we don't one client killing others) tc qdisc del dev eth0 root tc qdisc add dev eth0 root handle 3: htb default 30 tc class add dev eth0 parent 3: classid 3:1 htb rate 100mbit tc class add dev eth0 parent 3:1 classid 3:10 htb rate 100mbit ceil 100mbit prio 1 tc class add dev eth0 parent 3:1 classid 3:20 htb rate 200kbit ceil 100mbit prio 2 tc class add dev eth0 parent 3:1 classid 3:30 htb rate 200kbit ceil 100mbit prio 3 tc qdisc add dev eth0 parent 3:10 handle 10: sfq perturb 10 tc qdisc add dev eth0 parent 3:20 handle 20: sfq perturb 10 tc qdisc add dev eth0 parent 3:30 handle 30: sfq perturb 10 tc filter add dev eth0 parent 3: protocol ip prio 16 u32 match ip src 10.15.11.8 flowid 3:10 # mobile tc filter add dev eth0 parent 3: protocol ip prio 16 u32 match ip src 10.15.11.7 flowid 3:20 # laptop wireless # list what we have tc -s -d qdisc show dev eth0 tc -s -d qdisc show dev eth1