2013-02-21 111 views
0

我正在尋找一個很好的方法來啓用數據包丟失。我遇到了ubuntu的這個命令。該命令應該使接口wlan11丟失接收到的數據包的10%(0.10)。命令啓用數據包丟失

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

這個命令很好用,或者有我可以使用的更好/簡單的命令/方法。

謝謝。

回答

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 

希望能幫助並提供更好的方法來處理這個問題!