What is NAT : (Network address translation )/PAT (port address Translation )
NAT ! what it does is , translate inside ip address to outside ip address or vise versa , ok by now you are thinking what is inside and what is outside ? let me give you an example , let say you have a router it has two interface , one connected to your pc or switch the other one connected to your service provider . the one connected to your pc or switch will be an inside interface and the other one connected to service provider will be outside interface .
Router does NAT !
what happens is , router gets an ip address from service provider , that will be a public ip address , now behind the router inside interface there might be 10 or 100 computers connected to router through switch and every computer wanted to use internet ,these computers gets an ip address via DHCP or static assignment , most of the time these are private ip address , defend on your design and money that your spending , public ip address are expensive to get and even they are running out of stock soon , that’s why IPV6 in place .
What router does is , translate all private address to one public address via different port number , that is PAT (port address translation ) .
Why use NAT !
The shortage of public IP addresses is only one reason to use NAT. Two other good reasons are: Security and Administration.
Example : NAT is like the receptionist in a large office. Let's say you have left instructions with the receptionist not to forward any calls to you unless you request it. Later on, you call a potential client and leave a message for them to call you back. You tell the receptionist that you are expecting a call from this client and to put them through.
The client calls the main number to your office, which is the only number the client knows. When the client tells the receptionist who they are looking for, the receptionist checks a lookup table that matches up the person's name and extension. The receptionist knows that you requested this call, therefore the receptionist forwards the caller to your extension.
Various NAT Type :
Static NAT – Mapping an unregistered IP address to a registered IP address on a one-to-one basis. Particularly useful when a device needs to be accessible from outside the network.
Dynamic NAT – Maps an unregistered IP address to a registered IP address from a group of registered IP addresses. Dynamic NAT also establishes a one-to-one mapping between unregistered and registered IP address, but the mapping could vary depending on the registered address available in the pool, at the time of communication.
(Most popular ) Overloading – A form of dynamic NAT that maps multiple unregistered IP addresses to a single registered IP address by using different ports.
Known also as PAT (Port Address Translation),
Overlapping – When the IP addresses that you are using in your internal network and the company that you are going to connect to are using same ip addresses range in their network, the router must maintain a lookup table of these addresses so that it can intercept them and replace them with registered unique IP addresses. It is important to note that the NAT router must translate the "internal" addresses to registered unique addresses and also it must translate the "external" registered addresses to addresses that are unique to the private network. This can be done either through static NAT or you can use DNS and implement dynamic NAT.
.