What is NAT? And how does it work?

NAT means Network Address Translation. It is used to convert a private IP Address into a Public IP Address and vice versa.

What are the advantages of Public and Private IP Addresses in a Computer Network?

NAT is used to fix the shortage of IP Addresses.

IPv4 — It is a 32 Bit Address. It will accommodate around 4.2 Billion Addresses.
But the population of the world currently stands at 7.2 billion people.
In this hyper-connected world, everyone is using multiple devices to access the internet.
The 4.2 billion IP addresses available, are not sufficient, to accommodate the growing need.

To solve this growing problem, NAT came into existence.

NAT is used to convert a private into public and vice versa.

How does it work?

Let me explain that with an example. Visualise there are 4 computers in a network, but only 1 internet connection. Now, how is it possible for all the 4 computers present in the network to access a single internet connection?

NAT comes to help in this situation. What happens is, all 4 computers are assigned with private IP addresses such as,, and respectively.

Now, if PC1 with a private IP wants to access the Internet, it will first send the request to the router. The router will convert the private IP address into a public IP address and add a unique port number to it. It will then save this information to its NAT forwarding table.

Subsequently, it will forward the information to the internet. With its unique Port number information, the router will remember which request has been sent to the internet. The internet will then send the request back to the router, which will then convert this Public IP into Private IP and send the packet to the requested PC. This is how the entire concept of NAT works behind the screen.

Another advantage of using NAT is, it will hide the real IP addresses to the Internet. It will act as an up firewall.

Advantages of NAT:

  1. It will hide the real IP addresses of your Internal Network from your Public Network and thus, act as a firewall.
  2. It allows an unlimited number of private addresses to access the single Internet Connection.
  3. It allows multiple devices to access a single Internet Connection. Thus, saving your money from buying multiple internet connections for multiple devices.

Disadvantages of NAT:

  1. The troubleshooting may become more complex due to change in the IP address.
  2. It blocks some incoming connections.
  3. Some TCP/IP applications like peer to peer application, end to end IPSec, multicast routing don’t go well with NAT



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store