Created
May 3, 2012 16:28
-
-
Save dzuelke/2587006 to your computer and use it in GitHub Desktop.
Add bandwidth limit, latency or packet loss to localhost connections on OS X
This file contains 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
# First add a rule for all local traffic to port 80 to go into pipe 1 | |
# 100 is the rule number which will be used for referencing the rule later | |
sudo ipfw add 100 pipe 1 ip from 127.0.0.1 to 127.0.0.1 dst-port http | |
# To display the rule use | |
# sudo ipfw show 100 | |
# configure the settings of the pipe as you please | |
# 50kbit/s bandwidth | |
sudo ipfw pipe 1 config bw 50Kbit | |
# 200ms lag | |
sudo ipfw pipe 1 config delay 200ms | |
# 20% random packet loss | |
sudo ipfw pipe 1 config plr 0.2 | |
# To display the current connections on the pipe use: | |
# sudo ipfw pipe 1 show | |
# when finished testing don't forget to delete rule and pipe | |
sudo ipfw delete 100 | |
sudo ipfw pipe 1 delete |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment