Skip to main content

Command Palette

Search for a command to run...

👉 What Really Happens When You Type a URL in Your Browser?

A beginner-friendly explanation of DNS, IP addresses, ports, NAT, and HTTPS using a simple biryani analogy 🍛

Published
7 min read

The internet has taken over the world. Almost everything today runs through networks. Enterprises host their applications on the web, and users access them through browsers or mobile apps.

You type https://www.BadriRestaurent.com/, press Enter, and a page appears.

But behind that one action is a beautifully chaotic chain of events involving IP addresses, ports, routers, ISPs, DNS, NAT, and security protocols.

Let’s break it down in the simplest way possible — using a biryani analogy 🍛.


1. Client and Server: The Biryani Story

Imagine Syam.

Syam is hungry and wants biryani. He doesn’t know how to cook it himself. In the world of computers, Syam represents a client — a device or application that requests something.

Inside his apartment (which we’ll treat as the same network), there is a guy named Badri who knows how to cook excellent biryani. Badri represents a server — a system that provides a service when requested.

Flow (Real-world mapping)

  1. Syam requests biryani → Client sends a request

  2. Badri prepares it → Server processes the request

  3. Badri serves it → Server sends a response

This request–response model is the foundation of how applications communicate over a network.


2. The Identity Problem: Who Is the Real Badri?

My Post Kazoo Kid GIF

What if there are two people named Badri in the same apartment?

Syam might ask for biryani and end up at the wrong door. Computers face the same problem on a network.

Solution: IP Addresses

To solve this, we give everyone in the apartment complex a unique identity called an IP Address. For reference, imagine there are four people in the building, numbered 1, 2, 3, and 4. If #1 wants biryani and knows #3 is the chef, #1 sends a request specifically to #3. Problem solved.

Example

PersonIdentity (IP)
Syam1
Manojh2
Badri3
Rama Krishna4

Now Syam (1) can confidently send his request to Badri (3), without confusion.

This same principle applies to computers communicating over a network.


3. Ports: Which Door Should You Knock On?

Now, let's add a twist. Imagine every person has many "hands" (labeled H1, H2, ... up to H65,535). These hands are called Ports.

If Badri (Person 3) is serving biryani from Hand 3 (H3), Syam must reach out to that specific hand. If Syam tries to grab food from H10, he might get pasta instead or nothing at all! To receive the food, Syam can use any of his own available "hands" to take the plate.

In networking, these hands are called ports. A port tells the system which application or service should handle the request.

Real-world mapping

  • Each system has 65,535 ports

  • Web servers, databases, and mail servers listen on specific ports

  • A client must connect to the correct port to get the expected response


Meme Break 😆


4. Protocols: Speaking the Same Language

Even if Syam and Badri live in the same building, they need a common language to communicate. These "languages" are Protocols like HTTP, TCP, or SMTP.

If Badri serves biryani on H3 but only accepts requests in Hindi, Syam cannot ask for it in Italian. If Badri serves pasta on H10 and requires an Italian request, Syam must adapt. In networking, the client must use the specific protocol the server understands to get the job done.


5. What If the Server Is Far Away?

Now Badri lives:

  • In another city

  • Another country

  • Another continent

How does Syam reach him?

Welcome to the internet 🌍.


6. IPv4 and the Address Shortage Problem

IPv4 addresses look like this:

28.28.28.28

Each block ranges from 0–255.

Total possible addresses:

256 × 256 × 256 × 256 ≈ 4.3 billion

Which is not enough.

So we invented:

  • Subnetting

  • NAT

  • Private IPs


7. Routers and ISPs: The Middlemen

Let’s introduce some new characters.

  • Nandini → ISP

  • Rohit → Router

Nandini: The Internet Service Provider (ISP)

Think of Nandini as the local telecommunications dealer or the apartment complex manager. She owns a large "block" of addresses (an IP range like 10.1.1.0/16) (manage multiple apartments ) and is responsible for connecting Syam’s home to the rest of the world.

Rohit: The Router (The Mediator)

