Back in the 90’s, when a computer was connected to the internet via a modem, it was assigned a Public IP address, and as a result, the computer was visible to the internet directly. Modern day modems integrate the following components: a router, switch, firewall, wireless feature and DHCP Services, whilst the NAT service works simultaneously beside them.
When you take into consideration network security, NAT translates an internal IP to an external IP address; using what is called a public IP, it can enable the user to translate and hide the internal Private Network that can effectively increase the both security and privacy, whilst protecting the map of your network.
As a private IP (or private network) cannot be routed to a public network (or any internet connection) the NAT service is utilised to help overcome this issue. When a packet is dispatched across internal and external IP addresses it goes into temporary storage, where it is modified using a NAT Table, which holds key bits of information including the inside (private) IP address and external (public) IP address. This temporary storage mechanism processes the request from the packet and translates the IP address (i.e. internal interface IP to external IP or vice versa).
When the packet reaches the destination, there may be data which needs to be sent back to the source IP address; a packet which is a reply back to the source is generated, and the public IP is automatically recognised by the NAT table from the entry created by the previous outward request. The inward packet is again modified and will reach its correct destination using the internal IP address identified in the NAT table.
There are instances when NAT checks the packet to find the destination port and then checks the table. Based on the table, the packet is then sent to the correct IP. Now the mechanism mentioned above is for when there are many private IP’s and less public IP’s. This is also called a PAT (Port Address Translate), it is often used if many private addresses are called using NAT, or the NAT is overloaded in the event that there are not enough public IP’s and more private IP avalible.
When the NAT exists, the problem of the IPv4 addresses is reduced, and therefore one public IP can serve many internal IP devices.
There are 2 types of NAT: Static and Dynamic NAT. For a Static NAT, you can manually choose and statically set your external IP to an internal address; this is extremely useful when you have a webserver for example on your private network and you want all the traffic to be assigned to it on the external IP.
The second type of NAT is the automatic method where the system puts the addresses on the table with no prior programming, this is Dynamic NAT.
At the end of the day, NAT is a process required for the normal operation of all modern internet access, to allow internal networks to access the outside Internet by effectively hiding the true network structure. However as we look into the future as IPv6 is adapted we can take advantage of its increased address space and reduce the requirement for NAT.