====== Network Address Translation (NAT) ====== **Network Address Translation (NAT)** is a technique that allows multiple devices on a private network to share one or more public IP addresses when communicating with the Internet. Today, NAT is used in almost every home and office network. ----- ===== Why Is NAT Needed? ===== Most devices use **private IP addresses**, which cannot be routed across the Internet. For example: Laptop 192.168.1.20 A website on the Internet cannot send packets directly to this address. Instead, a router performs **Network Address Translation (NAT)**. ----- ===== How NAT Works ===== Suppose your home router has: Public IP 203.0.113.25 Your laptop has: Private IP 192.168.1.20 When you visit: https://example.com the router replaces the source address. Before NAT: Source 192.168.1.20 Destination 93.184.216.34 After NAT: Source 203.0.113.25 Destination 93.184.216.34 The website never sees your private IP address. ----- ===== Home Network Example ===== Laptop 192.168.1.20 │ Phone 192.168.1.21 │ TV 192.168.1.22 │ ▼ Wi-Fi Router NAT Public IP 203.0.113.25 │ ▼ Internet All three devices share the same public IPv4 address. ----- ===== Why NAT Became Popular ===== IPv4 provides about: 4.3 billion addresses This is not enough for every Internet-connected device. NAT allows thousands of devices to share a much smaller number of public addresses. Without NAT, IPv4 exhaustion would have occurred much earlier. ----- ===== Advantages of NAT ===== * Conserves public IPv4 addresses. * Allows many devices to share one Internet connection. * Simplifies home network configuration. * Hides internal IP addresses from the Internet. ----- ===== Disadvantages of NAT ===== NAT also has some drawbacks. * Makes direct incoming connections more difficult. * Some applications require port forwarding. * Peer-to-peer applications may require additional configuration. * Troubleshooting becomes more complex. ----- ===== NAT and IPv6 ===== IPv6 provides an enormous address space. Therefore, IPv6 generally **does not require NAT**. Each device can have its own globally unique IPv6 address. ----- ===== Carrier-Grade NAT (CGNAT) ===== Some Internet Service Providers perform NAT on their own networks. This is called **Carrier-Grade NAT (CGNAT)**. Example: Your Computer ↓ Home Router ↓ ISP NAT ↓ Internet With CGNAT: * Many customers share one public IPv4 address. * Hosting services at home becomes more difficult. * Port forwarding may not work. ----- ===== NAT and Telenegar ===== Several Telenegar tools help illustrate NAT. **IP Check** Your computer may have: 192.168.1.20 while Telenegar reports: 203.0.113.25 This difference is usually caused by NAT. ----- **Traceroute** When using Telenegar Traceroute, the first hop is often your home router. Example: 1 192.168.1.1 2 ISP Gateway 3 ... The first hop is the device performing NAT and forwarding your traffic toward the Internet. ----- ===== Common Misconceptions ===== * **NAT is a firewall.** * False. NAT translates addresses. Although it provides some isolation, it is not a replacement for a firewall. * **A website can see my private IP address.** * False. Websites normally see only your public IP address after NAT. * **Every public IP belongs to one device.** * False. Many devices may share one public IP through NAT. * **IPv6 always uses NAT.** * False. IPv6 was designed so that NAT is generally unnecessary. ----- ===== Related Topics ===== * [[networking:internet:private-public|Private vs Public IP]] * [[networking:internet:ip-addresses|IP Addresses]] * [[networking:internet:default-gateway|Default Gateway]] * [[networking:internet:ipv4|IPv4]] * [[networking:internet:ipv6|IPv6]] * [[tools:ipcheck|IP Check]] * [[tools:traceroute|Traceroute]] ----- {{tag>nat ipv4 ipv6 networking traceroute ipcheck}}