In computing , an address space defines a range of discrete addresses, each of which may correspond to a network host , peripheral device , disk sector , a memory cell or other logical or physical entity.
68-474: Network address translation ( NAT ) is a method of mapping an IP address space into another by modifying network address information in the IP header of packets while they are in transit across a traffic routing device . The technique was initially used to bypass the need to assign a new address to every host when a network was moved, or when the upstream Internet service provider was replaced but could not route
136-688: A group of public IP addresses. NAT hairpinning , also known as NAT loopback or NAT reflection , is a feature in many consumer routers where a machine on the LAN is able to access another machine on the LAN via the external IP address of the LAN/router (with port forwarding set up on the router to direct requests to the appropriate machine on the LAN). This notion is officially described in 2008, RFC 5128 . The following describes an example network: If
204-454: A patch available to enable RFC 4787 support but this has not yet been merged. The NAT traversal problem arises when peers behind different NATs try to communicate. One way to solve this problem is to use port forwarding . Another way is to use various NAT traversal techniques. The most popular technique for TCP NAT traversal is TCP hole punching . TCP hole punching requires the NAT to follow
272-686: A private network , sends a binding request to a STUN server on the public Internet. The STUN server responds with a success response that contains the IP address and port number of the client, as observed from the server's perspective. The result is obfuscated through exclusive or (XOR) mapping to avoid translation of the packet content by application layer gateways (ALGs) that perform deep packet inspection in an attempt to perform alternate NAT traversal methods. STUN messages are sent in User Datagram Protocol (UDP) packets. Since UDP does not provide reliable transport, reliability
340-512: A Symmetric NAT as having an Address- and Port-Dependent Mapping . For the second bullet in each row of the above table, RFC 4787 would also label Full-Cone NAT as having an Endpoint-Independent Filtering , Restricted-Cone NAT as having an Address-Dependent Filtering , Port-Restricted Cone NAT as having an Address and Port-Dependent Filtering , and Symmetric NAT as having either an Address-Dependent Filtering or Address and Port-Dependent Filtering . Other classifications of NAT behavior mentioned in
408-417: A candidate for communicating with peers by sharing the external NAT address rather than the private address, which is not reachable from peers on the public network. If both communicating peers are located in different private networks, each behind a NAT, the peers must coordinate to determine the best communication path between them. Some NAT behavior may restrict peer connectivity even when the public binding
476-471: A checksum that covers all the data they carry, as well as the TCP or UDP header, plus a pseudo-header that contains the source and destination IP addresses of the packet carrying the TCP or UDP header. For an originating NAT to pass TCP or UDP successfully, it must recompute the TCP or UDP header checksum based on the translated IP addresses, not the original ones, and put that checksum into the TCP or UDP header of
544-490: A methodology for testing a device accordingly. However, these procedures have since been deprecated from standards status, as the methods are inadequate to correctly assess many devices. RFC 5389 standardized new methods in 2008 and the acronym STUN now represents the new title of the specification: Session Traversal Utilities for NAT . It is similar to an address restricted cone NAT, but the restriction includes port numbers. Many NAT implementations combine these types, so it
612-523: A one-to-one translation of IP addresses (RFC 1631). RFC 2663 refers to this type of NAT as basic NAT , also called a one-to-one NAT . In this type of NAT, only the IP addresses, IP header checksum , and any higher-level checksums that include the IP address are changed. Basic NAT can be used to interconnect two IP networks with incompatible addresses. Most network address translators map multiple private hosts to one publicly exposed IP address. Here
680-418: A packet is sent to 203.0.113.1 by a computer at 192.168.1.100 , the packet would normally be routed to the default gateway (the router) A router with the NAT loopback feature detects that 203.0.113.1 is the address of its WAN interface, and treats the packet as if coming from that interface. It determines the destination for that packet, based on DNAT (port forwarding) rules for the destination. If
748-726: A partitioning to several regions according to the mathematical structure it has. In the case of total order , as for memory addresses , these are simply chunks . Like the hierarchical design of postal addresses , some nested domain hierarchies appear as a directed ordered tree , such as with the Domain Name System or a directory structure . In the Internet , the Internet Assigned Numbers Authority (IANA) allocates ranges of IP addresses to various registries so each can manage their parts of
SECTION 10
#1732787712296816-404: A private network. When a computer on the private (internal) network sends an IP packet to the external network, the NAT device replaces the internal source IP address in the packet header with the external IP address of the NAT device. PAT may then assign the connection a port number from a pool of available ports, inserting this port number in the source port field. The packet is then forwarded to
884-646: A single local port with many remote hosts. This additional tracking increases implementation complexity and computing resources at the translation device. Because the internal addresses are all disguised behind one publicly accessible address, it is impossible for external hosts to directly initiate a connection to a particular internal host. Applications such as VOIP , videoconferencing , and other peer-to-peer applications must use NAT traversal techniques to function. Pure NAT, operating on IP alone, may or may not correctly parse protocols with payloads containing information about IP, such as ICMP . This depends on whether
952-490: A specific internal address and port. RFC 4787 makes a distinction between NAT mapping and NAT filtering. Section 4.1 of the RFC covers NAT mapping and specifies how an external IP address and port number should be translated into an internal IP address and port number. It defines Endpoint-Independent Mapping, Address-Dependent Mapping and Address and Port-Dependent Mapping, explains that these three possible choices do not relate to
1020-457: A suitable STUN server for communications with a particular peer by querying the Domain Name System (DNS) for the stun (for UDP) or stuns (for TCP/TLS) server ( SRV ) resource record, e.g., _stun._udp.example.com. The standard listening port number for a STUN server is 3478 for UDP and TCP, and 5349 for TLS. Alternatively, TLS may also be run on the TCP port if the server implementation can de-multiplex TLS and STUN packets. In case no STUN server
1088-419: A third-party network server (STUN server) located on the opposing (public) side of the NAT, usually the public Internet . STUN was first announced in RFC 3489; the title was changed in a specification of an updated set of methods published as RFC 5389, retaining the same acronym. STUN was first announced in RFC 3489. The original specification specified an algorithm to characterize NAT behavior according to
1156-411: Is PAT or NAT overloading and maps multiple private IP addresses to a single public IP address. Multiple addresses can be mapped to a single address because each private address is tracked by a port number. PAT uses unique source port numbers on the inside global IP address to distinguish between translations. PAT attempts to preserve the original source port. If this source port is already used, PAT assigns
1224-522: Is a Cisco proposal that combines Address plus Port translation with tunneling of the IPv4 packets over an ISP provider's internal IPv6 network. In effect, it is an (almost) stateless alternative to carrier-grade NAT and DS-Lite that pushes the IPv4 address /port translation function (and the maintenance of NAT state) entirely into the existing customer premises equipment NAT implementation. Thus avoiding
1292-546: Is a tool used by other protocols, such as Interactive Connectivity Establishment (ICE), the Session Initiation Protocol (SIP), and WebRTC . It provides a tool for hosts to discover the presence of a network address translator, and to discover the mapped, usually public, Internet Protocol (IP) address and port number that the NAT has allocated for the application's User Datagram Protocol (UDP) flows to remote hosts. The protocol requires assistance from
1360-409: Is a typical configuration: All IP packets have a source IP address and a destination IP address. Typically, packets passing from the private network to the public network will have their source address modified, while packets passing from the public network back to the private network will have their destination address modified. To avoid ambiguity in how replies are translated, further modifications to
1428-567: Is achieved by application-controlled retransmissions of the STUN requests. STUN servers do not implement any reliability mechanism for their responses. When reliability is mandatory, the Transmission Control Protocol (TCP) may be used, but induces extra networking overhead. In security-sensitive applications, STUN may be transported and encrypted by Transport Layer Security (TLS). An application may automatically determine
SECTION 20
#17327877122961496-520: Is also called port forwarding , or DMZ when used on an entire server , which becomes exposed to the WAN, becoming analogous to an undefended military demilitarized zone (DMZ). The meaning of the term SNAT varies by vendor: Secure network address translation (SNAT) is part of Microsoft's Internet Security and Acceleration Server and is an extension to the NAT driver built into Microsoft Windows Server . It provides connection tracking and filtering for
1564-485: Is better to refer to specific individual NAT behavior instead of using the Cone/Symmetric terminology. RFC 4787 attempts to alleviate confusion by introducing standardized terminology for observed behaviors. For the first bullet in each row of the above table, the RFC would characterize Full-Cone, Restricted-Cone, and Port-Restricted Cone NATs as having an Endpoint-Independent Mapping , whereas it would characterize
1632-491: Is forwarded to the inside network. Otherwise, if the destination port number of the incoming packet is not found in the translation table, the packet is dropped or rejected because the PAT device doesn't know where to send it. IEEE Reverse Address and Port Translation (RAPT or RAT) allows a host whose real IP address changes from time to time to remain reachable as a server via a fixed home IP address. Cisco 's RAPT implementation
1700-417: Is found using DNS lookups, the standard recommends that the destination domain name should be queried for address records (A or AAAA), which would be used with the default port numbers. In addition to using protocol encryption with TLS, STUN also has built-in authentication and message-integrity mechanisms via specialized STUN packet types. When a client has evaluated its external address, it can use this as
1768-411: Is known. The Interactive Connectivity Establishment (ICE) protocol provides a structured mechanism to determine the optimal communication path between two peers. Session Initiation Protocol (SIP) extensions are defined to enable the use of ICE when setting up a call between two hosts. Network address translation is implemented via a number of different address and port mapping schemes, none of which
1836-410: Is no need to use a third party (like STUN) to discover the NAT port since the application itself already knows the NAT port. However, if two internal hosts attempt to communicate with the same external host using the same port number, the NAT may attempt to use a different external IP address for the second connection or may need to forgo port preservation and remap the port. As of 2006, roughly 70% of
1904-436: Is recommended where maximum application transparency is required while Address-Dependent Filtering is recommended where more stringent filtering behavior is most important. Some NAT devices are not yet compliant with RFC 4787 as they treat NAT mapping and filtering in the same way so that their configuration option for changing the NAT filtering method also changes the NAT mapping method (e.g. Netgate TNSR ). The PF firewall has
1972-475: Is standardized. STUN is not a self-contained NAT traversal solution applicable in all NAT deployment scenarios and does not work correctly with all of them. It is a tool among other methods and it is a tool for other protocols in dealing with NAT traversal, most notably Traversal Using Relay NAT (TURN) and Interactive Connectivity Establishment (ICE). STUN works with three types of NAT: full cone NAT , restricted cone NAT , and port restricted cone NAT . In
2040-538: Is that it mitigates IPv4 address exhaustion by allowing entire networks to be connected to the Internet using a single public IP address. Network address and port translation may be implemented in several ways. Some applications that use IP address information may need to determine the external address of a network address translator. This is the address that its communication peers in the external network detect. Furthermore, it may be necessary to examine and categorize
2108-531: The NAT444 and statefulness problems of carrier-grade NAT, and also provides a transition mechanism for the deployment of native IPv6 at the same time with very little added complexity. Hosts behind NAT-enabled routers do not have end-to-end connectivity and cannot participate in some internet protocols. Services that require the initiation of TCP connections from the outside network, or that use stateless protocols such as those using UDP , can be disrupted. Unless
Network address translation - Misplaced Pages Continue
2176-583: The address space would be a combination of locations, such as a neighborhood, town, city, or country. Some elements of a data address space may be the same, but if any element in the address is different, addresses in said space will reference different entities. For example, there could be multiple buildings at the same address of "32 Main Street" but in different towns, demonstrating that different towns have different, although similarly arranged, street address spaces. An address space usually provides (or allows)
2244-438: The port preservation design for TCP. For a given outgoing TCP communication, the same port numbers are used on both sides of the NAT. NAT port preservation for outgoing TCP connections is crucial for TCP NAT traversal because, under TCP, one port can only be used for one communication at a time. Programs that bind distinct TCP sockets to ephemeral ports for each TCP communication, make NAT port prediction impossible for TCP. On
2312-507: The NAT router makes a specific effort to support such protocols, incoming packets cannot reach their destination. Some protocols can accommodate one instance of NAT between participating hosts ("passive mode" FTP , for example), sometimes with the assistance of an application-level gateway (see § Applications affected by NAT ), but fail when both systems are separated from the internet by NAT. The use of NAT also complicates tunneling protocols such as IPsec because NAT modifies values in
2380-420: The NAT. Destination network address translation (DNAT) is a technique for transparently changing the destination IP address of a routed packet and performing the inverse function for any replies. Any router situated between two endpoints can perform this transformation of the packet. DNAT is commonly used to publish a service located in a private network on a publicly accessible IP address. This use of DNAT
2448-433: The RFC include whether they preserve ports, when and how mappings are refreshed, whether external mappings can be used by internal hosts (i.e., its hairpinning behavior), and the level of determinism NATs exhibit when applying all these rules. Specifically, most NATs combine symmetric NAT for outgoing connections with static port mapping , where incoming packets addressed to the external address and port are redirected to
2516-449: The additional network connections needed for the FTP , ICMP , H.323 , and PPTP protocols as well as the ability to configure a transparent HTTP proxy server . Dynamic NAT, just like static NAT, is not common in smaller networks but is found within larger corporations with complex networks. Where static NAT provides a one-to-one internal to public static IP address mapping, dynamic NAT uses
2584-438: The address and port mapping behavior. This algorithm is not reliably successful and only applicable to a subset of NAT devices deployed. The algorithm consists of a series of tests to be performed by an application. When the path through the diagram ends in a red box, UDP communication is not possible and when the path ends in a yellow or green box, communication is possible. The methods of RFC 3489 proved too unreliable to cope with
2652-400: The cases of restricted cone or port restricted cone NATs, the client must send out a packet to the endpoint before the NAT will allow packets from the endpoint through to the client. STUN does not work with symmetric NAT (also known as bi-directional NAT) which is often found in the networks of large companies. Since the IP address of the STUN server is different from that of the endpoint, in
2720-479: The clients in P2P networks employed some form of NAT. Every TCP and UDP packet contains a source port number and a destination port number. Each of those packets is encapsulated in an IP packet, whose IP header contains a source IP address and a destination IP address. The IP address/protocol/port number triple defines an association with a network socket . For publicly accessible services such as web and mail servers
2788-451: The data were sent to port 80 and a DNAT rule exists for port 80 directed to 192.168.1.2 , then the host at that address receives the packet. If no applicable DNAT rule is available, the router drops the packet. An ICMP Destination Unreachable reply may be sent. If any DNAT rules were present, address translation is still in effect; the router still rewrites the source IP address in the packet. The local computer ( 192.168.1.100 ) sends
Network address translation - Misplaced Pages Continue
2856-403: The edge of different IP spaces, such as a local area network and the Internet. An iconic example of virtual-to-physical address translation is virtual memory , where different pages of virtual address space map either to page file or to main memory physical address space. It is possible that several numerically different virtual addresses all refer to one physical address and hence to
2924-399: The external network. The NAT device then makes an entry in a translation table containing the internal IP address, original source port, and the translated source port. Subsequent packets from the same internal source IP address and port number are translated to the same external source IP address and port number. The computer receiving a packet that has undergone NAT establishes a connection to
2992-421: The first available port number starting from the beginning of the appropriate port group 0–511, 512–1023, or 1024–65535. When there are no more ports available and there is more than one external IP address configured, PAT moves to the next IP address to try to allocate the original source port again. This process continues until it runs out of available ports and external IP addresses. Mapping of Address and Port
3060-411: The first packet of the fragmented set of packets. Alternatively, the originating host may perform path MTU Discovery to determine the packet size that can be transmitted without fragmentation and then set the don't fragment (DF) bit in the appropriate packet header field. This is only a one-way solution, because the responding host can send packets of any size, which may be fragmented before reaching
3128-502: The global Internet address space. Uses of addresses include, but are not limited to the following: Another common feature of address spaces are mappings and translations , often forming numerous layers. This usually means that some higher-level address must be translated to lower-level ones in some way. For example, a file system on a logical disk operates using linear sector numbers, which have to be translated to absolute LBA sector addresses, in simple cases, via addition of
3196-510: The headers which interfere with the integrity checks done by IPsec and other tunneling protocols. End-to-end connectivity has been a core principle of the Internet, supported, for example, by the Internet Architecture Board . Current Internet architectural documents observe that NAT is a violation of the end-to-end principle , but that NAT does have a valid role in careful design. There is considerably more concern with
3264-427: The initial originating transmission is what establishes the required information in the translation tables. Thus a web browser within the private network would be able to browse websites that are outside the network, whereas web browsers outside the network would be unable to browse a website hosted within. Protocols not based on TCP and UDP require other translation techniques. An additional benefit of one-to-many NAT
3332-426: The internet. Ports are endpoints of communication unique to that host, so a connection through the NAT device is maintained by the combined mapping of port and IP address. A private address on the inside of the NAT is mapped to an external public address. Port address translation (PAT) resolves conflicts that arise when multiple hosts happen to use the same source port number to establish different external connections at
3400-407: The main phone number is the public IP address, and the individual extensions are unique port numbers. With NAT, all communications sent to external hosts actually contain the external IP address and port information of the NAT device instead of internal host IP addresses or port numbers. NAT only translates IP addresses and ports of its internal hosts, hiding the true endpoint of an internal host on
3468-524: The network's address space. It has become a popular and essential tool in conserving global address space in the face of IPv4 address exhaustion . One Internet-routable IP address of a NAT gateway can be used for an entire private network . As network address translation modifies the IP address information in packets, NAT implementations may vary in their specific behavior in various addressing cases and their effect on network traffic. Vendors of equipment containing NAT implementations do not commonly document
SECTION 50
#17327877122963536-467: The other hand, for UDP, NATs do not need port preservation. Indeed, multiple UDP communications (each with a distinct endpoint ) can occur on the same source port, and applications usually reuse the same UDP socket to send packets to distinct hosts. This makes port prediction straightforward, as it is the same source port for each packet. Furthermore, port preservation in NAT for TCP allows P2P protocols to offer less complexity and less latency because there
3604-492: The packet as coming from 192.168.1.100 , but the server ( 192.168.1.2 ) receives it as coming from 203.0.113.1 . When the server replies, the process is identical to an external sender. Thus, two-way communication is possible between hosts inside the LAN network via the public IP address. Address space For software programs to save and retrieve stored data, each datum must have an address where it can be located. The number of address spaces available depends on
3672-485: The packets are required. The vast bulk of Internet traffic uses Transmission Control Protocol (TCP) or User Datagram Protocol (UDP). For these protocols, the port numbers are changed so that the combination of IP address (within the IP header ) and port number (within the Transport Layer header ) on the returned packet can be unambiguously mapped to the corresponding private network destination. RFC 2663 uses
3740-645: The partition's first sector address. Then, for a disk drive connected via Parallel ATA , each of them must be converted to logical cylinder-head-sector address due to the interface historical shortcomings. It is converted back to LBA by the disk controller , then, finally, to physical cylinder , head and sector numbers. The Domain Name System maps its names to and from network-specific addresses (usually IP addresses), which in turn may be mapped to link layer network addresses via Address Resolution Protocol . Network address translation may also occur on
3808-517: The path between two endpoints of communication. It is implemented as a light-weight client–server protocol, requiring only simple query and response components with a third-party server located on the common, easily accessible network, typically the Internet . The client side is implemented in the user's communications application, such as a Voice over Internet Protocol (VoIP) phone or an instant messaging client. The basic protocol operates essentially as follows: The client, typically operating inside
3876-537: The payload is interpreted by a host on the inside or outside of the translation. Basic protocols as TCP and UDP cannot function properly unless NAT takes action beyond the network layer. IP packets have a checksum in each packet header, which provides error detection only for the header. IP datagrams may become fragmented and it is necessary for a NAT to reassemble these fragments to allow correct recalculation of higher-level checksums and correct tracking of which packets belong to which connection. TCP and UDP, have
3944-494: The plethora of different NAT implementations and application scenarios encountered in production networks. The STUN protocol and method were updated in RFC 5389, retaining many of the original specifications as a subset of methods, but removing others. The title was changed in a specification of an updated set of methods published as RFC 5389, retaining the same acronym. STUN is a tool for communications protocols to detect and traverse network address translators that are located in
4012-402: The port and IP address specified in the altered packet, oblivious to the fact that the supplied address is being translated. Upon receiving a packet from the external network, the NAT device searches the translation table based on the destination port in the packet header. If a match is found, the destination IP address and port number is replaced with the values found in the table and the packet
4080-494: The port number is important. For example, port 443 connects through a socket to the web server software and port 465 to a mail server's SMTP daemon . The IP address of a public server is also important, similar in global uniqueness to a postal address or telephone number. Both IP address and port number must be correctly known by all hosts wishing to successfully communicate. Private IP addresses as described in RFC 1918 are usable only on private networks not directly connected to
4148-526: The same physical byte of RAM . It is also possible that a single virtual address maps to zero, one, or more than one physical address. STUN STUN ( Session Traversal Utilities for NAT ; originally Simple Traversal of User Datagram Protocol (UDP) through Network Address Translators ) is a standardized set of methods, including a network protocol, for traversal of network address translator (NAT) gateways in applications of real-time voice, video, messaging, and other interactive communications. STUN
SECTION 60
#17327877122964216-406: The same time. A NAT device is similar to a phone system at an office that has one public telephone number and multiple extensions. Outbound phone calls made from the office all appear to come from the same telephone number. However, an incoming call that does not specify an extension cannot be automatically transferred to an individual inside the office. In this scenario, the office is a private LAN,
4284-462: The security of the NAT as security is determined by the filtering behavior and then specifies "A NAT MUST have an 'Endpoint-Independent Mapping' behavior." Section 5 of the RFC covers NAT filtering and describes what criteria are used by the NAT to filter packets originating from specific external endpoints. The options are Endpoint-Independent Filtering, Address-Dependent Filtering and Address and Port-Dependent Filtering. Endpoint-Independent Filtering
4352-495: The specifics of NAT behavior. IPv4 uses 32-bit addresses, capable of uniquely addressing about 4.3 billion devices. By 1992, it became evident that that would not be enough. The 1994 RFC 1631 describes NAT as a "short-term solution" to the two most compelling problems facing the IP Internet at that time: IP address depletion and scaling in routing. By 2004, NAT had become widespread. The simplest type of NAT provides
4420-413: The term network address and port translation ( NAPT ) for this type of NAT. Other names include port address translation ( PAT ), IP masquerading , NAT overload , and many-to-one NAT . This is the most common type of NAT and has become synonymous with the term NAT in common usage. This method allows communication through the router only when the conversation originates in the private network, since
4488-422: The type of mapping in use, for example when it is desired to set up a direct communication path between two clients both of which are behind separate NAT gateways. For this purpose, RFC 3489 specified a protocol called Simple Traversal of UDP over NATs ( STUN ) in 2003. It classified NAT implementations as full-cone NAT , (address) restricted-cone NAT , port-restricted cone NAT or symmetric NAT , and proposed
4556-486: The underlying address structure, which is usually limited by the computer architecture being used. Often an address space in a system with virtual memory corresponds to a highest level translation table, e.g., a segment table in IBM System/370 . Address spaces are created by combining enough uniquely identified qualifiers to make an address unambiguous within the address space. For a person's physical address,
4624-410: The use of IPv6 NAT, and many IPv6 architects believe IPv6 was intended to remove the need for NAT. An implementation that only tracks ports can be quickly depleted by internal applications that use multiple simultaneous connections such as an HTTP request for a web page with many embedded objects. This problem can be mitigated by tracking the destination IP address in addition to the port thus sharing
#295704