用于测试 P2P 软件的网络地址转换器模拟器
有没有网络地址转换器模拟器可以测试 P2P 软件?
目前我正在为设备开发 P2P 软件,并面临着在不同 2 类型的 NAT 中测试我的软件的问题,例如: - 相同 NAT(相同专用网络)、不同 NAT(不同专用网络)、不同全球网络、不同 Nat 级别后面的客户端
- 我是否需要物理设置测试环境,例如; NAT 后面的节点
或
- 是否有任何网络地址转换器模拟器可以测试 P2P 软件?
Is there any Network Address Translator Simulator exist to test P2P softwares ?
Currently I am working on a P2P softwares for Devices, and facing the issues to to test my software in different-2 type of NATs e.g; - Clients behind same NAT (same Private Network), Different NAT (Different Private Networks) , on Different Global Network , Different Nat Levels
-- Do I need to physically set-up the test environment e.g; Nodes behind NAT
OR
-- Is there any Network Address Translator Simulator exist to test P2P softwares ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
诸如 VirtualBox 之类的虚拟化软件将允许您通过 NAT 将多个来宾 VM(虚拟机)连接在一起,而不是直接使用连接。
Virtualbox 提供的内置 NAT 是不切实际的'点对点友好' 与普通家庭和 ISP 级 NATing 路由器相比。 Virtualbox 的 NAT 似乎是“全锥 NAT”,这使得 NAT 穿越技术(UDP/TCP 打洞)变得异常简单(请参阅这篇 Wikipedia 文章 进行解释),而许多路由器 NAT 要么是“对称 NAT”,要么是某种形式的“受限锥形 NAT” ' 基于源端口和/或地址限制。
因此,模拟通过真实 NAT 进行通信的多个主机的一种方法是使用 Virtualbox 等虚拟化工具,并通过基于 Linux 的“路由器”虚拟机将它们连接在一起,这些虚拟机使用 Linux 内核中内置的 netfilter 功能执行路由和 NAT。
iptables
命令允许您设置 netfilter 规则以实现各种 NAT 行为(如上述维基百科文章中详细介绍),例如 使用iptables
的全锥 NAT。。有关设置 netfilter/IP 伪装(NAT 所需)的一般信息,请参阅此操作方法:
http://www.ibiblio .org/pub/linux/docs/howto/other-formats/html_single/IP-Masquerade-HOWTO.html
您当然可以将您的 P2P 软件绑定到各种本地接口(在 127.0.0.0/24 范围内或使用IPv6 子网)并在单台计算机上配置路由表和 netfilter 规则,无需虚拟化即可完成此操作。我不确定哪种方法对您来说更容易,如果您有机器资源,虚拟化方法可能会更容易跟踪。
Virtualization software such as VirtualBox will allow you to connect multiple guest VMs (Virtual Machines) together via NAT rather than use direct connections.
The built in NAT provided by Virtualbox is unrealistically 'peer-to-peer friendly' though when compared to common home and ISP level NATing routers. Virtualbox's NAT seems to be 'full cone NAT' which makes NAT traversal techniques (UDP/TCP hole punching) unrealistically easy (see this Wikipedia article for explanation) whereas a lot of router NAT is either 'symmetric NAT' or some form of 'restricted cone NAT' based on source port and/or address restrictions.
So one way to simulate multiple hosts communicating over realistic NAT would be to use virtualization tools such as Virtualbox and connect them together via Linux based 'router' VMs that perform the routing and NAT using the built in netfilter functions in the Linux kernel. The
iptables
command would allow you to set up netfilter rules to achieve the various NAT behaviours (as detailed in the above Wikipedia article), e.g. full cone NAT usingiptables
..See this how-to for general information on setting up netfilter/IP-masquerading (required for NAT):
http://www.ibiblio.org/pub/linux/docs/howto/other-formats/html_single/IP-Masquerade-HOWTO.html
You could of course bind your P2P software to various local interfaces (within 127.0.0.0/24 range or use an IPv6 subnet) and configure the routing tables and netfilter rules on a single machine to do this without virtualisation. I'm not sure which approach would be easier for you though, if you have the machine resources the virtualisation approach may turn out to be easier to keep track of.