|
mac geekeryGet your geek on. |
Service Bandwidth ThrottlingDecember 17, 2005 - 12:50pm
HairyPotter asks: QuestionI send several emails a day with large attachments. When sending those emails, Mail uses all of my poor ADSL upstream bandwidth (90 Kbps). So, during those periods I cannot navigate in the web. It’s really a pain, cause I have to wait Mail finishing before I can navigate again. In the past I had problems while uploading files thru FTP, but I discovered a that the FTP command gives users the ability to control how much bandwidth to use. The day I discovered that I was a happy man. So, you see my problem. Than I ask: is there any way to specify how much bandwidth programs can use on MacOS? thanks! AnswerYou want to throttle your bandwidth per service. That is, limit traffic over a certain port to a certain speed. On other operating systems, like Linux, this is built into the firewall service of the network stack and is relatively easy to get to. In Mac OS X, however, this service is missing. Yet, it does allow for traffic to be diverted to a program and for that program to process the data, thus we have throttled, a GPLed command-line traffic limiter. If that’s not your fancy, they have a gooey version as well. In my somewhat limited testing, it appears to do what it says and cap just about any service. The plus side to figuring out the command-line version is that you could control it with cron and turn on throttling of certain services at times you’ll use the computer, then uncap it when not in use. But if it’s just for email, well, either works just fine. About Adam Knight |
|
||||
Actually, this capability is built right into OS X with ipfw. Because of ipfw’s flexibility, very targeted bandwidth limiting rules can be made in only a few lines.
The following ipfw rules will limit connections from my Mac to my ISP’s mail server to 100K per second only for outgoing smtp connections:
sudo ipfw pipe 1 config bw 100Kbit/ssudo ipfw pipe 1 tcp from me to smtp.west.cox.net 25Obviously, the rate can be tailored to anything you like, and the rule is specific enough not to get in the way of any other connections going on. This isn’t persistent accross reboots though, but finding a way to make it run at each boot can probably be found elsewhere on this site.
I hunted, and I hunted, and the rabbit eluded me. I’ve done this with FreeBSD and Linux, but when I tried BSD syntax in Mac OS X it failed. I then looked into it and was told dummynet wasn’t in Mac OS X…
However, now that I know to keep looking, it appears this was added in Tiger.
So, to expand the answer: In Tiger, use
ipfwfor your needs. In Panther and earlier, use throttled.—
cp