In computer networks, network address translation (translation or NAT), also known as network masking or IP masking (IP masquerading), is a technology that overrides the source IP address or destination IP address when an IP packet passes through a router or firewall. This technique is commonly used in private networks with multiple hosts but only one public IP address to access the Internet. According to the specification, the router does not work this way, but it is a convenient and widely used technology. Of course, Nat also complicates communication between hosts, leading to reduced communication efficiency.
Network address Translation (NAT) is a methodology of modifying network address information in Internet Protocol (IP) Datagram packet headers while they is in transit across a traffic routing device for the purpose of remapping one IP Address space into another.
A popular view on the web is that the widespread adoption of IPV6 will make NAT no longer needed because NAT is only a way to handle IPV4 's insufficient address space.
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 IPs or port numbers.
When a computer on the private (internal) network sends an IPV4 packet to the external Network, The NAT device assign the connection a Port number fr Om a pool of available ports, inserting this port number in the Source Port field (much like the Post office box number), and forwards the packet to 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 connection is translated to the same port number.
A packet coming from the external network are mapped to a corresponding internal IP address and port number from the transl ation table, replacing the external IP address and port number in the incoming packet header (similar to the Tran Slation from Post office box number to street address). The packet is then forwarded over the inside network. Otherwise, if the destination port number of the incoming packet is not found in the translation table, the packet is drop PED or rejected because the PAT device doesn ' t know where to send it.
NAT only translates IP addresses and ports of their internal hosts, hiding the true endpoint of a internal host on a privat E Network. NAT operation is typically transparent to both the internal and external hosts.
Typically the internal host is aware of the true IP address and TCP or UDP port of the external host. Typically the NAT device may function as