#!/bin/sh
if [ "$#" -ne "3" ]
then
echo "Usage:\n$0 <bandwidth in kpbs> <delay in ms> <packet loss ratio>";
exit 1
fi
BW=$1
DELAY=$2
PLR=$3
sudo ipfw pipe 1 config bw ${BW}Kbit/s delay $DELAY plr $PLR
sudo ipfw add 1 pipe 1 all from me to not me
sudo ipfw add 2 pipe 1 all from not me to me
echo "RETURN to stop connection noise"
read
sudo ipfw delete 1
sudo ipfw delete 2
exit 0
The script will simply add a pipe to your firewall with the bandwidth, delay and packet loss you specify and redirect all of your Mac's trafic over that pipe. It than waits for RETURN to delete the rule and get your trafic to normal.
Here is a table with some usefull parameters taken from :
Scenario | Bw (Kbit) | delay (ms) | pr (ratio) |
2.5G mobile (GPRS) | 50 | 200 | 0.2 |
3G mobile | 1000 | 200 | 0.2 |
VSAT | 5000 | 500 | 0.2 |
Busy LAN on VSAT | 300 | 500 | 0.4 |
For more bandwidth info check:
Thanks! this works great.
ReplyDeleteI get "sudo: ipfw: command not found" in OS X El Capitan
ReplyDelete