sajad torkamani

Network address translation (NAT) is the process of mapping a private IP address to a public IPv4 address. There are a limited number of public IPv4 addresses (about four billion) but far more devices in the world. NAT helps overcome this limitation by mapping a pool of computers connected to a local area network to a single IPv4 address.

Port address translation is an extension of NAT and is the process of mapping a combination of private IP and port to a public IP and port.

Network address translation

For example, your home router is typically assigned a single public IP address from an ISP (e.g., All the devices (phones, tablets, PCs, etc.) that connect to your home Wi-Fi network are assigned a private local IP address (usually in the range – but are accessible from the public network by a single IP address (e.g., ``).

Whenever a process in a device within your Wi-Fi network wants to send some packets to a process on a device on a remote network, NAT changes the private source IP address and port on the packet (e.g., to a public IPv4 address and port (e.g., ``2:8801).

Once it’s changed the packet’s source IP and port, it forwards it onto the network. When the process on the destination host receives the packet, it will see the source IP and port as the translated public IP and port (e,g., So, when it wants to send packets back to the original process, it will use this public IP and port as the destination IP and port in its own packets.

When these packets reach the source network router, NAT will translate the public IP and port (e.g., back into the local private IP and port (e.g., and direct the packet to the correct device (using the private IP) and then to the correct process within that device (using the port).

Private network IPv4 addresses fall into one of three categories:

NameRFC 1918 nameIP address rangeNumber of addresses
Class A24-bit block10.0.0.0 –,777,216
Class B20-bit block172.16.0.0 –,048,576
Class C16-bit block192.168.0.0 –,536


Tagged: Networking