3G中的NAT如何工作 [英] How does NAT in 3G works

查看:105
本文介绍了3G中的NAT如何工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

1)在Android移动设备上,当我连接到3G时,我获得了一个公共地址1.39.1.85(已从Google检查过),而我的移动电话的本地ip是通过编程获得的10.145.15.50. 2)这两个地址是如何分配的?防弹少年团? NAT? 3)两个移动节点是否可以具有相同的公共IP地址? 4)我了解NAT和防火墙.

1) In a Android mobile, when I connect to 3G , I get a public address as 1.39.1.85 which I checked from google and the local ip for my Mobile is 10.145.15.50 which I got programatically. 2) How are these two addresses Assigned? by the BTS? NAT? 3) Is it possible for two mobile nodes can have same public IP address? 4) I know about NAT and Firewalls.

我尝试了UDP打孔: A)使用移动设备A,我向UDP服务器Java程序发送了一个UDP数据包,该程序捕获了它的公共ip和端口. b)使用移动B,我向UDP服务器java程序发送了一个UDP数据包,该程序捕获了它的公共ip和端口. c)每当我在服务器中收到数据包时,我都会用UDP数据包答复,并且能够在Mobile中接收答复. d)但是当我尝试交换每个移动设备的IP和端口并发送数据时.我无法在任何一部手机上接收任何数据.

I tried UDP hole punching: A) Using Mobile A, I sent a UDP packet to a UDP server java program which captures its public ip and port. b) Using Mobile B, I sent a UDP packet to a UDP server java program which captures its public ip and port. c) For each time I receive a Packet in server I reply with a UDP packet and I am able to receive the reply in Mobile. d) But when I try to exchange the IP and Port of each mobile and send data. I cant able to receive any data on either mobile.

这里到底是什么问题?

请尽可能从技术角度进行解释.

Please explain this in as technical as possible.

推荐答案

在4)中,您说您了解NAT和防火墙.然后,您还应该知道IPv4短缺.

In 4), you say you know about NAT and firewall's. Then you should also be aware of the IPv4 shortage.

因此,在您的提供商上,移动节点从G3提供商的DHCP服务器获得了专用IP地址,而公用地址只是提供商从其互联网提供商处获得的地址.

So, on your provider, mobile node's get a private IP address (from the DHCP server of the G3 provider, and the public address is just an address the provides has aquired from it's internet provider.

NAT的要点是,多个设备共享相同的公共IP地址,因此YES 2移动设备可以具有相同的公共IP地址,特别是如果它们位于可能位于同一区域的同一提供者上(连接到相同的天线杆/天线).

The whole point of NAT is that several devices share the same public IP address, so YES 2 mobile devices can have the same public IP address, specially if they are on the same provider en possibly in the same area (connect to the same mast/antenna).

NAT的全部目的是让尽可能多的设备成为一个公共IP地址.您很可能在此私有IP范围内获得了DNS服务器,最有可能的情况是,像HTTP这样的流量是通过透明代理运行的.您不知道,但是如果代理中的内容足够新鲜(但是这又是另一回事),那么您的许多连接甚至都不会到达互联网

The whole point of NAT is to get as much devices behing one public IP address as possible. You probabely will have gotten a DNS server within this private IP range, and most likely, traffic like HTTP is ran through a transparant proxy. You don't know, but a lot of your connections never even reach the internet, if content in the proxy is fresh enough (but that is another story)

现在,如果NAT路由器(ca和cb)后面的两个(或更多)设备访问两个不同的网站(sa和sb),该怎么办?路由器可以选择使用其公用IP地址上的同一端口将请求发送到服务器,因为在此公用IP地址/端口组合上返回到路由器的答案很容易区分:来自sa的流量必须转发到ca ,以及从sb到cb的答案.

Now, what if two (or more) devices behind a NAT router (ca and cb) access two different websites (sa and sb). The router CAN choose to use the same port on its public IP address for sending the request to the server, for an answer back to the router on this public IP address/port combination is easily distinguishable: traffic from sa has to be forwarded to ca, and an answer from sb to cb.

这样,客户端创建的端口转换只能由客户端首先访问的服务器使用.

This way, a port-translation created by a client, can ONLY be used by the server the client accessed in the first place.

小型家庭路由器,可能只有10个设备(我的小型家庭网络最多可以容纳30个设备),与大型电信提供商所使用的大型路由器截然不同.我们的家用路由器具有65.000+个可用的公共IP端口,并不一定要非常经济.对于大型电信提供商来说,这是另一个故事. 因此,尽管家用路由器上的端口转换非常可预测,但大型电信提供商却并非如此.

Small home routers, with mayby 10 devices behing it (my small home network has 30 on last count) are very different beings than the big unit's used by the big telecom providers. Our home router does not have to be very economical with it's 65.000+ available public IP ports. This is another story for the big telecom providers. So while port translations on home routers can be very predictable, this is not the case for big telecom providers.

Google有点"teamviewer的工作原理".在那里,您会发现dat teamviewer严重依赖路由器对端口转换的可预测性.

Google a bit on "how teamviewer works". There you will find dat teamviewer relies heavily on predictability of port-translations by routers.

在10%(或更多)的连接中,不可能建立直接连接,并且整个会话都通过服务器运行.服务器与每个客户端进行双向通信(就像在请求后接收网站一样),并且服务器端将来自一个连接的信息转发给另一个并返回.

In 10% (or more) of the connections, a direct connection is not possible, and the whole session is run through the server. The server has 2-way communication with each client (just like receiving a website after a request), and server-side, information from one connections is forwarded to the other and back.

这能回答您的问题吗?

这篇关于3G中的NAT如何工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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