什么工具可用于模拟Ubuntu上的某些networking条件?

为了testing我们的部署,我想模拟某些networking事件,如连接丢失,超时,有限的带宽等。

我已经为此search,但没有find真正适合我的需求的东西。 ipfw似乎是我需要的,但我似乎无法findUbuntu的ipfw软件包。 此外,我想知道是否有替代品,甚至更好的工具,我的任务。

你可以用防火墙模拟这些东西。

Userland工具修改防火墙规则称为iptables

例如,如果你想模拟5秒的连接丢失,你可以这样做

iptables -I INPUT -p tcp -s source.ip.for.which.you.want.to.appear.to.timeout --dpor $port -j DROP ; sleep 5; iptables -D INPUT -p tcp -s source.ip.for.which.you.want.to.appear.to.timeout --dpor $port -j DROP ;

iptables是伟大的,但有些工具在处理这类问题时更加清晰。

  • Lagfactory (基于netem )
  • nistnet 。 旧但强大。
  • Dummynet在

也wanem ,而不是一个独立的应用程序,但更多的定制路由器发行版。

从姊妹站点堆栈溢出: 在Linux上模拟延迟和丢弃的数据包