Network Address Translation
In networking, NAT stands for Network Address Translation. It’s a method used by routers to translate private (local) IP addresses into a public IP address (and vice versa) when data is going to or coming from the internet.
Why NAT is used:
IP address conservation: IPv4 addresses are limited. NAT allows multiple devices in a local network (like your home Wi-Fi) to share a single public IP address.
Security: It hides internal IP addresses from the outside world.
Types of NAT:
Static NAT:
One private IP is mapped to one public IP.
🔄 Always same mapping.
Dynamic NAT:
A private IP is mapped to any available public IP from a pool.
🔁 Not fixed.
PAT (Port Address Translation) – also called NAT Overload:
Many private IPs share one public IP, distinguished using port numbers.
🌐 This is the most common form, used in home routers.
Example:
Your phone has a private IP: 192.168.1.10
Your router has a public IP: 123.45.67.89
When your phone accesses a website:
NAT converts 192.168.1.10 ➜ 123.45.67.89:port
The website responds to 123.45.67.89:port
NAT converts it back to 192.168.1.10
Let me know if you want a diagram or real-world analogy!