In Part 1 of this 'How To' we converted your old Xbox hardware to prepare it for its new life as a full-featured NAS and file server. Then in Part 2, I showed you how to install a complete LAMP-based webserver and TorrentFlux client. In this final installment, we'll add the ability to allocate bandwidth between BitTorrent and other Internet activities, and check out the file serving performance of what we've created.
When using your new Bittorrent client, you might find that, when downloading multiple files, your web browsing and other Internet functions slow down. This is because BitTorrent is incredibly efficient at using all the bandwidth available to it. Unfortunately, this leaves your web or SSH traffic stuck in a queue behind hundreds of BitTorrent packets, so the whole thing grinds to a halt.
This slowdown really affects only outbound traffic because most consumer Internet connections are alloted significantly lower outbound bandwidth than inbound (in the UK, 2048 kbps down and 256 kbps up is pretty common). What we need is a way to move the outbound BitTorrent queue from the ADSL modem/router to the Xbox, and to prioritize the traffic coming from our Xbox so that everything gets priority over the BitTorrent traffic. Fortunately, Linux provides us with a way of doing this!
Take a look at this document, and also this one, (the latter is specific to the Gentoo distro, but there are similarities to other Linux distros) to give you a good background of the tools and theory behind what we are going to do. All of the documents I found assumed that the Linux box was both the router and gateway. However, ours is not, so our configuration will be slightly more simple.