Skip to content

Instantly share code, notes, and snippets.

@parrish
Created June 25, 2014 17:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save parrish/8cc9258721e5602091c4 to your computer and use it in GitHub Desktop.
Save parrish/8cc9258721e5602091c4 to your computer and use it in GitHub Desktop.
OS X bandwidth throttling
function dethrottle {
sudo ipfw delete 1
}
function throttle {
if test $# -eq 0
then
echo 'throttle <port> <bandwidth (KB)>'
elif test $# -eq 1
then
# default to port 3000 if only argument given
sudo ipfw pipe 1 config bw $1KByte/s && sudo ipfw add 1 pipe 1 src-port 3000 && sudo ipfw add 1 pipe 1 dst-port 3000
elif test $# -eq 2
then
sudo ipfw pipe 1 config bw $2KByte/s && sudo ipfw add 1 pipe 1 src-port $1 && sudo ipfw add 1 pipe 1 dst-port $1
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment