Bandwidth throttling on OS X

I’ve been using Charles HTTTP Proxy for bandwidth throttling and network monitoring in general. It’s a great little tool, but when it comes to bandwidth throttling, it will only throttle HTTP and HTTPS traffic on ports 80 and 443 respectively.

I thought there had to be a way to throttle bandwidth on any port using the native IP firewall and traffic shaper program. After reading up the documentation for ipfw, I figured out a way to throttle speed on any outgoing port.

For example, the following example will create a pipe that will allow 25Kb/s to go through port 1935.

sudo ipfw pipe 1 config bw 25KByte/s
sudo ipfw add 1 pipe 1 src-port 1935

To disable throttling, simply delete the throttling rule:

sudo ipfw delete 1

Marko