NAT (Network Address Translation) is a method used by routers to translate private IP addresses into a public IP address so devices can communicate over the internet.
It is one of the key technologies that makes home and office networks work.
---
Why is NAT needed?
Most devices in a local network use private IP addresses, such as:
- 192.168.x.x
- 10.x.x.x
- 172.16.x.x – 172.31.x.x
To access the internet, a router uses NAT to translate these private addresses into a public IP address.
---
How NAT works (simple example)
- Your PC has IP: 192.168.1.10
- You visit a website (e.g. example.com)
- Your router sends the request using its public IP (e.g. 85.214.x.x)
- The website responds to the public IP
- The router forwards the response back to your PC
---
One Public IP for Many Devices
With NAT, many devices can share one public IP address:
- PC
- Smartphone
- Tablet
- Smart TV
---
Types of NAT
1. Static NAT
- One private IP → one public IP
- Rare in home networks
- Used for servers
- Private IPs mapped to a pool of public IPs
- Less common today
- Most common NAT type
- Many devices share one public IP
- Uses different ports to track connections
NAT and Port Forwarding
By default, devices behind NAT are not directly reachable from the internet.
To allow external access, you need:
Port Forwarding
Example:
- Forward port 80 → 192.168.1.100 (web server)
- Forward port 22 → 192.168.1.101 (SSH)
Advantages of NAT
- Allows multiple devices to share one IP
- Reduces need for public IPv4 addresses
- Adds a basic layer of isolation
Disadvantages of NAT
- Breaks direct end-to-end connectivity
- Requires port forwarding for servers
- Can cause issues with some applications
NAT and IPv6
With IPv6, NAT is less important because:
- Each device can have a public IP address
- No need to share one IP