NAT 穿越 - 使用 STUN 的成功概率 [英] NAT Traversal - Probability of success using STUN

查看:111
本文介绍了NAT 穿越 - 使用 STUN 的成功概率的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个 P2P 应用程序,我需要使用 STUN 和/或 TURN 进行 NAT 遍历.我已经研究了仅使用 STUN 时出现的问题(基本上它并不总是有效,因为它是基于 UDP 的,有些防火墙不喜欢那样 - 根据我的问题,原因并不那么有趣),我一直看到关于使用 STUN 和 TURN 进行回退的建议(ICE 方案).

I am developing a P2P application, and I need to use STUN and/or TURN for NAT traversal. I have looked into the issues that an arise when using STUN only (basically it will not always work because it is UDP based and some firewalls won't like that - the reason is not that interesting as per my question), and I keep seeing recommendations about using STUN and TURN for fallback (the ICE scheme).

但无论我看哪里,我都只看到人们 STUN 是不太可能总是有效的".我正在寻找的是一些具体的数字/统计数据.我可能会尝试自己生成它们,但我没有足够的客户来获取重要样本.

But everywhere I look I just see people STUN as "unlikely to always work". What I am looking for is some concrete numbers / stats. I might try to generate them myself but I don't have enough clients for a significant sample.

所以我想知道是否有人可以阐明有关使用 STUN 进行 NAT 遍历的成功率的统计数据.如果我不使用 TURN 作为后备,有多少对等点将无法连接?

So I was wondering if anyone could shed some light on stats around the success rate of using STUN for NAT traversal. How many peers would not be able to connect if I fail to use TURN as fallback?

推荐答案

根据您的客户是谁、他们在哪里以及他们使用的设备类型(PC 还是移动设备),结果可能会有所不同.

Depending on who your customers are, where they are, and the types of devices they use (PCs vs Mobile), the results can vary.

在实践中(根据我的经验),对于台式机和笔记本电脑,仅使用 STUN 的 ICE 连接成功率约为 85%.但是如果它对特定的一对端点工作一次,那么这些相同主机的后续连接将更有可能(假设网络拓扑没有改变).移动设备的情况略有不同.

In practice (based on my experience), ICE connectivity with STUN alone is about 85% successful for desktop and laptop PCs. But if it works once for a particular pair of endpoints, it will be even more likely for subsequent connections for these same hosts (assuming network topologies have not changed). Things are a bit different for mobile devices.

以下是一些影响 P2P 成功连接"(基于 UDP 或 TCP)的因素.

Here are some factors that influence getting a successful "connection" (either UDP based or TCP) for P2P.

  1. NAT 类型.如果两个端点都在行为良好的端口受限"NAT 或更好的后面,那么 STUN 成功的机会很高.这是具有良好 ISP(例如美国的 ISP)的家庭 NAT 的常见情况.但由于具有多层 NAT 和网络配置,移动运营商和企业防火墙通常会实施对称 NAT".这基本上意味着端口映射不一致 - 并且像 ICE 这样的 P2P 算法更难与其建立连接.

  1. NAT type. If both endpoints are behind well behaved "port restricted" NATs or better, then chances are high for success with STUN. This is the usual case for home NATs with a good ISP such as those in the US. But mobile carriers and enterprise firewalls typically implement "symmetric NAT" as a result of having multiple layers of NATs and network configurations. This basically means that port mappings are not consistent - and are harder for a P2P algorithm like ICE to establish a connection with.

防火墙或企业配置.即使防火墙允许出站 UDP 数据包并接受数据包返回,它通常也是对称 NAT 配置.

Firewalls or Enterprise configurations. Even if the firewall allows outbound UDP packets and accepts packets back, it is often a symmetric NAT configuration.

移动运营商.通常(但不总是)是对称 NAT 类型.

Mobile carriers. Are often (but not always) symmetric NAT types.

这篇关于NAT 穿越 - 使用 STUN 的成功概率的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