NAT – Network Address Translation
NAT definition:
NAT is a method used to translate private IP addresses into a public IP address when the devices in the local network need to communicate through the internet. NAT allows a host that does not have a valid, registered, globally unique IP address to communicate with other hosts through the internet.
Why NAT (Network Address Translation) is used?
To extend the life of IPV4 as the network layer protocol of the internet by saving the IPV4 public address space. NAT saved the remaining unused IPV4 public address space by allowing the private addresses to communicate through the internet using one or few public address space. Instead of assigning 500 public IPs to the devices used in a company, one or two public address is sufficient for them to communicate through the Internet.
Hosts in a LAN will use private IP addresses (free to use) to communicate with them. They use the purchased public address only when it is required to communicate through the Internet.
Private IP addressing
Private IP address space is a set of reserved networks that will never be assigned to any organization as a registered network number. That is, ISP’s will not provide this private addresses to a company or to any customer. This private addresses can be used only in the local networks. But when the hosts in this local network need to communicate through the internet, these local addresses are translated into registered public IP address using NAT.
Private IP Address
Networks
|
IP Addresses Range
|
Class of Networks
|
Number of Networks
|
10.0.0.0
|
10.0.0.0 to 10.255.255.255
|
A
|
1
|
172.16.0.0 -- 172.31.0.0.
|
172.16.0.0 to 172.31.255.255
|
B
|
16
|
192.168.0.0 – 192.168.255.0
|
192.168.0.0 to 192.168.255.255
|
C
|
256
|
How NAT works?
The router which is performing NAT changes the packet’s source IP address when the packet leaves the private office and also changes the destination address in each packet that is forwarded back into the private network.
Types of NAT
1. Static NAT
The NAT router simply configures a one-to-one mapping between the private address and the registered public address that is used on its behalf.
For example, Host 192.168.1.1(Private address) is mapped to 200.1.1.1 (Public address)
Host 192.168.1.2 is mapped to 200.1.1.2 and so on.
In this static NAT method, we need 200 registered public IP addresses if 200 hosts want to communicate through the Internet.
2. Dynamic NAT
Like static NAT, Dynamic NAT also creates a one-to-one mapping between an inside local (private address) and inside global (public address). The only difference is dynamic NAT sets up a pool of possible public addresses and defines matching criteria to determine which private addresses should be translated using NAT.
It is better than static NAT because dynamic NAT can be configured with more IP addresses in the private address list than in the inside public address pool. In the real scenario, not all the hosts communicate to internet continuously, so it is possible even 10 public IP addresses can be used by a higher number of hosts if they communicate to the internet in different periods of time. The router allocates addresses from the pool until all are allocated.
If all the hosts need to use the internet concurrently at the same time, PAT should be used.
3. PAT – Port Address Translation
PAT is a NAT overload feature which translates not only the IP address but the port number when necessary. In this method, Even a single public IP address is sufficient to make thousands of hosts to connect to the internet.
PAT dynamic mapping example
Private address (Inside local)
|
Public address (Inside Global)
|
192.168.1.1.: 1024
|
200.1.1.2: 1024
|
192.168.1.1.: 1024
|
200.1.1.2: 1025
|
192.168.1.1.: 1033
|
200.1.1.2: 1026
|
As you know 1024, 1025, 1033 are port numbers.
Comments