Skip to content

Instantly share code, notes, and snippets.

@jlongman
Last active August 29, 2015 14:20
Show Gist options
  • Save jlongman/0baaaa74d86fbc54f500 to your computer and use it in GitHub Desktop.
Save jlongman/0baaaa74d86fbc54f500 to your computer and use it in GitHub Desktop.
FreeBSD pipe satsim
#!/bin/sh
# simple one, assumes pipe
# usage: set_pipe bw delay [errorpercentage]
#ipfw pipe 1 config bw $1Kbits delay $(($2/2))ms plr $3 queue $((($1*$2)/8))bytes
#
# advanced, sets pipe
if [ $# "<" 6 ] ; then
echo "usage: $0 <Client IP> <Server IP> <fw bw, kbps> <return bw, kbps> <delay, ms> <ber, float>";
fi
ipfw -f flush
ipfw -f pipe flush
# following variations depend on FreeBSD version
# ipfw add pipe 1 from $1 to $2 out via bridge0
ipfw add pipe 1 from $1 to $2 bridged
ipfw pipe 1 config bw $4Kbits delay $(($5/2))ms plt $6 queue $((($4*$5)/8))bytes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment