我正在寻找一种启用数据包丢失的好方法。我为ubuntu遇到了这个命令。该命令应该使接口wlan11丢失其接收的10%(0.10)数据包。
sudo iptables -A INPUT -i wlan11 -m statistic --mode random --probability 0.10 -j DROP
这个命令是否可以使用,或者我可以使用更好/更简单的命令/方法。
谢谢。
答案 0 :(得分:1)
您是否已查看Simulate delayed and dropped packets on Linux?看起来它获得了大量的投票,并涵盖了使用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
希望有助于提供更好的方法来解决这个问题!