-
-
Save nikcorg/6789406 to your computer and use it in GitHub Desktop.
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/sh | |
# | |
# simulate_3g.sh - Simulate a sluggish 3G network with delays & packet loss | |
# Usage: simulate_3g.sh 8080 8081 | |
# Make sure only root can run our script | |
if [[ $EUID -ne 0 ]]; then | |
echo "This script must be run as root" 1>&2 | |
exit 1 | |
fi | |
# Simulate http over 3G, 300kbit/s with 5% packet loss and 200ms delays | |
# into all ports given as a parameter | |
ipfw pipe 1 config delay 200 plr 0.1 bw 300kbit/s | |
for var in "$@" | |
do | |
ipfw add 1 pipe 1 dst-port $var | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment