模拟 WAN 网络的最佳方法
简而言之,我有一个应用程序,其中数据旨在通过互联网在两台服务器之间流动。 理想情况下,我想测试软件在什么时候停止运行。 在什么下限(带宽、延迟、丢包)下,测试软件的可靠性就会停止工作。
我认为我会做如下:
- 设置 3 台计算机(VMware 实例)
- 在其中两台服务器上安装 2 个应用程序。
- 通过在 Windows 2003 上使用路由和远程访问进行某种魔法,将第三台服务器设置在两台计算机之间 安装
- Traffic Shaper XP 或 NetLimiter 限制带宽
- 运行类似 TMnetSim Network Simulator 来模拟不良连接。
这听起来是个好主意还是有更简单/更好的方法来做到这一点? 我对 Linux 不太熟悉,我的队友更不习惯。
Simplified, I have an application where data is intended to flow over the internet between two servers. Ideally, I'd like to test at what point the software ceases to function. At what lowerbound limit (bandwidth, latency, dropped packets) do things stop working to test the reliability of the software.
What I thought I would do was the following:
- Setup up 3 machines (VMware instances)
- Install the 2 applications on two of the servers.
- Setup up the 3rd server to sit between the two machines by doing some sort of magic with Routing and Remote Access on Windows 2003
- Install either Traffic Shaper XP or NetLimiter to limit the bandwidth
- Run something like TMnetSim Network Simulator to simulate a bad connection.
Does this sound like a good idea or are there easier/better ways of doing this? I'm not that comfortable on Linux and my team mates are even less so.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
WANem 正是这样做的。 我们在桌面虚拟机和专用旧电脑上都使用了它,效果非常好。 它可以模拟各种断开的连接。
WANem does exactly this. We have used it both in a virtual machine on the desktop and on a dedicated old pc and it worked great. It can simulate all sorts of broken connectivity.
FreeBSD 的 ipfw 可以模拟给定带宽、延迟或错误率的链路。 您可以使用该 FreeBSD 机器作为上述设置中“中间”的机器。
如果您想减少所涉及的服务器数量,您可能还可以在同一台计算机上运行至少一个端点。
FreeBSDs ipfw has provisions to simulate links with a given bandwith, latency or error rate. You could use that FreeBSD machine as your machine "in the middle" in your above setup.
You probably can also run at least one of the endpoints on the same machine if you want to reduce the amount of servers involved.
有人实际上打包了 FreeBSD 解决此问题所需的设置和内容,他们称之为 虚拟网。
它可以准确地模拟您想要的内容,并且它是免费的,并且可以启动到商用硬件上。 他们甚至有一个罐装安装,它足够小,可以放在软盘上(!),您可以在该链接上下载。
Someone actually packaged up the settings and whatnot necessary for the FreeBSD solution to this problem and they call it DUMMYNET.
It can simulate exactly what you want, and its free and will boot onto commodity hardware. They even have a canned install of it that is small enough to put on a floppy disk (!) that you can download at that link.
也许是时候了解一下 Linux 了,因为只需键入一行即可在每个传出数据包上添加 50 毫秒的延迟:
有关更多信息,请参阅 Linux 流量控制指南
Maybe it is time to learn a bit about Linux because adding a 50ms delay on every outgoing packet can be done in typing just one line:
For more see the Linux Traffic Control HOWTO
大约十年前我们有类似的要求 - 我看看我是否能回忆起我们是如何做到的。
如果我记得的话,我们编写了一个套接字代理程序,该程序由 UNIX 机器上的 inetd 控制。 该套接字将接受来自客户端的连接并打开到服务器的等效会话。 然后它会循环,在两个方向上传递消息。
我们实现 WAN 特性的方法是在连接建立和链路建立后的数据传递中引入随机延迟(有上限和下限)。
它还具有偶尔断开链接的功能,因为 WAN 链接对我们而言不如本地流量可靠。
我记得我们必须使其线程化,以阻止延迟影响链路上的反向流量。
We had a similar requirement some ten years ago - I'll see if I can recall how we managed it.
If I remember, we wrote a socket proxy program which was controlled by inetd on a UNIX box. This socket would accept connections from a client and open equivalent sessions through to the server. It would then loop, passing messages in both directions.
The way we achieved WAN characteristics was to introduce random delays (with upper and lower limits) in both the connection establishment and the passing of data once the link was up.
It also had the feature to drop the link occasionally as WAN links were less reliable for us than local traffic.
I recall we had to make it threaded to stop the delays from affecting reverse traffic on the link.
有一个非常好的(而且免费的)微软解决方案,我们使用它相当长一段时间并且效果很好,它可以很容易地模拟一切(数据包丢失、低带宽、断开连接、延迟......)
这是我在 Windows 环境中找到的最佳解决方案
更多信息和下载链接可以在此处找到:MARCO 博客文章
该产品已经发生了一些演变,现在作为自动化测试的一部分集成到 Visual Studio 中,但我发现独立的使用(很难找到,因此保留本地副本)以更好地工作。 请记住,您至少需要两台计算机(或虚拟机),因为您需要通过网络适配器才能使应用程序发挥其魔力。
There is a very good (and free) Microsoft solution for that, we use it for quite some time and it works great, it can very easily simulate every thing(packet loss, low bandwidth, disconnection, latency....)
This is the best solution i found for a windows environment
More information and a download link can be found here: MARCO blog post
this product has gone some evolution and it is now integrated into visual studio as part of the automation testing, but i found the use of the standalone(that is quite hard to find, so keep a local copy) to work much better. keep in mind that you need at least two computers(or VMs) since you need to pass through a network adapter in order for the application to work its magic.