The Linux kernel has the ability to do traffic shaping / QoS which can be set up using the `tc(8)` command (not `iptables`). The full details are too much to go in to an answer here, but as a first step you may want to look at the Linux Advanced Routing & Traffic Control howto.
There are also a number of applications that build on the `tc` command to allow you to more easily define shaping rules such as _wondershaper_ or as part of a firewall system such as _shorewall_.