In WAN environments, applications running behind a NAT-enabled router typically need to communicate with applications running behind a different NAT-enabled router. NAT (Network Address Translation) is a method of remapping one private IP address and port into a public IP address and port by modifying the IP address and port information in the IP header of the packets while they are in transit across a NAT-enabled router. The technique has become a popular and essential tool in conserving the IPv4 global address space in the face of IPv4 address exhaustion. Many applications with individual private IP addresses can utilize a NAT-enabled router to communicate with external applications using a single public IP address.
Figure 30.1: NAT Traversal
Real-Time WAN Transport in combination with Cloud Discovery Service will enable communications between Connext DDS applications running between different kinds of NATs. For information on the various NAT kinds, please see the following sections.
There are four kinds of NATs:
A full-cone NAT, also known as a one-to-one NAT, has the following characteristics:
Figure 30.2: Full-Cone NAT
This NAT is similar to an address-restricted cone NAT, but the restriction also includes port numbers.
Figure 30.3: Symmetric NAT
There are multiple third-party utilities that you can download to find out the NAT type. One example is natat (https://github.com/songjiayang/natat).
> ./natat
2020/11/21 11:10:52 start stun server ping...
2020/11/21 11:10:53 stun.l.google.com:19302 mapped: 0.0.0.0:3489 -> 99.35.17.233:3489
2020/11/21 11:10:53 stun1.l.google.com:19302 mapped: 0.0.0.0:3489 -> 99.35.17.233:3489
2020/11/21 11:10:53 start NAT type assert...
2020/11/21 11:10:53 It's Cone NAT
Applications behind a NAT cannot receive data from applications outside the NAT unless they open a UDP NAT binding (or UDP hole) with each one of the public IP transport addresses associated with the applications running outside the NAT.
A NAT binding creates a mapping between a private IP transport address (iAddr:iPort) and a public IP transport address (eAddr:ePort) for a given set of destination IP transport addresses. There are two kinds of bindings:
Figure 30.4: Open a Static Binding in a NAT-Enabled Router
Real-Time WAN Transport will be able to establish new NAT bindings if the old bindings are closed by the NAT-enabled router without any user intervention. In addition, Real-Time WAN Transport provides a builtin Ping mechanism to keep the NAT bindings open at all times. This capability eliminates the latency penalty that is introduced during the process of establishing a new NAT binding.
For security purposes, in the absence of outbound traffic, the NAT binding from an internal address (iAddr:iPort) to an external address (eAddr:ePort) usually expires after periods of time in the range of tens of seconds to a few minutes. When it expires, the NAT binding is removed and it closes. The expiration time can usually be configured (see Figure 30.5: Session Timeout).
Real-Time WAN Transport does not require support for NAT hairpinning and can be used in combination with the builtin UDPv4 transport in a DomainParticipant to support both communication with DomainParticipants within the same LAN and communication with DomainParticipants in a WAN simultaneously.
In network computing, hairpinning (or NAT loopback) refers to communication between two hosts behind the same NAT router using their mapped external address (eAddr:ePort). Because not all NAT routers support this communication configuration, usually applications must be designed to be aware of it.
© 2021 RTI