The diffierence between Symetric NAT and Restricted Cone NAT

A symmetric NAT applies restrictions exactly the same way as a port restricted cone NAT but handles the NAT translation differently. All types of NAT discussed so far(锥形NAT、受限锥形NAT、端口受限型NAT) don’t change the source port when NATing connections. For example when a client accesses the Internet using IP 192.168.0.1 and source port 56723 NAT changes the source IP to say 56.35.67.35 but keeps the port number the same; this is known as port preservation. A symmetric NAT NATs ports to new randomly generated ones. This even applies to connections from the same client to different destinations.

Example – Expanding on the example from the port restricted cone NAT my PC makes two outbound connections to website IP 217.87.69.8 and 56.76.87.98. My PC uses source IP192.168.0.1 with source port 56723 for both connections. On all types of NAT so far both these connections would be NATed to change the source IP address only and keep the source port the same. This time however instead of leaving the source port as 56723 a symmetric NAT changes it to 45765 for one connection and 53132 for the other connection (random). This has created unique mappings for each connection and traffic from those destinations must come in on the respective ports. So 217.87.69.8 must send packets to destination port 45765 and 56.76.87.98 must send packets to port 53132 in addition to the requirements of a port restricted cone NAT.

Why You Are Reading This

Has your Xbox or PS3 reported that your NAT is strict or symmetric NAT? Has your PC application, VoIP or other program reported your NAT as symmetric NAT? I suspect the answer to this is yes because symmetric NATs are the only types of NAT that cause connection problems with other devices also behind NATs.

The first part in understanding why this is an issue is to realise that PC’s, xboxes, PS3s and their associated games and applications DON’T know that they are being NATed. As far as you xbox is concerned it’s IP address is 192.168.0.1. Any devices that communicate with it on the Internet however use the public IP address of your router of say 5.45.4.21. NAT takes care of translating the IP addresses from the public IP to the internal IP when needed. So why is this a problem you ask? Well with any connection attempt the destination IP address and port must be known. In all the examples above you will see that the website IP address was known as well as the port, these are fixed and never change. Some programs however use a range of dynamic ports. When hosting computer games your console will choose a random port to host the game on. Because other consoles don’t know your IP address or port they must learn it somehow before connecting. Your console sends it’s IP address and port for the hosted game to xbox live or the PS3 network where other parties retrieve it and can now connect to you directly. The problem is that it sends it’s internal IP address of 192.168.0.1 and port of say 54324 rather than the Nated public ones. What it should send is (for example) the public IP address of 5.45.4.21 and port 54324. When using a symmetric NAT the port is also changed so it must send the NATed port of say 54254 rather than the internal port of the console itself (54324). This has been a problem with NAT long before gaming came along. So how does the console learn that it is behind a NAT and tell other consoles to send data to the NATted IP address and port rather than it’s own internal IP address and port?

STUN

There are several different protocols/solutions to the NAT problem but STUN is the most common one in use. Stun stands for ** Simple Traversal of User Datagram Protocol (UDP) through Network Address Translators** and as you may have guessed by it’s name it is a collection of utilities to aid in the traversal of a NAT devices. Simply put STUN allows your console/PC or internal device to learn what it’s public NATed IP address and port is. Once this is achieved your device can now send out the correct details to other devices that want to connect to you. But…(and there is always a but) it doesn’t work with Symmetric NATs. With a symmetric NAT your console can learn it’s public IP address but it is impossible to learn it’s public port.

