Monday, February 16, 2009

bittorrent and VoIP in the same sentence

At my home I have an modest ADSL line with a standard 128kbits upload. The upload is shared between several computers, an bittorrent process and asterisk (VoIP) server. I have looked around for an simple script to balance the upload according to set of very simple rules:
  • VoIP packets go out first, no matter what
  • ssh, www, smtp, etc go after
  • everything else (including bittorrent) go last
After many fruitless hours of trying I have found a sample script at and then heavily modified it.
There are only two lines in the script to change. You should be aware of following assumptions in the script however:
  • The machine serves as the gateway for your network
  • Internet is established using autodialer on interface ppp0
  • asterisk runs on the same machine as the shaper
As a result, the VoIP is hitchless, even in presence of unlimited bittorrent upload.

You can download my script here.