What is NAT?
Routers are an essential part of our lives and are the driving force behind the rapid rise of the internet. Router, as its name implies, “routes” traffic between devices and the internet. One key technology that makes this possible is NAT (Network Address Translation). What is NAT and what does it do? We’ll break it down for you throughout the following article.
A simple explanation is that NAT translates the IP addresses of devices in a local network (private IP address) to a public IP address. This is often used by the router to connect devices to the internet.
What makes NAT so important?
When devices connect to the internet, they will identify each other by their unique IP address, kind of like your house has an address. In theory, your device must have its own unique IP address so that information can be delivered directly to you. But about 22 years ago, the number of available IP addresses started running out and it was no longer possible to assign a unique one to each device. NAT was created to solve the problem of IP address shortage and does so by modifying network address information.
What is a Public IP address?
A public IP address is your passport to the internet. You couldn't do much without a public IP address. Like post addresses (e.g. 1234 Main Street) are used to deliver mail to your home, a public IP address (e.g. 183.69.238.26) is the unique IP address assigned to a specific device. This public IP address is used to communicate with the internet.
What is a Private IP address?
A private IP address is used within the local network. Computers, phones, tablets, and other online devices in your home are usually assigned private IP addresses (e.g. 192.168.0.1). The IANA (Internet Assigned Numbers Authority) reserves the following IP address blocks for use as private IP addresses:
Class A: 10.0.0.0 - 10.255.255.255
Class B: 172.16.0.0 - 172.31.255.255
Class C: 192.168.0.0 - 192.168.255.255
Devices with private IP addresses will not be directly exposed to the internet. If they want to communicate with the internet, NAT needs to be used.
How does NAT work?
NAT is used by routers and other gateway devices at the network boundary. When the IP packets between local and outside network pass through the boundary, NAT will inspect and modify the source IP (SIP) or destination IP (DIP) in the IP packets to reflect the configured address mapping.
For example, your ISP (Internet Server Provider) allocates one public address 182.99.1.50 to you, which is the address of the router’s WAN port. The router, in turn, gives each connected device a private address—192.168.0.12 for your computer.
- When your computer connect to the internet, the router with NAT translates the private address 192.168.0.12 to the public IP address 182.99.1.50.
- When the device on the outside network wants to communicate with your computer, the information comes back to 182.99.1.50 and the router receives it. The router then forwards the data back to your computer 192.168.0.12 according to the private IP address.
The whole process is called NAT, in which your router or firewall translates your private IP address into a public IP address. Local devices with private addresses use the same public IP address to communicate with devices on the outside network.
Hopefully by now the benefits of NAT are fairly obvious. First, it reduces the number of IP addresses we need to use, solving the problem of IP address shortage. Second, it hides local devices from the outside world, which provides an extra layer of network security which allows for stricter access control on both sides of the firewall.