I recently ran into a bandwidth problem using Skype, and I found no easy way to limit it, trickled doesn't work for UDP, and after some research I came across QoS / tc shaping.
I cooked 2 different scripts and here's what I came with :
It works for me ™
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
#!/bin/sh IF=wlan0 ULIMIT=25kbps DLIMIT=40kbps U32="tc filter add dev $IF protocol ip parent 1:0 prio 1 u32" IP="xxx.xxx.xxx.xxx" #this is the ip of the target case "$1" in stop) tc qdisc del dev $IF root tc qdisc del dev $IF ingress ;; show) tc -s qdisc ls dev $IF ;; *) tc qdisc add dev $IF root handle 1: htb default 30 tc class add dev $IF parent 1: classid 1:1 htb rate $ULIMIT ceil $ULIMIT $U32 match ip dst $IP/32 flowid 1:1 tc qdisc add dev $IF handle ffff: ingress tc filter add dev $IF parent ffff: protocol ip prio 10 u32 match \ ip src $IP/32 police rate $DLIMIT burst 80kbit drop flowid :1 tc -s qdisc ls dev $IF ;; esac |
References :
Skype and UDP. My two greatest arch-enemies.