Skip to main content

Command Palette

Search for a command to run...

Why Every Device Doesn’t Need a Public IP Address

Updated
6 min read
Why Every Device Doesn’t Need a Public IP Address

When I first started learning networking, IP addresses felt extremely confusing.

People kept talking about:

  • IPv4,

  • subnet masks,

  • NAT,

  • DHCP,

  • ports,

  • public vs private IPs,

and honestly it all felt like random technical words.

But recently I started understanding networking differently.

Instead of memorizing definitions, I started asking:

“Why were these technologies invented?”

And slowly things started connecting together.


The Internet Needed Addresses for Devices

Imagine trying to deliver food in a city where no house has an address.

Impossible.

The internet had the same problem.

If devices wanted to communicate, they needed identities.

That identity became known as:

IP Address


IPv4 — The Old Address System of the Internet

The most common internet addressing system is:

IPv4

IPv4 addresses look something like this:

192.168.0.1

Behind the scenes, IPv4 is actually made using:

32 bits

The address is divided into:

  • 4 parts,

  • each part contains 8 bits.

That’s why each number ranges from:

0 → 255

because:

11111111 = 255

Why IPv4 Addresses Started Running Out

The internet exploded.

Suddenly we had:

  • phones,

  • laptops,

  • smart TVs,

  • routers,

  • servers,

  • IoT devices.

But IPv4 only supports:

2^32 approx 4.3 billion addresses

Which sounded huge earlier…

but became very small for the modern internet.

That’s why researchers later created:

IPv6

which supports a massive number of addresses.


Then I Learned Something Interesting

Even though IPv4 addresses are limited…

we still heavily use IPv4 today.

At first this confused me.

Then I learned about:

  • private IP addresses,

  • NAT,

  • CGNAT.

And suddenly everything made sense.


Private IP Addresses

Not every device on Earth needs a globally unique public IP.

Inside homes, offices, and schools, devices use:

Private IP Addresses

Examples:

192.168.x.x
10.x.x.x
172.16.x.x

These work only inside local networks.

That’s why sharing your WiFi IP usually isn’t dangerous.

Because private IPs are not directly exposed to the internet.


Our Router Is Basically A Small Network Manager

This realization changed how I see routers.

A router:

  • creates local networks,

  • assigns IP addresses,

  • manages traffic between devices.

Usually routers use:

DHCP

(Dynamic Host Configuration Protocol)

DHCP automatically gives devices IP addresses when they connect.

Example:

  • phone joins WiFi,

  • router assigns IP automatically.

No manual setup needed.


Dynamic vs Static IP

Most devices use:

Dynamic IP

which means:

  • router assigns IP automatically,

  • IP can change later.

But sometimes devices need permanent addresses.

Example:

  • servers,

  • printers,

  • CCTV systems.

Then we use:

Static IP

which is manually assigned.


Then I Learned Why IP Conflicts Happen

Suppose router dynamically assigns:

192.168.0.100

to one device.

But I manually assign the same IP to another device.

Now both devices claim:

“I own this address.”

Chaos happens.

That’s called:

IP Conflict

Which is why routers usually reserve specific ranges for DHCP assignment.


Subnet Mask Finally Started Making Sense

Subnet mask sounded terrifying earlier.

But it’s actually just a way to separate:

  • network portion,

  • device portion.

Example:

192.168.1.10/24

The:

/24

means:

  • first 24 bits belong to network,

  • remaining bits belong to devices.

This system helps routers understand:

which devices belong to same network.


Then I Learned About NAT

This was the biggest breakthrough in my understanding.

Earlier I thought:

every device gets its own public internet address.

Wrong.

Usually:

  • devices inside home use private IPs,

  • only router uses public IP.

This process is called:

NAT (Network Address Translation)

Example:

Laptop → Router → Internet

The router:

  • replaces private IP with public IP,

  • sends request to internet,

  • remembers which device made request,

  • sends response back correctly.

Which means:

thousands of private devices can share one public IP.

That’s genius honestly.


Then ISPs Took It Even Further — CGNAT

IPv4 shortage became so severe that ISPs started sharing public IPs too.

This is called:

CGNAT (Carrier Grade NAT)

Now the flow often looks like this:

Device
   ↓
Home Router (Private IP)
   ↓
ISP Router (Shared Public IP)
   ↓
Internet

Which means:

  • even home routers may not get true public IPs anymore.

That explained why hosting servers from home sometimes becomes difficult.


Public vs Private IP Finally Clicked

Public IP

  • visible on internet,

  • globally reachable,

  • used for websites and servers.

Private IP

  • works only inside local networks,

  • safer,

  • reusable.

Without private IPs and NAT:

IPv4 would have died much earlier.


Then I Learned About Ports

One thing confused me:

If one public IP exists…

how can multiple apps work simultaneously?

Example:

  • browser,

  • Discord,

  • game,

  • local server.

Answer:

Ports

Ports are basically communication doors.

Examples:

  • HTTP → 80

  • HTTPS → 443

  • Dev servers → 3000, 5500, 8080

So one IP can run many services using different ports.


Turning Laptop Into Public Server

This part felt magical.

Normally local servers work only inside LAN.

Example:

192.168.0.5:5500

But with:

  • public IP,

  • port forwarding,

  • router configuration,

our laptop can become internet-accessible.


Port Forwarding

Port forwarding tells router:

“If internet traffic comes on this port, send it to this local device.”

Example:

Public IP:5500
      ↓
Router
      ↓
Laptop:5500

Now anyone with:

  • public IP,

  • correct port

can access the server.

That’s literally how hosting works at a basic level.


Running Multiple Servers

One laptop can run many servers simultaneously.

Example:

123.45.67.89:3000
123.45.67.89:5500
123.45.67.89:8080

Different ports = different services.


Then DNS Makes Everything Human Friendly

Imagine remembering:

123.45.67.89:5500

for every website.

Impossible.

So DNS maps human-readable names to IPs.

Example:

mywebsite.com

instead of raw IP addresses.

That’s what makes the web usable for humans.


Biggest Realization While Learning Networking

Earlier networking felt like:

  • random protocols,

  • random numbers,

  • confusing definitions.

Now I’m slowly seeing the actual flow:

Device
   ↓
Private IP
   ↓
Router
   ↓
NAT / CGNAT
   ↓
Public Internet
   ↓
Server

And honestly…

once you start visualizing the flow, networking becomes way less scary.


Final Thoughts

The deeper I learn networking, the more I realize:

The internet is basically billions of devices communicating through addresses, ports, routers, and agreed rules.

And technologies like:

  • NAT,

  • DHCP,

  • subnetting,

  • DNS,

  • port forwarding

exist because humans kept solving scalability problems step by step.

Which honestly makes networking much more interesting than just memorizing commands.