IPFW To The Rescue
May 29, 2010 - 11:01pm EDT
In my continuing quest to avoid saturating the network at my place of business and alienating my co-workers, I've been honing my skills with ipfw, which is a command-line firewall/traffic-shaper for Linux and Mac OS X.
You might ask, "Why don't you just stop downloading huge files all day?" In my work as a developer, it becomes necessary for me to download a lot of massive files. ISO images, corpulent version control repositories, software updates, the list goes on and on.
Thus, while I can't stop downloading large amounts of data, I can force it all to download much more slowly, keeping my own network consumption down and keeping the network usable for everyone else in the office.
So first things first, I'll set up a pipe with a limited amount of bandwidth.
sudo ipfw pipe 66 config bw 100KByte/s
Then I will filter all my downstream traffic through said pipe (basically anything coming to me from the outside world).
sudo ipfw add 1000 pipe 66 ip from not me to me
"But Evan," you ask, "what if there's an emergency and you suddenly need all that extra bandwidth? Or what if you're working after hours and have the T1 all to yourself?" You certainly do ask a lot of questions, don't you? Anyway, simply change the pipe's limit to zero, which effectively means 'no limit whatsoever'.
sudo ipfw pipe 66 config bw 0KByte/s
Just be sure to change it back when you're finished nomming on all that delicious bandwidth.