What is DHCP and NAT?

First of all….

Before starting the main topic…

We need to study.. a little bit of

  • Ipv4
  • Ipv6
  • Public IP
  • Private IP

Ipv4

Everyone is familiar with this….

No need to explain LOL!

Anyways it was already explained in an article about ip.

 

Ipv6

Now as you can see that… Ipv4 has 4 octets of binary…

In simple words…

We were pretty much limited

By the range of ipv4….

In the beginning, it seemed that too many ips can be formed by that limit…

But as the growth of internet…

We had a shortage of IP addresses!!..

So a new concept of ipv6 was introduced.

In which instead of using few numbers like in ipv4 …

Alphabets were to be used with a mixture of… Numbers…

As shown in the photo.

But but but…

As you can identify that ipv4 looks much good and easy than ipv6 (it looks complex!)

Everyone wanted to stick to ipv4..

But there was a shortage if ips!!

Now, what to do?🤷🏻‍♂

Then came the concept of public and private ip….

Public IP and private IP ❣

Then came another concept…

That .. what if a group of devices could share the same IP?🤔

Let’s take an example to understand this..

I have a router and 2 mobile phones…

I switch on the router…

The isp provides it an IP address to my router💡 (This concept is discussed in the previous article)

Now I connect my w mobile phones with the router….

Now, wait…

Did router get IP from the ISP? RIGHT?

IP:- aa.aa.aa.aaa (router) (public ip)

Now my 2 mobile phones will also get ip address..

But but but!!!

My phones will get its ip addressed from the ROUTER!

Not the ISP!

IP :- bb.bb.bb.bbb (mobile 1)(private ip)

IP:- cc.cc.cc.ccc (mobile 2) (private ip)

The range of private ip address is only till the router!….

Its not for the world!

Put a public ip can communicate throughout the world!…..

Sooooooooooo….

What that means is….💡

In the world lets assume..

@Keshavi turns on the data connection on the mobile phone ( somewhere in the world)

It is preety much possible that she is assingned with the ip address of

bb.bb.bb.bbb (public ip)

Now this is a public ip!

And my mobile 1 was also having the same ip…

But not for the world!…

Only for my router

Now the main topic…

DHCP

When i connected my phone with router….

My router provided me private ip addresses!?

So… Actually..

My router is DHCP enabled..

Nowerdays every router is DHCP enabled…💡

So the work of assigning private IP to devices…

Is the work of “DHCP”

AS SIMPLE AS THAT?🤷🏻‍♂

Next..

NAT

NAT …

This is more important than DHCP..

Anyways

..

By all this public and private stuff…

Dont you think that router might get confused?

Lol no😂..

All this is handled by NAT..

If i am using my mobile 1..

And i opens facebook..

Its the NAT who recives that request and then

forwards it to the facebook server by using the ip address of Router. Because its public!

Now when the router gets responce by facebook…

NAT is the one who knows that Mobile 1 requested for facebook ..

And the data will be forwarded to mobile 1.

Leave a Reply

Your email address will not be published. Required fields are marked *