For testing purposes, to determine how a protocol implementation behaves in the presence of packet loss, I would like to force packet loss on one of my network devices. Specifically, I would like to be able to tune the packet loss anywhere between 0% and 100%. I have a little experience with iptables and it seems to me I should be able to achieve it using that, but I haven't been able to. Achieving 100% packet loss is not a problem though ;). Any ideas on how to do this?
Asked
Active
Viewed 1,655 times
4
-
1Duplicate? http://stackoverflow.com/questions/614795/simulate-delayed-and-dropped-packets-on-linux – Mar 08 '12 at 11:48
-
It certainly seems so. I didn't see it when Googling the stackoverflow domain for these terms and it certainly wasn't in the list of suggested duplicates. – Confusion Mar 08 '12 at 11:56
1 Answers
4
Look into iptables' statistic module.
I guess something like
iptables -A FORWARD -m statistic --mode random --probability 0.5 -j DROP
should do the trick on a router.

che
- 12,097
- 7
- 42
- 71
-
Great, that sounds exactly like what I need. I seem to have overlooked it in the manpage. – Confusion Mar 08 '12 at 11:54