Network address translation (NAT) allows devices using private IP addresses on a local network to communicate with external networks by translating those addresses into a public IP address. A router performs this translation by modifying packet headers and recording each connection in a translation table.
How NAT works
When a device sends a packet to the internet, the NAT-enabled router replaces the packet's private IPv4 address with the router's public IPv4 address. For returning data, the router consults its NAT translation table and forwards the packet to the correct local device.
| Stage | NAT operation |
|---|---|
| Outgoing packet | Replaces the source private IP address with a public IP address |
| Connection tracking | Records the private address, public address, and usually port numbers |
| Incoming reply | Uses the translation table to identify the intended local device |
| Local delivery | Replaces the destination public address and forwards the packet internally |
For example, a laptop with private address 192.168.1.10 may send data through a router with public address 203.0.113.5. The internet server sees the router's public address, not the laptop's private address.
Most home networks use port address translation (PAT), sometimes called NAT overload. PAT assigns different port numbers to connections, allowing many local devices to share one public IPv4 address. This helps conserve the limited supply of public IPv4 addresses.
NAT also prevents unsolicited incoming packets from being delivered when no translation-table entry exists, unless a rule such as port forwarding has been configured. However, a common misconception is that NAT is a firewall. NAT may obscure private addresses, but it does not replace dedicated firewall rules that inspect and control traffic.
IB exam technique
For A2.3 Data transmissions, explain both directions of translation: private-to-public for outgoing packets and public-to-private for replies. A strong answer also identifies the router, packet-header modification, translation table, and use of port numbers when multiple devices share one public address.