Created
October 11, 2014 22:06
-
-
Save IanVaughan/c7ed8b3c1b38b1516232 to your computer and use it in GitHub Desktop.
Make your internet like the 80ies
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
#!/bin/bash | |
help() { | |
echo 'G o S L O W ...' | |
} | |
stop() { | |
sudo ipfw delete 1 | |
sudo ipfw delete 2 | |
sudo ipfw pipe 1 delete | |
echo "Its off now!" | |
} | |
start() { | |
stop | |
echo "Setting to $1ms" | |
sudo ipfw pipe 1 config bw 512Kbit/s delay $1ms | |
# For packet loss, add plr <n>, where <n> is a floating point number between 0 and 1 (0 meaning no loss, and 1 meaning that all packets are discarded). This will for example simulate a mobile lossy connection pretty well. | |
sudo ipfw add 1 pipe 1 src-port 80 | |
sudo ipfw add 2 pipe 1 dst-port 80 | |
} | |
# sudo ipfw pipe 1 config bw 16Kbit/s delay 350ms | |
case "$1" in | |
stop|off|down) stop ;; | |
start|on|up) start $2 ;; | |
*) help ;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment