Created
June 25, 2014 17:57
-
-
Save parrish/8cc9258721e5602091c4 to your computer and use it in GitHub Desktop.
OS X bandwidth throttling
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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