What is Network Address Translation (NAT)? 

4 minutes

Many of the networks we access daily use network address translation (NAT) to preserve your privacy and help conserve the limited amount of IP addresses available. Understanding how NAT works comes in handy when you’re working in data science, cybersecurity, and systems or network administration. Ahead, we’ll go over how NAT works, the different types of NAT, and why they’re used.

Learn something new for free

How does NAT work? 

Before we get into the inner workings of NAT, it’s helpful to review that IP (short for internet protocol) addresses are strings of identifying numbers that are associated with a specific device or computer network. IP addresses are used to identify the host or network interface and provide the location, so that data packets can be routed between devices. 

NAT involves transferring local private addresses to a public one, which then passes them on to a router and ultimately to the sites you visit on the ​internet​. NAT takes the local IP addresses assigned to each device and combines them under one​ IP address​. This creates the public-facing IP address associated with your home or organization. 

Local IP addresses only exist on the local access network (LAN) and don’t allow outside resources to access them. With NAT in place, the router acts as a middleman for all devices used when navigating the internet and returns answers to queries you submit.​     ​ 

Other uses for NAT: Multi-homing and router-based filtering 

NAT can also be used for multi-homing, a process that allows the network to connect to multiple ​internet​ service providers. This reduces the chances of being impacted by an outage or network downtime. Multi-homing can also make load balancing through the router equipment much easier. 

Load balancing ensures that a uniform number of computers are connecting through the same connection. This decreases load times and leads to better overall performance for the end-user. Load balancing can be automated through the router using border gateway protocol, a set of protocols that helps the router understand where to route traffic. 

Businesses can use NAT to operate router-based filtering and tracking of web traffic. This kind of filtering can prevent team members from visiting inappropriate or unproductive websites, and tracking can help detect potential security issues. For example, if someone visited a known phishing website or exposed company information to an outside organization. 

Understanding the different types of NAT 

There are at least four types of NAT, including: 

  • Static​:​ A static NAT uses the same IP address repeatedly, each time you connect to the ​internet​, in a one-to-one connection. 
  • Dynamic​:​ A dynamic NAT changes, cycling through a selection of available IP addresses each time you connect. 
  • Port​:​ A port address translation (PAT) is a specific type of dynamic NAT. In this setup, internal IP addresses are routed to one registered IP address through ports. Thanks to its more complex nature, a PAT may need to be set-up and supervised by a network administrator. 
  • Overlapping​:​ Overlapping NAT is done through a lookup table, which replaces the IP addresses from your internal network that are already registered on another network with unregistered ones. 

Why NAT is important 

By using NAT to manage the IP addresses at your home or business, your private information, user data, and browsing history are protected against hackers and other bad actors who can use this information to target you while you conduct business online.  But the required information about your public router address is shared so you can access the ​internet​.  

In the early days of the ​internet​, it seemed unlikely that IP addresses would ever run out. Most homes didn’t even have one computer, and businesses only had a handful in the office. Over time, as an ​internet​ connection became vital to more devices, the limited nature of the IP addresses available became more of an issue. 

The average home today has multiple devices connected to the ​internet​ at any time, from computers to smart TVs to wearable devices. Rather than assign five or seven different IP addresses to the devices all within the home, NAT takes them all and consolidates them into one. 

The same concept applies on a larger scale within large office environments, where teams’ computers and smart devices used for work get assigned the same IP address. In factories that operate a large-scale manufacturing environment with internet-connected equipment, NAT is vital to help balance the number of connections made and decrease latency. 

The future of NAT 

Though NAT offers a short-term solution to the limited ​number​ of IP addresses, a long-term fix is needed. New 128 bit length IP addresses, available under a protocol known as IP version 6, will increase the number of IP addresses available to ​​340 undecillion IP addresses. While​​ IP address conservation likely won’t be an issue after this point, NAT’s benefits make it a valuable tool many companies will want to continue using even when new IP addresses abound. 

Learn more about cybersecurity 

If you want to increase your knowledge about how to protect sensitive information online, check out our network security basics cheat sheet. You might also consider taking Codecademy’s Introduction to Cybersecurity course. In this course, you’ll learn the fundamentals of using the available tools and technology to keep yourself and others secure on the web.

Related courses

3 courses

Related articles

4 articles