It’s complicated, but it works great. I have a Linux box that I put up for http access on my DSL. I sometimes let friends download stuff, and I need to limit the bandwidth. Luckily, the system is running Arch linux and it comes with the ‘traffic control’ patches built into the iptables kernel.
So, today, I needed to turn it on. I did it before, so all I had to do was find the time capsule file with my instructions in it. Then it was just, copy/paste, bam…. running.
Here is my set of commands:
tc -s qdisc show
tc qdisc add dev eth0 root handle 1: htb default 11
tc class add dev eth0 parent 1: classid 1:1 htb rate 512Kbit
tc class add dev eth0 parent 1:1 classid 1:10 htb rate 220Kbit
tc class add dev eth0 parent 1:1 classid 1:11 htb rate 512Kbit
tc filter add dev eth0 protocol ip parent 1:0 prio 1 u32 match ip sport 80 0xffff flowid 1:10
This essentially sets up a small tree of pipes. The max output is 512kb for normal traffic. Port 80 traffic can use up to 220kbit. Any other traffic can get at least 292kb and more if the port 80 stuff isn’t in use.