DEV Community

Cover image for How the Internet Actually Works, Explained Like a Condo
H. Abds
H. Abds

Posted on AI-assisted

How the Internet Actually Works, Explained Like a Condo

There's one question every family has a "tech person" for:

"Why is the internet not working?"

And honestly? Most of us never learn how any of this works. It's just magic.

You open your laptop, the Wi-Fi icon lights up, and YouTube appears.

So let's fix that. No exam, no scary diagrams. Just a condo, a guardhouse, and a few commands you can try on your own laptop while reading.

Ready? Let's take a tour.


Part 1: The condo

Every device has its own address

Every device on a network needs an address so other devices know where to send things. That's an IP address.

It looks something like this:

192.168.1.23
Enter fullscreen mode Exit fullscreen mode

Four numbers separated by dots, each between 0 and 255.

Network people call each of those numbers an octet, because behind the scenes each one is 8 bits (8 ones and zeros), and 8 bits can only count from 0 to 255.

That's it. Your laptop has one. Your phone has one. Your smart TV that keeps asking for updates has one too.

👉 Try it yourself

Open a terminal (on Windows, search for "Command Prompt". On Mac, open "Terminal") and type:

Your computer Command
Windows ipconfig
Mac ipconfig getifaddr en0
Linux ip addr

On Windows, look for the line that says IPv4 Address. It usually starts with 192.168 or 10.

Mac users: en0 is the Wi-Fi card on most laptops, but not all. If that command prints nothing, try en1, or just run ifconfig | grep "inet " and pick the address starting with 192.168 or 10.

That's the address of this one device, the laptop you're typing on. Not your whole home, just this device.

Keep that in mind, because it matters in a second.

Two things you can safely ignore for now:

  • 127.0.0.1 is your computer's way of talking to itself. Every computer has it.
  • Long addresses full of colons, like fe80::1c2b:..., are IPv6, the newer version of IP addresses. That's a story for another day.

Your router is the guardhouse

Now here's the interesting part. That address you just found?

Nobody outside your home can see it.

Think of your home network as a condo. Every device is its own unit inside:

  • your laptop is unit 23
  • your phone is unit 12
  • the smart TV is unit 47

The condo has a guardhouse at the entrance.

When you order something online, the courier never sees "unit 23". They only know the condo's street address.

The guard keeps a logbook of who ordered what. When the parcel shows up at the gate, the guard checks the book and sends it to the right unit.

A parcel that nobody ordered? Turned away at the gate.

Your router is that guard.

  • Inside your home, every device gets its own private address (like 192.168.1.23). These are the unit numbers.
  • To the rest of the internet, all your devices share one public address. That's the condo's street address.

When your laptop asks for a YouTube video, the router notes down "unit 23 asked for this" and sends the request out under the shared public address. When the video comes back, it delivers it to the right unit.

This trick is called NAT (network address translation). Fancy name, simple idea.

👉 Try it yourself

Open ifconfig.me in your browser. That's your public address, the one the outside world sees.

Notice it's completely different from the one ipconfig showed you? Now you know why.

If it shows a long address with colons, that's your IPv6 address. Totally normal.

DNS is your phone's contact list

Quick question: what's your best friend's phone number?

You probably don't know. You just tap their name in your contacts, and your phone handles the number.

Computers work the same way. They only talk in IP addresses, but humans prefer names like google.com.

DNS (Domain Name System) is the giant contact list that turns names into addresses.

Every time you type a website name, your computer quietly asks a DNS server: "Hey, what's the number for google.com?" It gets an answer, then connects to that number.

👉 Try it yourself

On Windows and Mac, this works out of the box:

nslookup google.com
Enter fullscreen mode Exit fullscreen mode

Linux users: nslookup often isn't installed by default. Either install it (dnsutils on Debian/Ubuntu, bind-utils on Fedora), or use what's already there: resolvectl query google.com on most modern systems.

The first couple of lines show which DNS server answered you (often your own router). Don't mix those up.

Google's addresses are the ones further down, after the line Name: google.com. That's Google's "phone number".

You might get a different one than your friend does. Big websites have lots of servers, and DNS often points you to one nearby.

Ports are the counters inside an office

So your request reaches the right address. But a big server does many jobs at once: websites, email, file transfers.

How does it know which job your request is for?

Now think of that server as a big government office with numbered counters. Counter 1 for passports, counter 2 for licences, counter 3 for complaints. Same office, different counters.

Those counters are ports. A few famous ones:

Port What usually lives there
80 Websites (old, unencrypted HTTP)
443 Websites (secure HTTPS, the padlock in your browser)
22 SSH, for logging into servers remotely
53 DNS, the contact list from earlier

When you open https://google.com, your browser is really saying:

"Office at Google's IP address, counter 443 please."

Ping is just asking "you there?"

Data travels across the internet in small chunks called packets. Think of them as parcels.

A big video gets split into thousands of small parcels, sent separately, and put back together on your side.

The simplest test in networking is sending a tiny parcel and waiting for a reply. That's ping.

👉 Try it yourself

ping google.com
Enter fullscreen mode Exit fullscreen mode

On Windows, you'll see lines like this (Mac and Linux look slightly different, but show the same time=):

Reply from 142.250.4.100: bytes=32 time=14ms TTL=117
Enter fullscreen mode Exit fullscreen mode

That time=14ms is how long the round trip took, in milliseconds. Lower is better.

Under 50ms feels snappy. Gamers care about this number a lot.

