Network Address Translation (NAT)

Network Address Translation (NAT)
In a network using a NAT router, the router does not look like a router to the outside world; it behaves like a single unit with a single IP address. This means that the outside world will send and receive packages to and from this device directly, and the NAT translation table is used to delegate the traffic inside the home network.

NAT Translation Table
Considering the example in the figure above, the computer (host) with the IP 10.0.0.1 wants to communicate with a Web server (IP 128.119.40.186). The host assigns an arbitrary port number 3345, and sends the datagram to the LAN, when the NAT router receives this datagram it generates a new port number 5001 for the datagram, and stores this information in the translation table. The datagram is then sent to the Web server with the source IP set to the WAN IP (137.76.29.7) and the source port 5001. When the Web server then replies, the NAT router looks up which computer maps to port 5001 on the LAN side of the network. When the host is found, the datagram from the Web server is rewritten and sent to the correct local IP.

Controversy
Many purists in the IETF community loudly object to NAT, through the following arguments:
 * 1. Port numbers should be used for addressing processes, not addressing hosts.
 * 2. Routers should only process packets up to layer 3.
 * 3. NAT violates the end-to-end argument, which specifies that hosts should community directly with each other, without interfering nodes modifying IP addresses or port numbers
 * 4. We should use IPv6 to solve the shortage of IP-addresses, not patching the problem through stopgap solutions and hacks like NAT.

UPnP
NAT traversal is increasingly provided by Universal Plug and Play (UPnP), which is a protocol that allows a host to discover a nearby NAT. UPnP allows external hosts to initiate communication sessions to NATed hosts, using TCP or UDP. This may be the savior of the P2P problems (finding peers) with NAT, since it provides an effective and robust NAT traversal.