Sometimes when you’re downloading a big file you just don’t want it lagging out your gaming. Well, this is where the traffic shaper (tc) in Linux comes in really handy. Using some scripts I snarfed from the net, I came up with a nice 4 tier system of traffic priority:
- Everquest or Everquest 2 traffic (determined by server IP address)
- ssh or other interactive traffic, as well as ‘ack’ packets to avoid retransmits.
- Normal traffic
- Bulk downloads (ftp etc.)
To make sure things all worked smoothly, I throttled the line to a total of 150kbps (about the maximum it seems to support) for the top tier and took off 10kpbs for each tier below it to leave ample breathing room for when traffic was needed “right now”. It really is amazing the difference it makes, especially to ssh traffic when I’m accessing the network remotely – all of a sudden I just don’t notice the other activity on the line!
My ‘tc’ script is pretty ugly, but here it is in all its glory
Now, of course, I want to monitor what things are looking like so grabbed the polltc script which uses rrdtool to generate pretty graphs for me! It does tell me that I need to work on my filtering script as the detection of bittorrent downloads doesn’t seem to be working too well. Next project I guess is to figure out getting iptables involve in the filtering which will make things work a *lot* better (and clean the script up a lot too). I just can’t go bringing iptables up and down while my wife is playing EQ – she gets upset at going linkdead all the time!