Network Address
Translation (NAT)
Understand how NAT maps private IP addresses to public ones, its impact on network exposure, and why it matters for security logging.
What Is NAT?
Network Address Translation (NAT) is a method used by routers to translate private (internal) IP addresses into a public (external) IP address before packets leave the local network. It was originally designed to conserve the limited pool of IPv4 addresses.
Why Does NAT Exist?
Private vs Public Addresses
| Private Addresses | Public Addresses | |
|---|---|---|
| Ranges (RFC 1918) | 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16 | All other routable IPv4 |
| Routable on Internet? | No | Yes |
| Unique Globally? | No: reused in every LAN | Yes: assigned by IANA/RIRs |
| Visible to External Servers? | No: hidden by NAT | Yes |
How NAT Works
The Translation Table
Every NAT router keeps a stateful table that tracks active connections. Each entry maps an internal source to a rewritten external source:
| Internal Source | External (Rewritten) | Destination |
|---|---|---|
| 192.168.1.10:52301 | 203.0.113.5:40001 | 93.184.216.34:443 |
| 192.168.1.11:48822 | 203.0.113.5:40002 | 93.184.216.34:443 |
| 192.168.1.12:61045 | 203.0.113.5:40003 | 142.250.80.46:80 |
Types of NAT
Comparing NAT Types
| Static | Dynamic | PAT / Overload | |
|---|---|---|---|
| Mapping Ratio | 1 : 1 | 1 : 1 (from pool) | Many : 1 |
| Port Rewriting? | No | No | Yes |
| Inbound Access | Allowed | Limited | Blocked by default |
| IP Conservation | Low | Medium | High |
| Typical Use | Public servers | Enterprise egress | Home / SMB routers |
NAT and Exposure
NAT provides a form of "security by obscurity" for internal hosts. Because external systems only see the router's public IP, they cannot directly initiate connections to devices behind PAT without explicit configuration.
Port Forwarding Breaks the Shield
NAT and Logging Challenges
When hundreds of internal users share one public IP, external logs only record that single address. This creates serious challenges for forensic investigations and incident response.
Solving the Logging Problem
How to Trace Through NAT
Example: Outbound Web Request
Example: Carrier-Grade NAT (CGNAT)
Common Mistakes About NAT
Summary Table
| Concept | Key Takeaway |
|---|---|
| NAT Purpose | Maps private IPs to public IPs to conserve IPv4 addresses |
| PAT (Overload) | Many-to-one using unique port numbers per session |
| Exposure | Internal hosts hidden unless port forwarding is configured |
| Port Forwarding | Creates a direct path from internet to internal service |
| Logging Challenge | Public IP alone is insufficient: need NAT logs + timestamps |
| CGNAT | Double NAT at ISP level makes tracing even harder |
| NAT vs Firewall | NAT is not a security tool: always deploy a real firewall |
Question 1 of 5
What is the primary purpose of NAT?
Question 2 of 5
In PAT (Port Address Translation), how does the router distinguish between multiple internal hosts sharing the same public IP?
Question 3 of 5
A web server log shows suspicious activity from 203.0.113.5. The organization uses PAT. What additional information is needed to identify the responsible internal user?
Question 4 of 5
Why is NAT not considered a replacement for a firewall?
Question 5 of 5
What security risk does port forwarding introduce in a NAT environment?