Network Address Translation (NAT)
Network Address Translation (NAT)
NAT (Network Address Translation) is a technique used to allow computers with private IP addresses to communicate with the Internet using one or more global/public IP addresses.
Why is NAT needed?
A small organization may have many computers but only a few need Internet access at the same time. Instead of assigning a public IP address to every computer, the organization can use private IP addresses internally and share one or more public IP addresses through a NAT router.
How NAT works
Consider:
-
Private network:
172.18.3.0/24 -
NAT router's private address:
172.18.3.30 -
NAT router's public address:
200.24.5.8
When an internal computer sends a packet:
Outgoing packet:
Source: 172.18.3.1 → Destination: Internet server
The NAT router replaces the private source address with its public address:
Source: 200.24.5.8 → Destination: Internet server
When the reply comes back, the NAT router uses its translation table to determine which internal computer should receive the packet and changes the destination address back to the private address.
Simple representation
In one sentence
NAT translates private IP addresses into public IP addresses for Internet communication and maintains a translation table so that returning packets can be delivered to the correct internal host.
Types of NAT
NAT can be implemented using different approaches:
1. NAT Using One IP Address
The NAT router uses one global/public IP address for the private network.
Example:
Private IP Public IP 172.18.3.1 ──► 200.24.5.8
The router maintains a translation table containing the private address and the external destination.
Limitation: Communication must generally be initiated from the private network.
2. NAT Using a Pool of IP Addresses
Instead of one public address, the NAT router has a pool of public IP addresses.
Example:
200.24.5.8 200.24.5.9 200.24.5.10 200.24.5.11
Different private hosts can be mapped to different public addresses.
For example:
172.18.3.1 → 200.24.5.8 172.18.3.2 → 200.24.5.9 172.18.3.3 → 200.24.5.10 172.18.3.4 → 200.24.5.11
This allows multiple private hosts to communicate simultaneously.
Limitation: The number of simultaneous connections is limited by the number of available public IP addresses.
3. NAT Using IP Addresses and Port Addresses
The translation table uses both IP addresses and port numbers.
This provides a much more flexible mapping between:
- Multiple private hosts
- Multiple external servers
- Different applications/services
Thus, many private hosts can share a single public IP address, with port numbers helping the NAT router distinguish between different connections.
Quick comparison
| Type | Public addresses used | Main idea |
|---|---|---|
| One IP address | 1 | One public IP is used for translation |
| Pool of IP addresses | Multiple | Private hosts are mapped to a pool of public IPs |
| IP + Port addresses | One or more | IP addresses and port numbers are used to distinguish connections |
In one sentence
NAT allows a private network to communicate with the Internet by translating private IP addresses into public IP addresses, using one public IP, a pool of public IPs, or IP addresses together with port numbers.
Comments
Post a Comment