The Linux Advanced Routing & Traffic Control how-to is probably what you're looking for.
http://lartc.org/
I must make sure you note that as the title indicates it's ADVANCED routing and traffic control.
You should have a good idea of networking concepts to start and then once you start reading the doc, I recommend you re-read it again because you'll have missed stuff... =)
Their wshaper (wondershaper) traffic script is great! And of course, you can tune it to your hearts content, but then again that's not what you're looking for... still the rest will help guide you.