NAT (Network Address Translation) is a process of changing the source and destination IP addresses and ports. The main goal of NAT is to limit the number of public IP addresses a company needs and to hide private network address ranges. The NAT process is usually done by routers or firewalls.
NAT allows a host without a public, globally unique IPv4 address to communicate with other hosts on the Internet. The hosts might be using private addresses or even addresses assigned to another organization, which helps reduce the need for public IPv4 addresses.
Here is an explanation of NAT:
Host A wants to access the server S1 on the Internet. Because Host A uses private IP addressing, the source address of the request has to be changed by the router because private IP addresses are not routable through Internet. Router R1 receives the request, changes the source IP address to its public IP address and sends the packet to the server on the Internet. Server S1 receives the packet and replies to router R1. Router R1 receives the packet, changes the destination IP addresses to the private IP address of Host A and sends the packet to Host A.
There are three types of NAT:
1. Static NAT – translates one private IP address to a public one. The public IP address is always the same.
2. Dynamic NAT – private IP addresses are mapped to the pool of available public IP addresses.
3. Port Address Translation (PAT) – one public IP address is used for all internal devices, but a different port is assigned to each private IP address. This type is also known as NAT Overload.