NAT, which is critical to the IPv4 networks we still use today, has been hotly debated as the IPv6 grows with more addresses. However, since the IPv6 is not full-fledged, the existence of NAT still makes sense. Here I will introduce NAT definition and figure how NAT works and why we need it.
What Is NAT?
NAT, known as network address translation, is the method adopted by a firewall or router to assign the public addresses to the devices work in the a private network.
It translates the private IPv4 addresses we use in our internal networks into public IPv4 addresses that can be routed over the internet. As we all know, the private addresses may be occupied by connected local service—computers, game consoles, phones, fiber switches etc. to communicate with the modem/router and other devices on the same network. However, the home network connection uses a single public IP address to access the internet. Given this, NAT is responsible for translating the IP address of every device connected to a router into a public IP address at the gateway. Then those devices can connect to the internet.
NAT: Why We Need?
Assume that you have 3 PCs, a gigabit Ethernet switch which connects 6 PCs, a 10 gigabit switch connecting 6PCs and one smart phone, two ipads and all of them need to work at the same time, then you need to get each of them an IP address accessible to the Internet. But due to a lack of IPv4 IP address space, it is hard to handle the massive number of devices we use every day. Well, the network address translation, proposed in 1994, has become a popular and necessary tool in the face of IPv4 address exhaustion by representing all internal devices as a whole with a same public address available. Together with its extension named port address translation, the network address translation can conserve IP addresses.
Safety, another issue we may concern when accessing the external internet, can partly be addressed by network address translation which servers as a strict controller of accessing to resources on both sides on the firewall. The hackers from outside cannot directly attack the internal network while the internal information cannot access the outside world casually.
How Does NAT Work
A router carrying NAT consists of pairs of local IP addresses and globally unique addresses, by translating the local IP addresses to global address for outgoing traffic and vice versa for incoming traffic. All these are done by rewriting the headers of data packets so that they have the correct IP address to reach the proper destination.
There are generally two types of NAT: dynamic and static.
In dynamic NAT, we map inside local addresses in internal network to global addresses so that they can access resources on the internet. The router responds to the hosts who want to access the internet with an available public IPv4 address so that they can access the internet.
In static NAT, we usually map an internal local address to a global address so that hosts on public networks can access a device in the internal network.
In a word, before the full transition of IPv6, NAT can guarantee the smooth internet surfing no matter how many devices you’ve got. Knowing what it is and how it works with network address will help you establish a clear understanding of it so that you can make good use if it.