Have you ever heard people saying we are running out of IP addresses ? !!!! If you are a network enthusiast then may be yes… The addresses they are refering to is IPV4 addresses,then the question is aren’t we still running on IPV4 ? well the answer is yes, Despite the poorely distribution of IP addresses people(experts) found a way . The one soloution which was implemented is known as NAT(Network address translation) . while using the internet we all have ip addresses which we enter manually or we get it via DHCP .
Theses IP addresses are of the range :-
1. 192.168.0.0 b/w 192.168.255.255
2. 10.0.0.0 b/w 10.255.255.255
3. 172.16.0.0 b/w 172 .31.255.255
These IP addresses are known as private ip addresses , which are used to communicate within an organization.But they are of no use over the internet ,That’s where NAT comes in. What NAT does is it converts the private ip addresses into public ip addresses which can be used over the internet. It maintains a tables with the enteries of private ip addresses which are mapped with public ip addresses assigned to a user .For those who dont know NAT takes place in the router. Everything major thing in this world has it types , so does NAT .
It can be applied in three ways :-
1. NAT/PAT (most common, used all the time)
2. Static (used by large organization)
3. Dynamic (not used much )
NAT/PAT (port address translation) This is the insanely common type of NAT used .
Ill try to explain it through an example …. The router shown above has two interfaces , one with the ip address 192.168.1.1(subnet 192.168.1.0/24) and the other with the ip address 188.8.131.52 . if 192.168.1.50 wants to communicate to techclinch.com then it will be assigned a port i.e an unreserved port number (As you must be knowing ip address combined with ports are known as sockets which are used for communication). The entry will be stored in the PAT table and that page will be accesed via 184.108.40.206:6711 , Same process will be followed when 192.168.1.51 wants to reach techclinch.com for some information. But everything cannot be perfect , what if two host ask for the same port number,this situation can occur . well there is a solution for that also , the host reaching the router first will get that port number and the second host will get the port number which is currently not in use.
DYNAMIC NAT :- It is not used much , we can say that it’s like a temporary solution for two organization to communicate which have overlapping addresses . what it does is , it creates a pool of public ip addresses and a pool of private ip addresses and if one private ip address wants to go over the internet it will be assigned a public ip address from the public ip address pool.
STATIC NAT :- Static NAT is used by big organizations . It provides one to one mapping of ip addresses . The ISP(internet service provider) provides the organization with ip addresses like 220.127.116.11 up to 18.104.22.168 ,these ip addresses will be mapped to 192.168.1.1 till 192.168.1.255 permanently (not like dynamic) . so if 192.168.1.1 wants to access the internet it will always excess with ip address 22.214.171.124 . We can also go one step further i.e we can assign 126.96.36.199 with port numbers and use it multiple times for example if someone from outside the organization wants to reach ftp server in your organization then it can access it via 188.8.131.52:21 (21 is ftp port number) which will direct it to ftp server in your organization similarly 184.108.40.206:80 ( 80 is http port number) will access http server in your organization . so by using this method we can get the most out of ip addresses.