UPnP NAT遍历Android上的3G / 4G无线数据连接

时间:2012-04-24 04:30:07

标签: android networking 3g nat upnp

有没有办法在Android上通过3G / 4G连接使用UPnP进行NAT遍历,如果有,是否依赖于运营商?

3 个答案:

答案 0 :(得分:6)

不,暂时你无法做到这一点,原因很简单,因为移动运营商不使用住宅级NAT - 他们拥有的是“运营商级NAT”CGN,请参阅此处{{ 3}},这些设备与住宅网关的端口分配和管理机制截然不同。

请参阅此集合中的运营商级NAT(CGN)相关文档:http://en.wikipedia.org/wiki/Carrier-grade_NAT

PS 目前有一种类似UPnP的协议,可用于CGN,即“端口控制协议”(PCP),请参见此处:http://www.scribd.com/collections/3292450/P2P

答案 1 :(得分:3)

Cling有特定于Android的UPnP类,从论坛消息及其文档的外观来看,它应该可行。我目前正在PC上测试它,但最终我选择它是因为他们的Android支持。我会在一两天内将测试结果发布到这里。

检查Cling Core,特别是Support libraries。在最基本的级别,您只需要4行代码来进行端口映射。

[更新] Android的Cling文档声明它只允许绑定到Wi-Fi接口,因此无法在蜂窝数据连接上进行端口映射(至少使用Cling版本1.0.5)

答案 2 :(得分:0)

Instead of trying to use uPnP (which is a security risk because it lease an unmapped port open), you might want to either use STUN to get a public ip/port and then establish a UDP connection which you can tunnel psudo-TCP through, or use a TURN server. For carrier grade NAT, if you don't want to pay for relaying, there is also this technique, which might sometime work:

https://drive.google.com/file/d/0B1IimJ20gG0SY2NvaE4wRVVMbG8/view?usp=sharing

相关问题