標籤:des c style a ext color
在電腦網路中,網路位址轉譯(Network Address Translation或簡稱NAT),也叫做網路掩蔽或者IP掩蔽(IP masquerading),是一種在IP封包通過路由器或防火牆時重寫源IP地址或目的IP地址的技術。這種技術被普遍使用在有多台主機但只通過一個公有IP地址訪問網際網路的私人網路中。根據規範,路由器是不能這樣工作的,但它的確是一個方便並得到了廣泛應用的技術。當然,NAT也讓主機之間的通訊變得複雜,導致通訊效率的降低。
Network address translation (NAT) is a methodology of modifying network address information in Internet Protocol (IP) datagram packet headers while they are in transit across a traffic routing device for the purpose of remapping one IP address space into another.
流行在網路上的一種看法認為,IPv6的廣泛採用將使得NAT不再需要,因為NAT只是一個處理IPv4的地址空間不足的方法。
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 replaces the internal IP address in the source field of the packet header (sender‘s address) with the external IP address of the NAT device. PAT(Port address translation) may then assign the connection a port number from 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 are translated to the same port number.
A packet coming from the external network is mapped to a corresponding internal IP address and port number from the translation table, replacing the external IP address and port number in the incoming packet header (similar to the translation 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 dropped or rejected because the PAT device doesn‘t know where to send it.
NAT only translates IP addresses and ports of its internal hosts, hiding the true endpoint of an internal host on a private 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 the default gateway for the internal host. However the external host is only aware of the public IP address for the NAT device and the particular port being used to communicate on behalf of a specific internal host.