Nandini can't talk to every single device(Syam) personally, so she appoints Rohit the Router to act as the mediator for Syam’s apartment. Rohit has two main jobs:

  1. DHCP (The Badge Maker): When Syam joins the network, Rohit automatically assigns him a temporary ID (an IP address) from his pool using the DHCP protocol.

  2. Subnetting: Rohit creates a smaller, private network within the apartment so everyone inside can communicate easily.


Diagram: Home Network


8. NAT: Lying for a Good Cause 😌

This is the most critical part. Syam (192.168.0.1) wants to reach Badri, who is far away at 45.55.33.34.

  1. The Request: Syam sends the request to Rohit.

  2. The Translation (NAT): Rohit sees that Badri is outside the building. Rohit notes this in a "ledger" (Table): "Syam asked for Badri."

  3. Sending Out: Rohit sends the request to Nandini (ISP) using his own ID (10.1.1.45).

  4. The ISP Level: Nandini receives it. She also performs Network Address Translation (NAT). She replaces Rohit's ID with her own Public IP (47.23.33.43)—a unique ID that the whole world can see—and sends it to Badri.

Why do we do this? Because Syam's IP (192.168.0.1) is private. It's not unique; millions of apartments use that same number inside their walls. But Nandini's Public IP is unique globally. Badri replies to Nandini, Nandini checks her ledger and passes it to Rohit, and Rohit passes the Biryani to Syam.


Meme Break 😂

NAT: I’ll take it from here

Client: Wait… who are you?


9. Public IPs: Being Visible to the World

To be reachable from the internet:

  • Badri needs a public IP

  • ISP needs a public IP

Example:

  • Badri: 45.55.33.34

  • ISP: 47.23.33.43

Only public IPs are globally routable.


10. DNS: Because No One Remembers IPs

We have the connection working, but there are two final problems to solve.

DNS: The Phonebook

Syam cannot remember that Badri lives at 45.55.33.34. Humans are bad at memorizing numbers.

To solve this, Badri buys a Domain Name like www.BadriRestaurant.com. He maps his Public IP to this name. This information is distributed to DNS Servers (the internet's phonebook). Now, when Syam types the website name:

  1. The browser asks the DNS server: "Where is https://www.google.com/search?q=BadriRestaurant.com?"

  2. The DNS server replies: "It's at 45.55.33.34."

  3. The browser connects to the IP.


11. Default Ports: The Invisible Detail

Why didn’t you type a port?

Because defaults exist:

ProtocolPort
HTTP80
HTTPS443

Browser already knows this.


12. Security: Why HTTPS Exists 🔐

Throughout this story, Rohit and Nandini are handling the messages. Technically, they could open the package and see what Syam is ordering (or steal his credit card info!).

To prevent this, we use HTTPS with TLS. This encrypts the data. It puts the Biryani in a locked steel box. Rohit and Nandini pass the box along, but they cannot open it. Only Syam and Badri have the keys to unlock it.


Final Meme 😎


Final Thoughts

When you type a URL into your browser, you trigger a surprisingly complex journey.

Behind the scenes:

  • DNS translates names into IP addresses

  • Routers and ISPs move packets across networks

  • NAT enables millions of devices to share limited IPs

  • Ports and protocols ensure the request reaches the right application

  • HTTPS encrypts everything to keep data safe

All of this happens in milliseconds — every single time you load a webpage.

Understanding this flow is essential if you are learning networking, backend development, DevOps, or Site Reliability Engineering (SRE).


What’s Next?

If you found this helpful, here are some great topics to explore next:

  • DNS Deep Dive — How browsers really resolve domain names

  • NAT vs PAT — How millions of devices share a few IP addresses

  • HTTP vs HTTPS — What changes when encryption is added

  • TLS Handshake — How secure connections are established

  • CDNs Explained — Why websites load fast from anywhere in the world

These topics will be covered step-by-step as part of the Packets to Production series on DevOps Grandline.

Follow the blog to continue the journey from fundamentals to production systems.

Stay curious, and keep exploring how the internet really works. 🚀