Networking basics, What is NAT?

NAT (Network Address Translation) is a method used by routers to map private local addresses to a single public IP address before data is transmitted over the internet. It’s crucial for conserving IP addresses and providing basic security. This tutorial explains how NAT works and why it's important.

Step 1: Why Do We Need NAT?

  • Private IP addresses (e.g., 192.168.x.x) are not routable on the public internet.
  • NAT allows multiple devices to share a single public IP.
  • It prevents direct access to internal devices from the outside, adding a security layer.

Step 2: How NAT Works

When a device sends data out:

  1. The router replaces the device’s private IP with the public IP in the packet header.
  2. It keeps a translation table mapping internal IP:port to external IP:port.
  3. When a response comes back, the router uses this table to forward the data to the correct internal device.

Step 3: Types of NAT

  • Static NAT: Maps one private IP to one public IP.
  • Dynamic NAT: Maps private IPs to available public IPs from a pool.
  • PAT (Port Address Translation): Most common — multiple private IPs use one public IP but different ports (a.k.a. NAT overload).

Step 4: NAT in Action

Internal: 192.168.1.10:12345 → NAT Router → Public: 203.0.113.5:54000

When the response comes back to port 54000, NAT sends it to 192.168.1.10:12345.

Step 5: NAT and Port Forwarding

NAT can block unsolicited inbound traffic. Port forwarding allows specific services (like a web server) to be accessible from the outside.

Next Steps

Check your router’s NAT settings. Experiment with port forwarding and use ipconfig / tracert to see how NAT affects your traffic.