如何模拟低带宽,高延迟的环境?
我需要模拟与服务器的低带宽,高延迟连接,以便在远程站点上模拟VPN的状况。带宽和延迟应该是可调整的,以便我可以找到最佳组合以运行我们的软件包。
解决方案
过去,我使用过使用Linux Netem(网络仿真)功能的网桥。它是高度可配置的-允许引入延迟(第一个示例用于WAN),数据包丢失,损坏等。
编辑:还有MasterShaper Web界面来控制设置。
我注意到Netem对于我的应用程序非常有效,但是最后我也多次使用WANem。提供的可启动ISO(和虚拟设备映像)非常方便。
尝试WANem
WANem is a Wide Area Network Emulator, meant to provide a real experience of a Wide Area Network/Internet, during application development / testing over a LAN environment.
我们曾经在虚拟机内部使用过此软件来进行一些带宽规模测试:
http://www.softinengines.com/index.php?section=download&langu=zh-CN
它不是免费的,但是有30天的试用期。
查尔斯
我遇到了Web调试代理应用程序Charles,并在模拟网络延迟方面取得了巨大的成功。它可以在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机器可以做到这一点非常出色,只需将标准旧台式机,扔进另一个NIC并进行构建即可。
可在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,那么我发现Traffic Control程序将为此类事情提供很大的帮助。
对于Windows,我们可以使用以下应用程序:http://www.softperfect.com/products/connectionemulator/
适用于Windows 2000,XP,2003,Vista,Seven和2008的WAN连接仿真器。
也许是Windows上唯一可用的。
http://www.shunra.com上有一个名为VE Desktop的产品,可用于模拟变化的网络条件。它允许我们通过简单的UI调整延迟,带宽和丢包率。唯一需要注意的是,它不是免费的。希望这可以帮助。
另一个客户端程序(仅Windows)是NetLimiter http://www.netlimiter.com