NAT -Network Address Translation

Tejaswini Appollo
YavarTechWorks
Published in
4 min readMay 12, 2023

NAT is a process of translating the source and destination IP (Internet Protocol) addresses and ports (ie.,) changing one IP address into another IP address. NAT can be processed in routers or firewalls.

Since this topic involves or play around the term IP address, first let us understand what an IP address is? An IP address or Internet Protocol Address is a series of numbers that identifies any device on a network (two or more computers that are linked to share the resources)

IP addresses can be public -used on the internet and private -used in a local area network (LAN)

Public IP address -Public IP addresses are provided by an internet service provider (ISP) and assigned to the router. It is a unique IP address on the internet. A public IP ensures websites, emails, and other online contents reach you correctly, acting as a gateway to the internet. Public IPs require additional security measures, they are prone to attacks.

Private IP address -Private IP addresses are assigned by the network and router to a particular device in the network. Private IP addresses within the same local network must be unique. Private IPs are secure.

Private IP addresses aren’t routed on the internet, they never leave the local network, and no traffic can be exchanged using private IP address.

Knowing about private IP address, now let us understanding the purpose of NAT:

Consider you have internet provided by an Internet Service Provider ABC. They will provide a connection to your router and that connection is configured with a public IP address. Then, your LAN side of the router is configured with private IP addresses (ie.,) your computer or laptop connected to the network has a private IP address.

As per the standard, private IP will not communicate with a public IP at any point of time.

Therefore, to achieve the communication, private IP address needs to be translated into a public IP address with the help of NAT. Thus, NAT hides the private IP, increasing network security.

In simple words, Network Address Translation (NAT) is used to translate private IP address to public IP address to make the communication happen between the LAN side of the device and the global network.

As I am going to use the term data packet, spend few seconds in reading what is a data packet?

Note: A data packet is a unit of data made into a single package that travels along a given network path. A data packet consist of two portions: the header and the payload. The header contains the information about the packet, such as its origin and destination IP addresses. The payload is the actual data.

In simple words, the request to some contents and the response for the request are referred as data packets.

SNAT -Source Network Address Translation:

It is used when an internal/private host needs to initiate a connection to an external/public host. The device basically, a router performing the NAT changes the private IP address of the source host to public IP address.

For example, I am searching google.com in my computer which is assigned with a private IP by the router, my search request (data packets) first reaches the router gets my private IP translated into a public IP and then hits the ISP.

Basically in SNAT, NAT process is done until the request data packets reaches the ISP.

SNAT -Source Network Address Translation

DNAT -Destination Network Address Translation:

It is used to redirect the incoming data packets with a destination of a public address/port to a private IP address/port inside your network.

For example, Considering the above example, the other way, the response to my request, the response contents (data packets) from the ISP it first reaches the router, the router identifies the exact private IP which requested the data and delivers it.

DNAT -Destination Network Address Translation

PAT -Port Address Translation:

PAT is an extension to NAT that permits multiple devices on a local area network(LAN) to be mapped to a single public IP address. The goal of PAT is to conserve IP addresses.

Most home networks use PAT. In such a scenario, the ISP assigns a single IP address to the home network’s router. When Computer X logs on the Internet, the router assigns the client a port number, which is appended to the private IP address. This, in effect, gives Computer X a unique address. If Computer Z logs on the Internet at the same time, the router assigns it the same private IP address with a different port number. Although both computers are sharing the same public IP address and accessing the Internet at the same time, the router knows the exact client to send specific data packets because each computer has a unique internal address.

Hey! I am Tejaswini Appollo,

I hope everyone had some insights about NAT in this post and found it useful.

Images from TechTerms, GeeksForGeeks and GeekFlare.

Thank you :)

--

--