I work primarily with Linux servers during
$dayjob and sometimes come across needs
where I need to have packet loss. Of course, I can’t be sitting around waiting for
it to happen. Turns out, there’s a pretty simple way to do this.
iptables -A INPUT -s <SOURCE_IP_ADDRESS> -m statistic --mode random --probability 0.1 -j DROP
You can find more info in the iptables-extensions(8) man page. There are some other settings beyond random and probability to make packets drop. So, if you need a more precise kind of packet loss, you could do something like drop every nth packet.