roxxhub

Network address translation (NAT)

Definition

Network address translation (NAT) is technique used for mapping an IP address to many devices.

Purpose

As many of you might know every device today, connected to the internet , has an IP address assigned to it. The version we are currently using is version 4. So it is called ipv4 address. An ipv4 address is a 32 bit notation. with 4 different 8 bit numbers separated with a dot ‘ . ‘. The number in each of the 4 fields is represented by its decimal form. For example –

01100100.00000010.00000011.00001010             is an ipv4 address
Its got 4 separated fields, each with an 8 bit binary number.
But this is usually presented in the decimal form-
100.2.3.10          

Here is a converter

Now you might also remember that the number of ‘numbers’ that can be presented by an 8 bit binary number is 256, which is 0 to 255. This means each field can have only 256 different numbers. and this also means that there are 4.29 billion possible number of ipv4 addresses in the world !

When ipv4 was invented ( somewhere in 1981), scientists thought 4.29 billion is big number, and it would never get exhausted as the number of devices connected to the internet can’t be bigger than that. But obviously they were wrong . As of today more than 5.09 billion people are using internet.

Now you might be wondering if there are almost 5.09 Billion devices which are supposed to be connected to the internet today, ipv4 must have exhausted . But surprisingly it has not.

And this is where NAT comes into play.

Although there is a new version of IP called ipv6. which uses 128-bit (2128) addresses, allowing 3.4 x 1038 unique IP addresses. It is still not widely adapted as every network on earth has been designed according to ipv4.

How NAT works ?

You must have seen most of times , when you try to look at your computer’s / phone ip address its mostly 192 point 169 point something point something. Is that your device’s ip address which other devices on earth see? NO.

To understand NAT you first need to know about some reserved ip address which can’t be used –

  • 10.0.0.0/8 ( Range: 10.0.0.0 – 10.255.255.255 )
  • 172.16.0.0/12 ( Range: 172.16.0.0 – 172.31.255.255 )
  • 192.168.0.0/16 ( Range: 192.168.0.0 – 192.168.255.255 )

These are some ip address which aren’t meant for connecting devices to the internet. They can be only used inside a network. They are also called non routable address space.

Lets say you have 2 computers in your home. Both of these get wifi using a router. Or maybe a they get wifi by your phone’s hotspot. Lets call this your home network.

Now when you check the ip of each computer you’ll see the fall under the reserved ip space. They don’t have any public ip. Well Actually you are using only 1 public ip address which is assigned to your router / phone.

NAT

Now if I want to search something on google from my computer 2, the router would translate its private ip( 192.168.69.69) to the public ip address assigned to my router / network (104.12.1.98) by the internet service provider (isp) and send the request to google. when the response comes back. the router translated the public ip to the private ip and sends the data to computer 2. This translation is called NAT

So you can say the devices outside your network assume your network as a single device as it only has 1 ip.

This way two or more devices use only one ip address to connect to the internet. This helps preventing ipv4 address wastage and also is a good way of ensuring security.

1 thought on “Network address translation (NAT)”

  1. What¦s Going down i’m new to this, I stumbled upon this I have found It absolutely useful and it has aided me out loads. I am hoping to give a contribution & help other users like its helped me. Good job.

Comments are closed.