The two address translations that are helpful to make internet routing more efficient are NAT (Network address translation) and PAT (Port address translation).
Let us discuss the two translation schemes.
NAT is used to convert a private IP address into a public IP address and also a public IP address into a private IP address. We use NAT due to the shortage of IP addresses.
IP Version 4 is a 32- bit address and it has almost 4.3 billion IP addresses, but the population of the world is much higher and it is approximately about 7.8 billion as of the latest reports of June 2020.
Most of them use multiple gadgets and devices like smartphones, laptops, tablets and many more for accessing the internet for various needs. All these devices need an IP address.
So, 4.3 billion IP addresses is not sufficient for more than 7.8 billion people. Hence, we use NAT. It is also used to convert a private IP address onto public and public IP address into private.
Consider an example to demonstrate NAT as given below −
Step 1 − Suppose there are 5 computers in a network but only 1 internet connection, so how will the 5 computers access the same internet connection at the same time, so it’s possible with the help of NAT ( Network address translation).
Step 2 − Here all the 5 computers are assigned with the private IP address such as 10.0.0.1,10.0.0.2,10.0.0.3,10.0.0.4, 10.0.0.5 and this IP address are not routable in the internet, that means the same address can be used as many number of times on different network.
Step 3 − Whenever the PC-1 is assigned with the private IP address 10.0.0.1, if it wants to access the network then it will first send a request to the router.
Step 4 − If the router is converting the private IP address into public, we can add a unique port number to it and save this information to its net forwarding table.
Step 5 − After that it will forward the request to the internet, so with the help of the port number, it will be easy for the order to remember which device has requested the packet.
Step 6 − When the router receives the reply from the internet, it will be checking its net forwarding table and will convert this public IP address into private and send the packets to the requested PC.
Step 7 − This is how the concept of NAT works. NAT helps you to hide the real IP address of your network from the external user and act as a firewall.
The advantages of using NAT are as follows −
It helps in hiding the real IP address of your internal network from the public network and will act as a firewall.
It allows multiple numbers of private addresses to access one internet connection. Hence, it saves our money from buying multiple internet connections for multiple devices. We will be able to use the same internet for all our devices.
PAT is the port address translation. Initially when NAT was there it was very easy and thought everything was too easy with only NAT.
But, when multiple users open one website from one pc and give a second request to open a second website, the IP address is the same. So, there arises confusion on where the contents need to be delivered and fetched on which Multipage.
If it was a single request, then NAT was enough but when multiple requests are coming from one pc itself then which content to be displayed on which page there was a confusion.
Then, the PAT technology came into use. Along with NAT even PAT is important because, by using NAT the ip address was carried and translated. However, by using PAT, the port from which content is to be carried to which port is done.
Consider an example to demonstrate PAT as given below −
Step 1 − In the figure, we can see the pc is having certain private IP address.
Step 2 − There is a router, the private and public IP address is there.
Step 3 − When we request a web address from the pc, the router requests for the web address and the port is open.
Step 4 − Inside local IP address will be sent and inside global will be sent to the website server that we requested.
Step 5 − Through PAT the request port number will be changed inside global.
Step 6 − PAT will be taken inside local IP and the port number will be mapped to a unique port number on inside global IP. It will take the internal IP and mapped it.