Windows stops after 4 tries. On Mac and Linux, ping keeps going forever. Press Ctrl + C to stop it.

One catch worth knowing now, because it saves hours later: some servers are configured to ignore ping completely.

A timed-out ping doesn't always mean the server is down. Sometimes it just means it was told not to answer knocks.

That's exactly why the checklist below pings 1.1.1.1, which always replies.


Part 2: A little deeper

You now know more networking than most people. Let's go one step further, into the stuff that actually helps when things break.

"Connection refused" vs "timed out"

Sometimes a connection fails, and you'll see one of two errors. They sound similar, but they mean very different things.

Back to the government office with counters:

Connection refused: you walk in, go to counter 8080, and there's a "CLOSED" sign.

You got an answer straight away. The office exists and you reached it. There's just nobody working at that counter (no app listening on that port).

Timed out: you wait outside and... nothing. Nobody says yes, nobody says no.

Maybe the guard at the gate quietly didn't let you in. Maybe you have the wrong address. Something along the way swallowed your request.

So:

  • "Refused" means the problem is at the destination.
  • "Timed out" means the problem is somewhere on the way there, very often a firewall.

Just knowing which one you got cuts your detective work in half.

Why website changes "take time to update"

If you ever move a website to a new server, you'll notice something annoying: some people see the new site, and some still see the old one for hours.

Remember the contact list? Here's the twist.

To save time, computers and DNS servers remember the answers they get for a while, instead of asking every single time.

How long they remember is set by the domain owner, and it's called the TTL (time to live), counted in seconds.

Yes, the ping output earlier also had a TTL. Same name, different job. That one counts how many hops a packet may take before it's thrown away. You can ignore it for now.

If the TTL says 3600, everyone who looked up your site recently may keep using the old address for up to an hour.

Nothing is broken. Everyone is just using their saved copy until it expires.

Pro tip for later: if you know you'll be moving a website, lower the TTL a day before the move. Then everyone's saved copy expires quickly when you switch.

The 169.254 surprise

Here's a fun one to remember. If you check your address and it starts with 169.254, that's your computer saying:

"I asked the router for an address and nobody answered, so I made one up myself."

It's like moving into a condo where the guard never gave you a unit number, so you wrote one on your own door. Nobody else knows it, so nothing works.

When you see 169.254, the problem is between your device and the router. Restart the router, reconnect the Wi-Fi, or check the cable.

Don't waste time blaming the website.

How to answer "why is the internet not working?"

This is the habit that network people use every day, and now you can too.

Start from the closest thing and move outward. Stop at the first step that fails, because that's where your problem is.

Step 1: Does my device have a unit number?

Run ipconfig on Windows, ipconfig getifaddr en0 on Mac, or ip addr on Linux.

No address, or a 169.254 one? The problem is your Wi-Fi or cable.

Step 2: Can I reach the guardhouse?

That's your router's address. To find it:

  • Windows: the "Default Gateway" line in ipconfig (usually something like 192.168.1.1)
  • Linux: run ip route and look after the word default via
  • Mac: run route -n get default and look at gateway

Then ping it. No reply? The problem is between you and the router.

Step 3: Can I reach the outside world?

Run ping 1.1.1.1. That's a well known public address, no names involved.

No reply? Your router or your internet provider is having a bad day.

Step 4: Does the contact list work?

Run nslookup google.com (or resolvectl query google.com on Linux).

If step 3 worked but this one fails, it's a DNS problem. A common fix is switching your DNS server to 1.1.1.1 or 8.8.8.8 in your network settings.

Step 5: Is it just one website?

If everything above works and only one site won't load, the problem is probably that website, not you.

Go make a drink.

Professionals call this "troubleshooting from the bottom up". I just call it not restarting your laptop five times for nothing.


Your cheat sheet

Thing Condo version Command to see it
Private IP Your device's unit number ipconfig / ip addr
Public IP The condo's street address visit ifconfig.me
Router The guardhouse Default Gateway (see step 2)
DNS Your phone's contact list nslookup google.com
Port Counter number inside an office 443 for secure websites
Ping "You there?" ping google.com

All the short forms in one place

Short form Stands for In plain words
DHCP Dynamic Host Configuration Protocol How your router hands out unit numbers to devices automatically. When this fails, you get a 169.254 address.
DNS Domain Name System The internet's contact list. Turns names like google.com into IP addresses.
HTTP HyperText Transfer Protocol The language your browser and websites use to talk to each other.
HTTPS HTTP Secure The same thing, but encrypted. That's the padlock in your browser.
ICMP Internet Control Message Protocol The small "are you there?" messages that ping uses.
IP Internet Protocol The rules for addressing and delivering data. An "IP address" is a device's address under those rules.
IPv4 Internet Protocol version 4 The classic address style with four numbers, like 192.168.1.23.
IPv6 Internet Protocol version 6 The newer, much longer style with colons, made because the world ran out of IPv4 addresses.
ms millisecond One thousandth of a second. Used to measure ping time.
NAT Network Address Translation What your router does so all your devices can share one public address.
SSH Secure Shell A safe way to log into another computer and type commands on it remotely.
TTL Time To Live In DNS: how many seconds an answer may be remembered. In ping: how many hops a packet may take before it's thrown away.
VPN Virtual Private Network An encrypted tunnel between your device and another network.

That's the foundation. Everything else in networking (subnets, VPNs, firewalls) is built on top of these few ideas.

Once the condo makes sense, everything else is just learning your way around the city.

Next time the Wi-Fi acts up, you'll know exactly where to start looking.

Top comments (0)