Network Address Translation (NAT) is a technique used by routers to allow multiple devices on a private network to share a single public IP address when communicating with the internet. Without NAT, every device would need its own public IP address - impossible given IPv4's limited address space.

How NAT Works

  1. Your laptop (192.168.1.5) sends a request to google.com.
  2. Your router intercepts this packet and replaces the source IP (192.168.1.5) with your public IP (e.g., 98.45.112.233) and assigns a port number to track the connection.
  3. Google receives the request from 98.45.112.233 and responds to that IP and port.
  4. Your router receives the response, checks its NAT table, and forwards it to your laptop at 192.168.1.5.

Types of NAT

TypeDescriptionUse Case
SNAT (Source NAT)Replaces internal source IP with public IPHome/office internet access (most common)
DNAT (Destination NAT)Replaces public destination IP with internal IPport forwarding (hosting services inside NAT)
PAT / NAPTMaps multiple internal IPs to one public IP using port numbersHome routers (standard home internet)
Carrier-grade NAT (CGNAT)ISP-level NAT where multiple customers share one public IPMobile networks, some ISPs

NAT and IPv6

IPv6 was designed to eliminate the need for NAT by providing enough addresses for every device to have a globally unique IP. However, NAT provides a useful side effect: devices behind NAT are not directly reachable from the internet, adding a layer of security. Many network architects continue using NAT even in IPv6 networks for this reason.

People Also Ask

Does NAT hide my IP?
Partially. NAT hides your private (local) IP address. Websites see your router's public IP, not your device's private IP. It does not provide privacy from your ISP or from the websites you visit, which still see your public IP.

Related: Private IP addresses | Public IP | IPv4 vs IPv6