我需要模拟到服务器的低带宽、高延迟连接,以模拟远程站点上VPN的条件。带宽和延迟应该是可调整的,这样我就可以发现最好的组合来运行我们的软件包。


在过去,我使用了使用Linux Netem(网络仿真)功能的桥接。它是高度可配置的——允许引入延迟(第一个例子是WAN)、数据包丢失、损坏等。

我注意到Netem在我的应用程序中工作得非常好,但我也多次使用WANem。提供的可引导的ISO(和虚拟设备映像)非常方便。


尝试WANem

WANem是一个广域网模拟器,旨在在局域网环境下的应用程序开发/测试期间提供广域网/Internet的真实体验。


查尔斯

我遇到了Charles web调试代理应用程序,并在模拟网络延迟方面取得了巨大的成功。它可以在Windows、Mac和Linux上运行。

Bandwidth throttle / Bandwidth simulator Charles can be used to adjust the bandwidth and latency of your Internet connection. This enables you to simulate modem conditions using your high-speed connection. The bandwidth may be throttled to any arbitrary bytes per second. This enables any connection speed to be simulated. The latency may also be set to any arbitrary number of milliseconds. The latency delay simulates the latency experienced on slower connections, that is the delay between making a request and the request being received at the other end.

虚拟网

您也可以使用vmware来运行BSD或Linux,并尝试本文(DummyNet)或本文。


有一篇很棒的关于如何设置一台FreeBSD机器的文章——使用你的标准旧桌面,加上一个额外的网卡,然后构建。

文章可以在http://www.freebsd.org/doc/en/articles/filtering-bridges/article.html上找到。

在上述指令的第5步中,您启用了防火墙。为了模拟不同的IP连接,你可以(例如)执行以下操作:

创建文件“/etc/rc.firewall”。56k,包含以下内容:

ipfw add pipe 1 ip from any to any out
ipfw add pipe 2 ip from any to any in    
ipfw pipe 1 config bw 56Kbit/s   
ipfw pipe 2 config bw 56Kbit/s

修改/etc/rc.conf…更换线路

firewall_type="open"

firewall_type="/etc/rc.firewall.56k"

重新启动,你就有了一个56K的桥!

如果你碰巧在Macintosh上工作,该操作系统默认内置了ipfw。我做了同样的事情,通过机场和以太网路由网络流量,设置它,以便任何经过机场的东西都具有与我试图模拟的东西相同的特征。可以直接在终端上调用ipfw命令,效果相同。


我会尝试在linux上使用netem。有了它,你可以模拟额外的延迟、损坏、丢包和复制。它甚至可以用在环回设备上。


如果你在linux上,我发现流量控制程序对这类事情有很大的帮助。


对于Windows,您可以使用这个应用程序:http://www.softperfect.com/products/connectionemulator/

广域网连接模拟器的Windows 2000, XP, 2003, Vista, 7和2008。

也许这是唯一一个Windows版本。


http://www.shunra.com上有一个产品叫做VE Desktop,可以用来模拟不同的网络条件。它允许你用一个简单的UI调整延迟、带宽和丢包。唯一需要注意的是,它不是免费的。希望这能有所帮助。


另一个客户端程序(仅限Windows)是NetLimiter - http://www.netlimiter.com


我一直在寻找一种易于使用的工具来进行这种类型的测试。前几天我偶然发现了这个:网络延迟模拟器

如果你用的是Windows系统,你应该试试。它超级容易设置和开始,而且似乎工作得很好。可以自定义各个方向的带宽、时延和丢包。另一个非常好的事情是,你可以定义“流量匹配条件”,这样它只影响你想要它的流量。是的,而且是免费的。


对于macOS,有Network Link Conditioner可以模拟可配置的带宽、延迟和丢包。它包含在Xcode的附加工具包中。


使用Fiddler在Windows上找到了这个(免费解决方案) http://www.logic-worx.com/index.php/tools-and-apps/fiddler-connection-simulator/


我想我找到我想要的了。也许你可以让查尔斯代理或者慢慢来。希望能有所帮助。


我在我的Windows电脑上使用NetBalancer。

http://seriousbit.com/netbalancer/

2017-10-07更新:NetBalancer最新免费版本为9.2.7。该程序有一个硬编码的截止日期。在启动NetBalancer服务之前,您需要在2016-10-18之前调回系统时钟。详情请参阅本文。


我发现这个简洁的Windows程序叫笨笨。它还处于alpha阶段,但对我来说工作得很好,而且它是开源的。

编辑:其他人已经注意到你不能用笨拙来限制带宽,这是真的。您只能添加延迟和其他一些与网络相关的错误。 这将取消这个答案作为问题的有效答案的资格,但是,由于我想要模拟一个糟糕的网络时,它很有用,所以我将把它留在这里,只要它有> 0票或类似的投票。


Take a look at the NE-ONE Network Emulator which allows you to configure bandwidth, latency, packet loss, packet reordering, packet duplication, packet fragmentation, network congestion and many more impairments so that you can create real-world network conditions in the lab. Different impairments can be configured for the up and downlink so you could have a really good uplink but a really bad downlink experience, great for seeing how the app handles TCP queuing because the acks don't come back in a timely manner and the overall latency therefore increases!

这里有一个专门针对游戏开发者的概述视频http://www.youtube.com/watch?v=DwtqlE7LcrQ,但它说明了它的内容。NE-ONE是使用web浏览器配置的,所以它真的很容易安装和配置-你不需要是一个网络专家:-)

有一个硬件版本- http://www.itrinegy.com/index.php/products/network-emulators/ne-one -或者你可以下载在VMware ESXi Server下运行的虚拟设备(软件)版本。虚拟设备可以从VMware的Solution Exchange - solutionexchange.vmware.com/store/products/ne-one-flex-network-emulator下载


我想tc可以在基于UNIX的平台上完成这项工作。

tc用于配置Linux内核中的Traffic Control http://lartc.org/manpages/tc.txt


为了模拟一个低带宽连接测试网站使用谷歌Chrome浏览器,你可以去网络选项卡在F12工具和选择一个带宽级别来模拟或创建自定义带宽来模拟。


LANforge ICE is a network emulator with an emphasis on virtual routing, jitter, corruption and delay. Projects have used it to emulate satellite link, cable and modem connections, and high-speed (10Gbit) wan emulation. You can use a Java GUI to build your virtual networks and generate very detailed reports of the traffic flow. The LANforge products also provide traffic generation features: frame, ethernet, layer-3 and stateful traffic (NFS, http). Recent editions for LANforge have sophisticated WiFi testing features as well.


您可以试试这个:CovenantSQL/GNTE 就像这样写YAML:

group:
  - 
    name: china
    nodes:
      - 
        ip: 10.250.1.2
        cmd: "cd /scripts && ./YourBin args"
      - 
        ip: 10.250.1.3
        cmd: "cd /scripts && ./YourBin args"
    delay: "100ms 10ms 30%"
    loss: "1% 10%"
  - 
    name: us
    nodes:
      - 
        ip: 10.250.2.2
        cmd: "cd /scripts && ./YourBin args"
      - 
        ip: 10.250.2.3
        cmd: "cd /scripts && ./YourBin args"
    delay: "1000ms 10ms 30%"
    loss: "1% 10%"

network:
  -
    groups:
      - china
      - us
    delay: "200ms 10ms 1%"
    corrupt: "0.2%"
    rate: "10mbit"

运行。/generate scripts/your.yaml