NAT is a procedure through which the IP header of data packages is changed to convert the source IP address from one destination to another.
Currently, the most common use for NAT is mapping multiple private addresses to a single public address. This is known as PAT or port address translation and can also come by the name of NAPT which is network address port translation.
NAT is an acronym for Network Address Translation and is the process through which a limited set of IPs are assigned to a number of devices which are 2-3 times more numerous than the entirety of IPv4 addresses in existence (approximately 4 billion addresses).
NAT has the role of hiding an unlimited number of devices under the same IP. If you have a home network, then surely the router you use has NAT. NAT is designed to create tables that match packages between a locally assigned IP in your network and the network IP plus a specific port for your device. This way, many computers can connect through a router to the internet.
Types of NAT
There are several types of NAT among which we can identify:
1. Static NAT
2. Dynamic NAT
3. PAT (Port Address Translation)
1) NAT Static
It makes a one to one map of a Private IP into a public IP.
It is usually used when we have a server (Web, FTP) in the local area network (LAN), and we want the resources on that server (a web page, a gaming server, a file) made accessible to the Internet.
2) Dynamic NAT
It makes an M to n mapping of a Private IP in an IP Public, where m is not necessarily equal to n. More specifically, to every device in the network that wants to reach the Internet a Public IP Address will be assigned from available space. If the number of available IP addresses ends, that device will not be able to access the Internet.
Dynamic NAT uses an address space that can only be assigned to a single computer that wants to access the Internet. It works on the FIFO principle (first come first served), so if we have 20 PCs in the network and only 4 public IP addresses available, only 4 of the 20 PCs will be able to reach the Internet.
3) PAT Port Address Translation
For PAT, the mapping is n to 1, which means we can have many private IP addresses and it will “transform” them into a single Public IP Address to which we add the Connection Source Port.
PAT hides multiple devices (with Private IP) behind a single Public IP.
A connection between 2 devices in the Internet also contains the following elements:
1. IP Source
2. IP Destination
3. Port Source
4. Destination Port
When it comes to PAT, the Router will use the Source IP, Private IP, and Source Port IP address to identify the connection.
PAT is the most widely used NAT type and it is used on the vast majority of Home-Oriented Routers.
Although theoretically, over 65,000 connections can be mapped to a single public address, NAT implementations do not map more than 4,000 connections to a single address.
For large networks, address translation is done by combining dynamic address translation with overloaded address translation.