DEV Community

Aisalkyn Aidarova
Aisalkyn Aidarova

Posted on

Network basics

1️⃣ What Is a MAC Address? (Inside Your House Only)

Image

Image

Image

Image

Think of MAC like:

Your apartment number inside a building.

  • Every device has a MAC address.
  • It never leaves your house.
  • Switch uses MAC addresses.

Example:

Laptop MAC:

AA:BB:CC:DD:EE:FF
Enter fullscreen mode Exit fullscreen mode

Used only in local network (LAN).


2️⃣ What Is an IP Address? (Street Address)

Image

Image

Image

Image

Think of IP like:

Your home street address.

Example:

Private IP (inside home):

192.168.1.10
Enter fullscreen mode Exit fullscreen mode

Public IP (visible on internet):

73.54.20.11
Enter fullscreen mode Exit fullscreen mode

3️⃣ Why Do We Need Private and Public IP?

Simple reason:

If every phone and laptop in the world had public IP —
👉 We would run out.

So we use:

  • Private IP → inside home
  • Public IP → router uses this for internet

Your router translates using NAT.


4️⃣ What Is a Switch? (Inside the House)

Image

Image

Image

Image

Switch:

  • Connects devices inside same network
  • Uses MAC addresses
  • Does NOT connect to internet

Example:
Laptop ↔ Printer ↔ Desktop


5️⃣ What Is a Router? (Door to the Internet)

Image

Image

Image

Image

Router:

  • Connects your home to internet
  • Has:

    • Private IP (inside)
    • Public IP (outside)
  • Makes decisions where to send traffic

Router = your house door.


6️⃣ What Happens When You Type google.com?

Now the fun part.


Step 1 — DNS (Find Google’s Address)

Image

Image

Image

Image

You type:

google.com
Enter fullscreen mode Exit fullscreen mode

Computer asks:

👉 “What is Google’s IP?”

DNS replies:

142.250.190.78
Enter fullscreen mode Exit fullscreen mode

Now computer knows where Google lives.


Step 2 — Send to Router

Image

Image

Image

Image

Laptop sees:

Google is NOT inside my home network.

So it sends packet to:

Default Gateway (Router)
Enter fullscreen mode Exit fullscreen mode

Before sending:
Laptop asks:

Who is 192.168.1.1?

Router replies with MAC.


Step 3 — NAT Happens

Image

Image

Image

Image

Router changes:

192.168.1.10
→ 73.54.20.11
Enter fullscreen mode Exit fullscreen mode

Now packet goes to internet.


Step 4 — The HOPS (Very Important)

Image

Image

Image

Image

Each time packet moves from one router to another =

👉 One HOP

Example:

Hop 1 → Home Router
Hop 2 → ISP Router
Hop 3 → Regional Router
Hop 4 → Backbone Router
Hop 5 → Google Router
Enter fullscreen mode Exit fullscreen mode

You can see this using:

On Mac/Linux:

traceroute google.com
Enter fullscreen mode Exit fullscreen mode

On Windows:

tracert google.com
Enter fullscreen mode Exit fullscreen mode

Each line = one hop.


Step 5 — Google Receives Packet

Image

Image

Image

Image

Google server receives request.

Google sends response back.

Response follows same path backward.

Router uses NAT table to send back to correct laptop.

Page loads.


Full Beginner Flow (Very Simple)

1. Type google.com
2. DNS finds IP
3. Laptop sends to router
4. Router changes private IP to public IP
5. Packet travels through many routers (hops)
6. Google responds
7. Response returns to laptop
8. Page opens
Enter fullscreen mode Exit fullscreen mode

Simple Real-Life Analogy

Think like sending a letter:

  • MAC → Apartment number
  • IP → Street address
  • Router → Post office
  • DNS → Phonebook
  • Hops → Postal centers
  • Google → Company office

Top comments (0)