STUN is quite simple in how it works. You connect to a server running the STUN protocol (xbox live servers) and it reads the source IP address and source port from the incoming packets. These of course will be the NATed ones (which are the ones we need). STUN then sends this information back to the client and it’s job is now done. Your console now knows it’s NATed IP and port and will send this onto other devices. If you remember, with the exception of a symmetric NAT all other types of NAT don’t change the source port. What this means is that when my console creates a NAT mapping it will use it for ALL connections of this type; it uses the same ONE mapping when sending and receiving packets to several devices on the Internet therefore it uses the same public IP address and port. In the case of a symmetric NAT however every single connection has a different mapping with a different (randomly generated) port(这句话意思是说,任何一个单独的连接,都会对应一个端口号,这些端口号不会重复,言下之意,发送的数据包,只要源端口号、目的ip、目的端口号,三者中的任何一个发生变化,那么就会映射到一个重新的端口号); the connection to the STUN server will have it’s own unique mapping as will every other console…which means different ports for each mapping. In this case the port that the STUN detected is now useless as this mapping is exclusive to the STUN server. Whatever port is used in the mapping to other devices is unknown and there is no way for STUN to detect it. Since your console can’t learn the public NATed port for each mapping to each console it can’t pass this information on therefore nothing can connect to your hosted game. This is the reason symmetric NATs cause so many gaming issues.

Step By Step Example Using A Port Restricted NAT

Explaining how and why symmetric NAT has problems is always easier with a step by step example. Here is the difference between a port restricted NAT and a symmetric NAT.

Port Restricted NAT

  • My console with IP address 192.168.0.1 hosts a game using port 57433. It connects to xbox live to advertise this information.
  • Xbox live (using STUN) detects my public IP address of 56.45.32.5 and public port of 57433 and informs my console of this.
  • My console updates this information and advertises these details on xbox live.
  • Another person browses xbox live for my game. Once he clicks “join” his console retrieves my public IP address and port and attempts to connect directly. It tries to connect on 56.45.32.5 with port 57433.
  • The initial connection will be blocked by a port restricted NAT because I haven’t yet sent any data to that console. My console now sends data to the remote console (IP and port learnt through xbox live) using source port 57433 with source IP 5.45.32.5.
  • All subsequent packets sent from the remote console to 56.45.32.5 using port 57433 will now be accepted by my port restricted NAT as I have now sent packets to it and he connects to me successfully.

注意:如果在同一个NAT下的不同机器都使用相同的端口号访问网络时,NAT会改变其中一个机器的端口号。

Symmetric NAT

  • My console with IP address 192.168.0.1 hosts a game using port 57433. It connects to xbox live to advertise this information.
  • Xbox live (using STUN) detects my public IP address of 56.45.32.5 and public port of 57433 and informs my console of this.
  • My console updates this information and advertises these details on xbox live.
  • Another person browses xbox live for my game. Once he clicks “join” his console retrieves my public IP address and port and attempts to connect directly. It tries to connect on 56.45.32.5 with port 57433.
  • Like a port restricted NAT the initial connection will be blocked because I haven’t yet sent any data to that console. My console now sends data to the remote console (IP and port learnt through xbox live) but a new mapping is used using port 45654 with source IP 56.45.32.5.
  • The information the remote console received from xbox live was that the game is hosted on 57433 but the symmetric NAT opened up the port 45654 for this connection and not 57433. The remote console fails to connect.

