Introduction to Types of NAT
Story behind the existence of NAT is that using IPV4 i.e 32 bit, which will give around 4.2 billion unique IP’s, In which it is impossible to accommodate 7 billion* No of devices used by an individual in the world, Solution to keep using IPV4 yet, get more devices on internet is NAT. NAT processes in which one or more Local IP address is translated into one or Global IP addresses and vice versa in order to provide internet access to the local hosts. Generally, a border router or firewall will be configured for NAT. In this article, we will learn about the different types of NAT in detail.
Before jumping into how NAT works and Types of NAT let us understand a few terminologies to avoid confusion.
- Inside local address: Private IP address, assigned to a host on inside (local) network, it is inside host as seen from inside network. This IP address is assigned by the router connected to a group of devices, it is not accessible from the internet. All addresses starting from 192.168.x.x and 10.x.x.x are reserved for private IP addresses. We can use any IP within range without being worried about, some other device is using the same.
- Inside global address: It is one or more IP addresses, which represents the local network, seen as inside host from outside network. When we register with ISP we get an IP, which accessible throughout the internet. It is assigned to the router connected to a group of devices. Ex:126.96.36.199
- Outside local address: Actual IP of the remote host, after NAT translation.
- Outside Global address: It is the IP address of the remote host before
usually, local IP addresses are referred to as ‘private IP’ and Global as ‘public or registered IP’.
Types of NAT
Based on how the mapping of the IP addresses is done from local IP to Global IP, there are 3 types of NAT.
1. Static NAT
In this case, there will be one to one mapping between private IP and Public IP. i.e a private IP 188.8.131.52 is permanently mapped to a global IP 13.14.56.07, it is commonly used for web hosting.
2. Dynamic NAT
In this case, router is provided with set of public IP addresses, any device wants to connect to internet will be provided with immediately available public IP at router end, There will be one to one mapping based on first come first served technique but not permanent, public IP address used by the private IP can change over time.
4.5 (2,817 ratings)
3. PAT( Port Address Translation)
In this case, many private IP addresses are mapped to a single public IP, traffic is distinguished by port numbers of devices, i.e which packets belong to which private This is cost-effective, many users can connect to the Internet using single public IP at a time. It is also known as NAT overloading.
How Does NAT Work?
To understand how NAT works in real scenario Let’s consider a small topology, It has 3 devices connected to a router, let devices be a laptop, a mac, and a smartphone, they are all connected to a router, the router in its turn is connected to internet, public IP assigned to router is 184.108.40.206, the router has assigned 10.11.12.01 to laptop, 10.11.12.01 to MAC and 10.11.12.03 to smartphone.
Assume that laptop wants to connect remote server which hosts ‘weather forecasting website’ with global IP 220.127.116.11 and smartphone wants to access facebook hosted at global IP 18.104.22.168 when both requests arrive at the router, router maps the IP and entry in NAT table as shown below:
|Device||Private IP(Source IP: Port)||Public IP(Public IP: Port)|
|Label||10.11.12.01 : 42301||22.214.171.124:6666|
|Smartphone||10.11.12.03 : 42302||126.96.36.199:5555|
The request with Public IP and Host IP with message is sent to respective host servers via internet, on port 80 commonly used for HTTP requests, remoter servers responds to Public IP with added message, at router interface, router refers NAT table and sends back the response message to respective private IP and to their respective ports. To the laptop or smartphone, it appears the response has been sent directly to them by remote hosts.
Advantages of Using Nat
- It prevents the depletion of ipv4 addresses i.e more devices can connect to the internet using ipv4.
- It provides an additional layer of security by making the original and destination addresses hidden from each other.
- NAT provides increased flexibility while connecting to the Internet.
- If we are changing the device IPs used for a service accessed over the internet, it will not affect the service IP due to the NAT system.
Conclusion – Types of NAT
IPV4 is an age-old idea that is implemented after the 1970’s, to overcome the drawback of its NAT was introduced. It has a few disadvantages like it is time and resource consuming, it loses the traceability between source and destination and delays communication.
A slow migration is happening between IPV4 to IPV6, which will give 32 followed by 37 zeroes unique IP addresses, yet delayed because a lot of devices that are already on the Internet support only IPV4, and it takes time to break and build the new IPV6 supporting architecture.
This is a guide to Types of NAT. Here we discuss the introduction, working, terminologies, and top 3 types of NAT along with its advantages. You may also look at the following articles to learn more-