NAT (Network Address Translation) is a networking technique used to modify the source or destination IP addresses in IP packet headers while they are in transit. Its primary function is to allow multiple devices on a private local area network (LAN) to share a single public IPv4 address for internet access, effectively conserving the limited global address space.
How it works
When a device inside the network sends a packet to the internet, the NAT-enabled router replaces the internal private IP with its own public IP. It assigns a unique source port to track the session. This mapping is stored in a NAT translation table. When the destination server responds, the router uses this table to identify the original internal sender and forwards the data accordingly.
Common NAT variations include:
- Static NAT: Maps an unregistered IP address to a registered IP address on a one-to-one basis.
- Dynamic NAT: Maps an unregistered IP address to a registered IP address from a group of available public IPs.
- PAT (Overloading): Maps multiple private IP addresses to a single public IP address by using different ports.
NAT provides a basic layer of security by hiding internal network topologies from external scanning. In a typical home environment, a single router performs PAT for dozens of devices, such as laptops, phones, and smart TVs, using only one public IP provided by the ISP.