Network Address Translation (NAT) and Port Address Translation (PAT) are the protocols used to map the unregistered private (inside local) address of an internal network to a registered public (inside global) address of an external network before transferring the packet. The main difference between them is that NAT is used to map public IP addresses to private IP addresses, it could be a one-to-one or many-to-one relation. On the other hand, PAT is a type of NAT where the multiple private IP addresses are mapped into a single public IP (many-to-one) by using ports.
An internal network user having a private IP (unregistered) could not connect to the internet or external network because each device in a network must have a unique IP address. NAT works on a router connecting two networks together, and it translates the internal network private address (i.e. not globally unique) into the legal public address.
Additionally, it was devised to conserve the IP addresses. As the internet users were facing a problem of IP address scarcity, where the number of users was increased more than the limited range of IP addresses. For the certain reason, NAT and PAT protocols are used.
Content: NAT Vs PAT
|Basis for comparison||NAT||PAT|
|Basic||Translates the private local IP address to the public global IP address.||Similar to NAT it also translates the private IP addresses of an internal network to the public IP address with the help of Port numbers.|
|Relationship||Superset of PAT.||Variant of NAT (form of a Dynamic NAT).|
|Uses||IPv4 address||IPv4 addresses along with the port number.|
Definition of NAT
Network Address Translation (NAT) basically connects two networks and map the private (inside local) addresses into public addresses (inside global). Here the term inside local signifies that the host address belongs to an internal network and not assigned by Network Information Center or service provider. And the inside global means that the address is a licit address assigned by the NIC or service provider and it also represents one or more inside local addresses to the outside world.
The main purpose of NAT was to slow down the rate of depletion of available IP address space by enabling many private IP addresses to be represented by some smaller number of public IP addresses. Furthermore, only one address can be configured in NAT to represent the entire network to the outside world. Therefore it provides security as the translation process is transparent. NAT can be used as a tool for network migration and merging, server load sharing, virtual server creation, etc.
NAT can be of three types :
- Static NAT – In this type of NAT a local address is mapped to a global address, and there exists a one-to-one relationship. Static NAT is useful when a host requires a consistent address, which must be accessed from the internet. For example, enterprise servers or networking devices.
- Dynamic NAT – Dynamic NAT allows unregistered private IP address to be translated into registered public IP address from a pool of public IP addresses.
- PAT/ NAT Overloading/IP masquerading – PAT is most popular type among the three types. It is a variant of Dynamic NAT and is similar to it, but it maps multiple private IP addresses to a single public IP address by making use of ports.
Definition of PAT
Port Address Translation (PAT) is a type of Dynamic NAT through which address translation can be configured at the port level, and the remaining IP address usage is also optimized. PAT maps multiple source local addresses and ports to a single global IP address and port from a pool of IP addresses that are routable on the destination network. Here the interface IP address is used in combination with the port number and multiple hosts could have same IP address because the port number is unique.
It uses unique source port address on the inside global IP address to identify the distinct translations. The total number of NAT translations that can be carried out is 65536 because the port number is encoded in 16 bits.
PAT tries to preserve the original source port. It attempts to find the first available port if the source port is already allocated. The port groups are divided into three ranges that are from 0 to 511, 512 to 1023, or 1024 to 65535. If PAT doesn’t get any available port from the appropriate port group and if more than one external IPv4 address is configured, PAT moves to the next IPv4 address and attempts to allocate the original source port until it runs out of available ports and external IPv4 addresses.
Key Differences Between NAT and PAT
- NAT translates the inside local addresses into inside global addresses similarly PAT translates the private unregistered IP addresses into public registered IP addresses, but unlike NAT it uses source port numbers also, and multiple hosts can be assigned with the same IP having different port numbers.
- PAT is a form of Dynamic NAT.
- NAT uses IP addresses in the process of translation whereas PAT uses IP addresses along with port numbers.
Advantages and Disadvantages of NAT
- NAT preserves the registered public addresses and slows down the depletion of the IP address space.
- Occurrence of address overlap significantly reduces.
- Increases flexibility of the connection establishment.
- Removes the process of address renumbering at the time of changing network.
- Translation results in switching path delays.
- Lack of end-to-end traceability.
- Certain applications are not compatible with NAT.
Advantages and Disadvantages of PAT
- Conserve IP addresses by assigning single public IP to a group of hosts with the help of the different port numbers.
- Lessens the vulnerabilities or security attacks as the private address prevent the public address from being exposed.
- More than one same type of public services cannot be executed with a single IP address in PAT.
- Number of entries are limited in the internal table for keeping the tracks of the connections.
NAT and PAT protocols are used for minimizing the requirement of globally unique IP addresses, allowing a host whose address is not globally unique to connect to the internet, by translating those addresses into globally routable address space. There is a slight difference between NAT and PAT is that NAT doesn’t use ports while PAT uses source ports in the translation process.