Question

I am searching a good way to enable packet loss. I came across this command for ubuntu. This command is supposed to make the interface wlan11 to lose 10% (0.10) of the packets it receives.

sudo iptables -A INPUT -i wlan11 -m statistic --mode random --probability 0.10 -j DROP

Is this command good to use or are there any better/easy command/methods that I can use.

Thank You.

Was it helpful?

Solution

Have you review Simulate delayed and dropped packets on Linux? Looks like it got a great number of votes and covers your question about simulating packet loss using netem.

Packet loss

Random packet loss is specified in the 'tc' command in percent. The smallest possible non-zero value is:

2−32 = 0.0000000232%

# tc qdisc change dev eth0 root netem loss 0.1%
This causes 1/10th of a percent (i.e. 1 out of 1000) packets to be randomly dropped.

An optional correlation may also be added. This causes the random number generator to be less random and can be used to emulate packet burst losses.

# tc qdisc change dev eth0 root netem loss 0.3% 25%
This will cause 0.3% of packets to be lost, and each successive probability depends by a quarter on the last one.

Probn = 0.25 × Probn-1 + 0.75 × Random

Hope that helps and provides a better method to handle this problem!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top