2 min to read
Network Address Translation (NAT)
A comprehensive guide to NAT, SNAT, and DNAT
🎯 Overview
Network Address Translation (NAT) is a crucial networking technology that enables address translation between private and public networks.
💡 What is NAT?
NAT converts network addresses from one type to another, primarily used to:
- Solve IP address shortage
- Protect internal networks
- Enable multiple devices to share one public IP
🔄 NAT Types
Static NAT
- One-to-one mapping
- Private to public IP
- Used for web servers
Dynamic NAT
- Pool of private IPs to pool of public IPs
- No guaranteed consistent mapping
- Used for outbound connections
PAT (Port Address Translation)
- Many private IPs to one public IP
- Also called NAT overload
- Common in SOHO networks
🌐 Advanced NAT Types
SNAT (Source NAT)
Purpose:
- Translates source IP for outbound traffic
- Enables internal network access to internet
- Manages port translation
DNAT (Destination NAT)
Purpose:
- Translates destination IP for inbound traffic
- Enables port forwarding
- Manages external access to internal servers
📊 NAT Workflow Example
🔑 Component | 🏠 Private IP | 🌐 Public IP |
---|---|---|
Internal Client | 192.168.1.100 | - |
NAT Device | - | 198.51.100.1 |
External Client | - | 203.0.113.50 |
Internal Server | 192.168.1.200 | - |
🌐 Explanation
- Internal Client: Uses a private IP (192.168.1.100) within the local network and doesn’t have a public IP.
- NAT Device: Acts as a bridge between internal and external networks, translating private IPs to its public IP (198.51.100.1).
- External Client: Has a public IP (203.0.113.50) and can access external networks directly. Internal Server: Like the client, it has a private IP (192.168.1.200) and is isolated from public access.
SNAT Process
Original Packet:
Source: 192.168.1.100:12345
Destination: 203.0.113.50:80
Translated Packet:
Source: 198.51.100.1:54321
Destination: 203.0.113.50:80
DNAT Process
Original Packet:
Source: 203.0.113.50:44321
Destination: 198.51.100.1:80
Translated Packet:
Source: 203.0.113.50:44321
Destination: 192.168.1.200:80
Comments