I was doing this for a while (actually it was an OpenBSD box because pf is much more sane to use compared to tc/iptables) but found a better way. Rather than having a general purpose machine running 24/7 sucking down electricity (and having a big ugly grey box sitting on my desk) I bought a Linksys WRT54GL router and installed the open source DD-WRT
firmware on it. It does easy traffic shaping, port forwarding/NAT and firewalling including full layer 7 filtering.
It does everything my old dedicated router did with less power usage, much smaller form factor, no fan noise and it has a decent web admin interface out of the box. Essentially it's like buying a tiny dedicated Linux router box that actually designed to be a wired/wireless router.