Skip to content

Instantly share code, notes, and snippets.

@j-keck
Created November 13, 2014 09:40
Show Gist options
  • Save j-keck/2687ee5393272896983f to your computer and use it in GitHub Desktop.
Save j-keck/2687ee5393272896983f to your computer and use it in GitHub Desktop.
lost packets, network latency and rate limit for testing purpose
linux:
# drop packets (10% probability)
iptables -A INPUT -m statistic --mode random --probability 0.1 -j DROP
iptables -A OUTPUT -m statistic --mode random --probability 0.1 -j DROP
# drop packets (10% probability), add latency (500ms) and limit bandwidth (1Mbps)
tc qdisc add dev eth0 root netem delay 250ms loss 10% rate 1mbps
[see stackoverflow](http://stackoverflow.com/questions/614795/simulate-delayed-and-dropped-packets-on-linux)
freebsd:
# drop packets (10% probability), add latency (500ms) and limit bandwidth (1Mbps)
ipfw add 1 pipe 1 ip from me to any
ipfw add 2 pipe 1 ip from any to me
ipfw pipe 1 config delay 500ms bw 1Mbit/s plr 0.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment