What is NAT?
Using Network Address Translation or NAT, IP addresses in a private network are mapped to public IP addresses. Let’s say an organization has a private network. The hosts in the private network communicate with each other. Now, assigning public IP addresses for each of these private hosts is unnecessary as address space in IPv4 is limited. So, the organization can instead assign private IP addresses to these private hosts. In that way, the organization does not need to coordinate with the IANA or the Internet registry to assign IP addresses to these private hosts.
But, let’s say some of the private hosts want to use the Internet. Now, no device can communicate with any host on the Internet unless it has a public IP address. So, the private hosts need to be assigned public IP addresses in some way in case the private hosts want to use the Internet. We use NAT for that purpose.
NAT binds the private IP address of a host with a public IP address. When a host in the private network sends a packet, the packet first reaches the NAT device. The NAT device changes the IP header of the packet and replaces the source IP address of the packet with its own public IP address. It can change the port number and checksum of the header, too. After that, the packet is forwarded to the intended public host.
When a response comes from the intended host, the packet reaches the NAT device. The NAT device then changes the destination IP address of the packet with the private IP address of the actual sender and forwards the packet to the private host.
NAT usually consults a table called the NAT table to map the private IP addresses with the public IP addresses.
Sometimes, NAT translates IP addresses along with port numbers so that a single public IP address can be used for many private hosts. In this case, each private host is assigned a different port number, and the combination of the public IP address and the port number is used to identify a private host uniquely. This method is called Port Address Translation or PAT or NAPT or Network Address Port Translation. (How does PAT work?)
What is a Proxy?
0 Comments