Symetric NAT和Restricted Cone NAT相关推荐

  1. linux nat 博客,linux NAT的划分

    1. NAT 的划分 RFC3489 中将 NAT 的实现分为四大类: 1. Full Cone NAT 完全锥形 NAT 2. Restricted Cone NAT 限制锥形 NAT (可以理解为 ...

  2. P2P内网穿透之Nat类型介绍及Nat类型检测16种NAT组合穿透操作指南整理

    目录 根据RFC 3489规定 Nat共分以下类型: 第一部分: NAT类型介绍 Full Cone NAT: Restricted Cone NAT: Port Restricted Cone NA ...

  3. NAPT的类型(Cone NAT、Symmetric NAT)

    NAPT与NAT的区别在于,NAPT不仅转换IP包中的IP地址,还对IP包中TCP和UDP的Port进行转换.这使得多台私有网主机利用1个NAT公共IP就可以同时和公共网进行通信.(NAPT多了对TC ...

  4. NAT的四种分类:全锥形NAT,地址受限锥形NAT,端口受限锥形NAT,对称NAT

    文章目录 1. STUN 1.1 Full cone NAT(全锥形NAT) 1.2 Restricted Cone NAT(地址受限锥形NAT) 1.3 Port Restricted Cone N ...

  5. 【笔记】openwrt - full cone NAT(全锥NAT)、解决“arp_cache: neighbor table overflow!”

    最近安装了比特彗星(bitcomet)后,老是收到警告说日志的接收超过每秒上限了.一看日志,好家伙,一堆的kern.info kernel: [194004.157620] neighbour: ar ...

  6. [Realtek sdk-3.4.14b] RTL8197开启Cone Nat support功能,支持设置NatType设置操作

    NatType类型介绍 [NATType]路由器四种NAT(NAT1 NAT2 NAT3 NAT4)类型说明_wgl307293845的博客-CSDN博客_nat类型 修改内核配置,增加Cone Na ...

  7. linux nat软件,linux下nat的应用(转)

    linux下nat的应用(转) 随着Linux的应用普及,Linux在网络方面的强大逐步为大家所认识,越来越多的单位选择使用Linux来作为服务器的操作系统.今天笔者想就Linux在校园网NAT方面的 ...

  8. p2p网络中的NAT穿透技术----常见NAT穿越解决方案

    p2p网络中的NAT穿透技术----常见NAT穿越解决方案 常见NA丁穿越解决方案 NAT技术在缓解IPv4地址紧缺问题.构建防火墙.保证网络安全等方面都发挥了重要 作用.然而,NAT设备的广一泛存在 ...

  9. 网络地址转换协议NAT功能详解+NAT配套练习题

    一.NAT定义 NAT(Network Address Translator,网络地址转换)是用于在本地网络中使用私有地址,提供私有地址到公有地址的转换,在连接互联网时转而使用全局 IP 地址的技术. ...

最新文章

  1. web python 维护性_Lemon-Web阶段考核(三)
  2. 配置PIM auto-rp
  3. Spark内存管理(3)—— 统一内存管理设计理念
  4. SAP Spartacus B2B页面Banner Component的路由url是在哪里定义的
  5. FLASH与E²PROM的区别
  6. 主席树学习小结(POJ 2104)
  7. Qt笔记-拖动文件到QWidget(获取拖动文件路径)
  8. teamview修改id
  9. 模糊聚类算法(FCM)和硬聚类算法(HCM)的VB6.0实现及
  10. 618买手机哪家强?苹果官方也来打折促销了
  11. spss无法连接到本地计算机,有关IBM SPSS Statistics无法打开的几个原因,附带解决方法...
  12. [LCS]LCS应用案例--SipSnoop概述。
  13. idcnd传媒官方专业提供
  14. Docker 搭建PHP开发环境
  15. 5-2本题要求对两个整数a和b,输出其中较大的数。
  16. jquery官网(jquery下载官网)
  17. FlatBuffers vs Protocol Buffers
  18. MySQL数据库——MySQL修改/删除字段
  19. 奥林匹克杯,授予中国人民!
  20. mui 写出Tab标签可滑动可点击的效果(下划线效果)

热门文章

  1. zabbix自定义监控模板+grafana图形展示
  2. deficit记忆_一个多动症儿童是如何成为记忆天才的?!
  3. 关于虚拟现实(VR)内容开发综述
  4. React之生命周期-forceUpdate
  5. CentOS 安装相关
  6. java.lang.IllegalArgumentException: pointerIndex out of range 问题的两种解决办法
  7. 从autojs到冰狐智能辅助的心里历程
  8. (实测可用)STM32 CubeMx安装教程
  9. js 将秒或毫秒 转化为时分秒格式
  10. 高手都在用的21类新媒体运营工具