I am looking for a reliable way to drop packets in linux as if you have bad networking. Looking at stack overflow (and the internet) there seem to be two good possibilities pointed out in this answer. Both of these should get 5% packet loss.
tc qdisc change dev eth0 root netem loss 5%
iptables -A INPUT -m statistic --mode random --probability 0.05 -j DROP
However, the netem documentation states the following:
When loss is used locally (not on a bridge or router), the loss is reported to the upper level protocols. This may cause TCP to resend and behave as if there was no loss. When testing protocol reponse to loss it is best to use a netem on a bridge or router
From my (very limited) understanding, both solutions (netem
and iptables
) use the same solution, and so will suffer the same drawbacks.
Is there any way to acurately simulate dropped packets without resorting to running programs on the switch or a bridge? Would corrupting the packets be a poor man's way to "drop" them, since the CRC will have to re-request them?
Thankyou.