代码之家  ›  专栏  ›  技术社区  ›  bdur

启用数据包丢失的命令

  •  0
  • bdur  · 技术社区  · 13 年前

    我正在寻找一种实现数据包丢失的好方法。我为ubuntu找到了这个命令。该命令应该使接口wlan11丢失其接收到的数据包的10%(0.10)。

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

    这个命令好用吗?或者有什么更好/简单的命令/方法可以使用吗。

    非常感谢。

    1 回复  |  直到 13 年前
        1
  •  1
  •   Community Mohan Dere    9 年前

    你复习了吗 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
    

    希望这能帮助并提供更好的方法来处理这个问题!

    推荐文章