Thursday, October 4, 2007

Throttling bandwidth usage for Miro (formerly Democray Player)

Miro is a great software. Unfortunately, there are still some bugs to be ironed out and it can quickly become a bandwidth hog.

Sometimes, it hogs so much bandwidth on my macbook that I cannot browse the net or download my email.

Hence, I wrote this small script thats uses ipfw and dummynet features of BSD (and OS X Tiger) to throttle bandwidth to ports used by Miro:

#sudo ipfw pipe 1 config bw 24Kbit/s
#sudo ipfw queue 1 config pipe 1 weight 1
#sudo ipfw queue 2 config pipe 1 weight 3
#sudo ipfw add 10 queue 1 ip from `hostname` to any src-port 8500-8600
#sudo ipfw add 20 queue 2 ip from any 1024-65535 to `hostname`

Now, verify that your Miro bandwidth usage goes down in the real-time !!

If something is wrong, then type "sudo ipfw flush" and start over.

This will not survive a reboot. This will only work for OS X 10.4

0 comments: