optional · CSS study notes
Network Address Translation (NAT)
🧭
On this page — click any heading below to jump straight to it. ⬅️ Back to P-II.II. Computer Communications & Networks
OSI Layer: Network Layer (L3)
Definition
NAT (Network Address Translation) is a technique, implemented on a router/gateway, that maps private (internal) IP addresses to a public IP address (or a small pool of them), allowing many devices on a private network to share limited public IPv4 addresses for Internet access.
Private Address Ranges (RFC 1918)
Reserved for internal use and never routed on the public Internet:
10.0.0.0/8— large organisations (Class A range)172.16.0.0/12— medium organisations192.168.0.0/16— small networks/home routers (most common default)
Types of NAT
1. Static NAT
- A fixed, permanent one-to-one mapping between one private IP and one specific public IP.
- Used when an internal device (e.g., a mail server) must be consistently reachable from outside at a known public address.
- Simple but does not conserve addresses — one public IP is consumed per internal host regardless of activity.
2. Dynamic NAT
- A one-to-one mapping, but drawn from a pool of public IP addresses on a first-come, first-served basis as internal hosts initiate outbound sessions.
- Conserves addresses better than static NAT (only active hosts consume a public IP) but still requires roughly as many public IPs as simultaneously active internal hosts.
3. PAT / NAPT (Port Address Translation, a.k.a. NAT Overload)
- A many-to-one mapping: many internal hosts share a single public IP address, distinguished from one another using port numbers.
- Each outbound connection is tracked by the router in a NAT translation table keyed by (private IP, private port) ↔ (public IP, public port), so return traffic is correctly routed back to the originating internal host.
- The most widely deployed form — used by virtually every home and small-office router, since it needs only one public IP for an entire household or office.
How PAT Works (Step by Step)
- Internal host
192.168.1.5:50213sends a packet to8.8.8.8:443. - The router rewrites the source to its own public IP and a chosen port, e.g.
203.0.113.4:61000, and records this mapping in its translation table. - The reply from
8.8.8.8:443arrives addressed to203.0.113.4:61000. - The router looks up the table, rewrites the destination back to
192.168.1.5:50213, and forwards it internally.
Benefits
- Conserves scarce IPv4 address space — an entire organisation can operate behind one or a few public IPs.
- Adds a layer of implicit security by hiding internal network topology and addressing from the outside world (external hosts cannot directly address an internal host without a pre-existing translation entry).
- Allows internal renumbering without affecting external-facing address assignments.
Drawbacks
- Breaks true end-to-end connectivity, a founding principle of the original Internet design — a host behind NAT cannot easily be a "server" reachable by unsolicited inbound connections without extra configuration (port forwarding).
- Complicates protocols that embed IP addresses inside their payload (classic FTP, some VoIP/SIP signalling) or rely on true peer-to-peer connectivity, often requiring NAT traversal techniques (STUN, TURN, ICE).
- Adds processing overhead and a single additional point of failure at the NAT device.
- Unnecessary in IPv6's vastly larger address space, where every device can have a unique global address.
Comparison Table
| Type | Mapping | Public IPs Needed | Typical Use |
|---|---|---|---|
| Static NAT | One-to-one, fixed | One per mapped host | Servers needing a stable public address |
| Dynamic NAT | One-to-one, from a pool | ~One per simultaneously active host | Medium organisations with a pool of public IPs |
| PAT / NAPT | Many-to-one, port-based | One (shared) | Home/small-office routers (most common) |
Numericals
Q1 — Port capacity of PAT
Ports range 0–65,535; well-known ports (0–1023) are typically excluded from NAT use.
- Usable ports ≈ 65,535 − 1,024 ≈ 64,511 simultaneous translated sessions possible from one public IP — in practice fewer, since ephemeral port ranges are OS-dependent (e.g., 49,152–65,535 ≈ 16,383).
Q2 — Address savings
An office of 200 devices behind PAT with one public IP.
- Without NAT: 200 public IPv4 addresses needed.
- With NAT (PAT): 1 public IP needed — a 200:1 conservation ratio, illustrating why NAT was critical to extending IPv4's usable lifetime.
CSS Exam Angle
- NAT is a favourite "why is it important" question tied directly to IPv4 exhaustion — connect it explicitly to the IPv6 topic (IPv6 removes the need for NAT) for a strong composite answer if both appear in the same paper.
- Always name and distinguish all three types (Static, Dynamic, PAT/NAPT) — a common enumeration question, and PAT deserves the most detail since it is what is actually deployed almost everywhere.
- Mention the end-to-end connectivity trade-off as NAT's most cited theoretical drawback.
Example
An entire household's phones, laptops, and smart TVs sharing one ISP-assigned public IP address through a home router — each device distinguished purely by port number in the router's translation table — is a live, everyday example of PAT/NAPT in action.
Likely Questions
- Explain Network Address Translation (NAT) and its significance in IPv4 networks.
- Differentiate Static NAT, Dynamic NAT, and PAT with examples.
- Explain step by step how PAT translates and tracks multiple internal hosts sharing one public IP.
- What are the drawbacks of NAT, and why does IPv6 eliminate the need for it?
📜 Past-Paper Questions & Structured Answers
Questions are paraphrased; answer focus is suggested guidance, not an official marking scheme.
2018 · Paper-II · Q3(B) · 6 marks
Question (paraphrased): Explain NAT operation and usefulness.
Answer focus: Mechanism with a translation table, benefits and limitations.
Definition: NAT rewrites IP addresses at a network boundary. The common many-to-one form, PAT/NAPT, also translates transport ports.
| Private endpoint | Public mapping | Example remote server |
|---|---|---|
| 192.168.1.10:50000 | 203.0.113.5:40001 | 198.51.100.20:443 |
| 192.168.1.11:50000 | 203.0.113.5:40002 | 198.51.100.20:443 |
Outgoing: the router chooses a public address/port, records the mapping, replaces the private source address/port and updates affected checksums. Incoming reply: it matches the public destination endpoint to the stored entry, restores the private destination and forwards it inside. Entries expire when no longer needed.
Benefits: public IPv4 addresses are conserved, private addressing is reusable, and internal addressing need not mirror the ISP’s allocation. Limitations: the router must maintain state; unsolicited incoming traffic needs a mapping; some peer-to-peer, voice and address-embedding protocols need additional support. NAT is not a substitute for a firewall.
Distinction: basic one-to-one NAT rewrites addresses; many-host sharing uses ports as well.
2020 · Paper-II · Q4(a) · NAT component · 8 marks
Question (paraphrased): Explain how NAT reduces IPv4 address scarcity, alongside the required header comparison.
Answer focus: Eight marks are for the entire combined question, not NAT alone.
NAT component: a private network uses local addresses internally and translates outgoing connections onto a public address pool. PAT distinguishes clients by translated port numbers, letting many internal hosts share one public IPv4 address. The router maintains mappings and reverses the translation for return packets. This reduces public-address demand but adds state and complicates end-to-end connectivity.
Complete answer: combine this paragraph with the IPv4/IPv6 comparison in IPv6. Do not omit either requirement.