When it comes to accessing the internet, you won’t be able to browse websites without NAT or PAT. NAT is a router feature that is used to do translation of IP addresses whereas PAT translates the ports. Naturally, there’s a difference between the two technologies, which you’ll get to learn below.
Network Address Translation (NAT): The IPv4 puts a constraint on the number of devices addressed. On IPv4 we can only address 2^32 devices, so the concept of private and public addressing originated. Network Address Translation (NAT) connects two networks to map the private addresses into public addresses. The main duty of NAT is to slow down the depletion rate of IP addresses by letting private IP addresses be represented by public IP addresses.
Moreover, one address can represent the entire network to the world after proper configuration in NAT. This translation process is very transparent and provides more security to the network. You can use NAT as a tool for network migration and virtual server creation, load sharing on the server and network merging. NAT is branched into three categories:
In this category, one local address is mapped to one global IP address in a one-on-one relationship. When the host asks for a consistent address that has to be accessed from the internet, static NAT comes in to play. Enterprise servers and networking devices are the common examples of this category of NAT.
Dynamic NAT enables private unregistered IP addresses to translate into a registered and public IP address. These IP addresses lie in a pool of IP addresses available publicly.
Out of all categories, PAT is the most popular one. It closely mimics Dynamic NAT, but maps several private IP addresses to a single IP address using protocols.
Port Address Translation is a variant of dynamic NAT which enables address translation on the port level. It also optimizes the remaining IP addresses. PAT gathers multiple local addresses and ports them to one global address and port. These addresses can be easily routed to the destination network. The interface IP address goes with the port number which is unique and multiple hosts can have the same address. the unique port address in the global IP address helps in translating each distinct connection on a network.
The port number is encoded in 16 bits, so the complete number of NAT translations that can happen is capped at 65536. PAT preserves the original source ports so if the source port is allocated then PAT explores the available ports. If PAT is still unable to achieve a port from a group, then it moves to the next IPv4 address. It keeps searching until it explores all available ports and IPv4 addresses.
Difference between NAT and PAT
NAT provides a one-on-one translation which is a common practice in a network which wants to give the internal system access to the internet. The access is given with a public single IP address that translates into a private address.
PAT has many one-on-one relationships which are used on a firewall when a company or organization wants all IP addresses within the internal network to use one IP address. A company that wants all devices to show a single IP address while communicating uses PAT to do so.
When comparing NAT with PAT, it’s worth knowing that each workstation will have the same IP but different port in each session. Moreover, NAT uses an IP address to translate whereas PAT uses IP addresses and port numbers. PAT is also a form of dynamic NAT.