ยท 18 min read

OSI and TCP/IP Model: The Foundation of Networks

science compsci cybersec

Hello World! Welcome to Fisholophy, this is a technical writing, so lets keep the distractions minimum and try to understand the mind-blowing technology behind how the internet works.

The Hook

You text your friends, always, but have you ever felt the curiousity to know how it actually arrives to your machine? ... Like, instantly? Across cities, countries, continents, oceans?

Have you ever wondered how you can sit in Kathmandu, type "lol" to your friend in New York, and that "lol" travels across the entire planet in less than a second? How does a tiny message from YOUR phone know where to go? How does it survive the journey across thousands of miles of cables, towers, satellites, and routers without getting lost?

Have you ever thought about how you can stream a video from a server in California while someone else in Tokyo is doing the exact same thing from the same server, and neither of you buffers? (Okay, sometimes you buffer, but that's your WiFi's fault, not the internet's.)

Like... HOW? How does any of this actually work? ๐Ÿคท

This isn't magic. This isn't witchcraft. This is networking. And the entire foundation of it sits on two models that you've probably never heard of but use every single second of every single day. Even if you have heard of it, this reading session might contribute to your current understanding so keep reading!

The OSI Model and the TCP/IP Model.

Boring names. World-changing concepts. Let's break them down so they actually make sense.

The Background

So here's what most people think the internet is.

You type something. You press send. It appears on someone else's screen. Done. Simple. Easy.

It's like flipping a light switch. You don't think about the wiring, the power grid, the transformers, the power plant. You just flip the switch and expect light. And honestly, that's fine. You don't NEED to know how it works to use it.

But for those of us who are even slightly curious (and if you're reading this, you are), what's happening behind that "send" button is genuinely one of the most beautiful systems humans have ever built.

Every message you send, every website you open, every video you stream, every meme you share... all of it follows a very specific set of rules. A system. A structure.

And that structure is built in layers. Like a cake. A very nerdy, very important cake.

The Illusion

But have you ever wondered why it needs layers at all?

Like, why can't your message just... go? Why does there need to be a whole system with multiple steps? Why can't your phone just yell your message into the void and hope it reaches the right person?

Well, imagine this. Imagine you're in a room with 8 billion people (the whole planet), and you need to whisper a specific message to ONE person on the other side of the room. No phone. No paper. Just your voice.

Chaos, right? Everyone's talking, nobody knows who's who, messages are getting lost, mixed up, delivered to the wrong person. Like a busy fish market. ๐Ÿ˜‚

THAT is what the internet would be without these models. Pure, beautiful, useless chaos.

The layers exist because sending data across the planet is absurdly complicated, and the only way to handle absurd complexity is to break it into smaller, manageable pieces. Each layer has ONE job. It does that job, passes the work to the next layer, and doesn't worry about anything else.

It's like a relay race. Each runner handles their stretch and passes the baton. No single runner needs to run the whole track.

Let's meet the runners, I mean, layers.

The Deep Dive

Okay, here's where we get into the good stuff. Let the technical yapping begin!

There are two models we need to talk about. Think of them as two different blueprints for the same building.
Firstly,

The OSI Model ( The Theoretical/Conceptual One)

OSI stands for Open Systems Interconnection. It was created in the 1980s as a universal framework for how network communication SHOULD work. Think of it as the "textbook" version. The ideal plan. The one that explains the internet as a clean stack of jobs instead of a beautiful mess of cables, packets, ports, and protocols.

It has 7 layers. Each layer handles a specific part of the communication process, and as data moves down the stack, it gets wrapped in more headers. That wrapping is called encapsulation. On the way down, data becomes segments, packets, frames, and finally bits. On the way back up, the receiver peels those layers off in reverse.

Let me break them down from top to bottom, because that's how YOU experience them.

Layer 7: Application Layer. This is what you actually touch. Your browser, email app, WhatsApp, Instagram, SSH client, DNS lookup, all of it lives here. HTTP, HTTPS, DNS, SMTP, IMAP, SSH, FTP, and SIP are all application-layer protocols. When you type a message and hit send, you're talking to this layer. It's the front door of the whole system.

Layer 6: Presentation Layer. This layer is like a translator with a security badge. It handles encryption and decryption, encoding, and compression so both sides agree on how the data should look. TLS/SSL usually gets talked about here because it protects things like HTTPS traffic from eavesdroppers and MITM attacks. It can also handle formats like UTF-8, JSON, JPEG, and gzip so the receiving application gets data in a language it understands.

Layer 5: Session Layer. This layer manages the conversation. It opens, maintains, and closes sessions so the two sides stay synchronized. Think of it like a phone call, but with checkpoints. If a connection drops, session state can help the application pick up where it left off instead of starting from zero. In practice, a lot of modern apps blur this layer with Layer 7, but the idea is still the same: keep the dialogue organized.

Layer 4: Transport Layer. This is the layer that makes sure your message arrives completely and correctly. It breaks data into segments, adds sequence numbers and checksums, and uses port numbers to send traffic to the right application. If the IP address is the building, the port is the room number. TCP is the reliable option: three-way handshake, acknowledgments, retransmission, flow control, the whole deal. UDP is the lightweight option: no handshake, no retries, just send it and move on. That is why TCP suits web pages, email, SSH, and file transfers, while UDP is happier with voice, streaming, and gaming.

Layer 3: Network Layer. THIS is the GPS of the internet. This layer figures out WHERE your message needs to go. It works with IP addresses, routing tables, packet forwarding, and protocols like IP and ICMP. Routers live here. So does TTL, the little hop counter that stops packets from wandering forever. This is the layer that decides whether your packet goes through 15 routers across 6 countries or finds a more boring path that still gets the job done.

Layer 2: Data Link Layer. This layer handles node-to-node delivery on the local network. It packages Layer 3 data into frames, uses MAC addresses for physical addressing, and checks for local transmission errors with things like the frame check sequence. Switches pay attention here because they forward frames based on MAC tables. Ethernet and Wi-Fi both live in this neighborhood. If Layer 3 is the GPS, Layer 2 is the neighborhood street map that gets you from your phone to the router first.

Layer 1: Physical Layer. This is the actual, physical stuff. Voltage, light pulses, radio waves, copper wire, fiber, antennas, repeaters, hubs, and the raw bits moving across the medium. Everything above is logic and rules. This layer is electricity and physics doing the heavy lifting. This is where your data stops being an idea and becomes energy traveling through the real world.

The TCP/IP Model (The Practical One)

Now, the OSI model is beautiful in theory. But in practice, the internet actually runs on the TCP/IP model. Think of OSI as the architect's dream drawing and TCP/IP as what the builders actually constructed. Same building, fewer labels, more reality.

TCP/IP simplifies things into 4 layers:

TCP/IP Layer What It Does OSI Equivalent
Application Everything you interact with, plus app protocols like HTTP, HTTPS, DNS, SSH, and SMTP Layers 7, 6, 5
Transport TCP and UDP, ports, reliability, sequencing, and delivery behavior Layer 4
Internet IP addressing, packet routing, ICMP diagnostics, and path selection Layer 3
Network Access Ethernet, Wi-Fi, MAC addressing, framing, and the physical medium Layers 2, 1

Basically, TCP/IP looked at OSI's 7 layers and said "we can do this in 4." And it worked. The entire internet you're using right now? TCP/IP. When your browser opens a site, it usually starts with DNS to find an IP address, then uses TCP on port 443 for HTTPS, and often rides on top of Ethernet or Wi-Fi underneath. One request, a stack of protocols.

So why do we still learn OSI? Because it's a better teaching tool. It separates each concept more clearly. Think of OSI as the detailed recipe with every step explained, and TCP/IP as the version your grandma uses where half the instructions are "just eyeball it." Both make the same dish. OSI is also why network people can diagnose problems so fast: can you ping the host? Layer 3 is alive. Can you connect to the port? Layer 4 is alive. Can you load the page but not log in? Now you are probably staring at Layer 7, a bad app, or a sad firewall.

The Brutal Truth

Okay, enough theory. Let's make this REAL with an actual example.

Let's say Sylvie is in Kathmandu, Nepal and she wants to send a message to her friend Jack in New York, USA.

She opens WhatsApp, types "Happy Birthday Jack! ๐ŸŽ‚", and hits send.

Here's what ACTUALLY happens in the next fraction of a second. Buckle up. Before the message even leaves the phone, the app may use DNS to find the server, then start a TLS connection over TCP so the traffic is encrypted and authenticated.

Step 1: The Application Layer. WhatsApp (the app) takes Sylvie's message and prepares it for sending. It knows she's trying to reach Jack's account and formats the message into the app's own data structure. If it needs a server address, it asks DNS first. The message is now app data ready to descend the stack.

Step 2: The Presentation Layer. The message gets encrypted (scrambled into unreadable code so nobody snooping on the network can read it). It also gets encoded and serialized into a format the receiver can decode later. If WhatsApp is using TLS, this is where the confidentiality and integrity story starts to matter. Sylvie's birthday wish is now a blob of encrypted data. Romantic.

Step 3: The Session Layer. A session (connection) is established between Sylvie's phone and WhatsApp's servers. Think of it like opening a door, but also keeping track of who is in the conversation and whether the chat is still active. The door needs to be open before you can throw the package through it.

Step 4: The Transport Layer. The encrypted message gets broken into smaller chunks called segments. Each segment gets sequence numbers and a TCP checksum so the receiver can verify order and integrity. This layer also chooses a port, like 443 for HTTPS, so the traffic lands in the right application. For this kind of message, TCP is the "I will make SURE this arrives" protocol. It does a three-way handshake, tracks acknowledgments, and retransmits missing data. TCP is that friend who texts you "did you get home safe?" and won't sleep until you reply.

Step 5: The Network Layer. Now comes the GPS part. This layer attaches IP addresses to the data. Sylvie's phone has an IP address, WhatsApp's server has one too, and routers use those addresses plus routing tables to choose the next hop. This layer also keeps an eye on ICMP for things like ping and traceroute-style diagnostics. The data might need to travel from Kathmandu to an undersea cable in Mumbai, across the Indian Ocean, through a relay in Europe, across the Atlantic, and finally into a data center in Virginia. This layer plans that entire journey.

Step 6: The Data Link Layer. The data is now packaged into frames and prepared for the first physical hop. In Sylvie's case, this is probably from her phone to her WiFi router. This layer makes sure the data gets from her device to the first stop on its journey without errors. It adds MAC addresses so the local network knows exactly which hardware is talking, and switches can forward the frame to the right port. Ethernet and Wi-Fi both live here, along with local error checking.

Step 7: The Physical Layer. And finally, the actual physical transmission. Sylvie's message, now encrypted, chunked, addressed, and framed, gets converted into radio waves (Wi-Fi) that travel from her phone to her router. From the router, it becomes electrical signals traveling through copper cables, or light pulses traveling through fiber optic cables. Actual light. Her birthday wish is literally traveling as bits through a glass tube thinner than a human hair under the ocean. ๐Ÿคฏ

The Journey

The data hops across multiple routers and networks. It travels through Nepal's internet infrastructure, hits an international gateway, travels through undersea fiber optic cables (there are literally hundreds of these cables sitting on the ocean floor connecting continents, look it up, it's wild), arrives at a data center in the US, reaches WhatsApp's server, which then routes it to Jack's phone in New York. Every hop strips off one layer of local addressing and adds the next one needed for the next hop.

The Arrival

On Jack's end, the entire process happens in reverse. Physical signals become frames, frames become packets, packets become segments, segments are reassembled into the full message, TCP checks what arrived and asks for missing pieces if needed, the session stays in sync, the presentation layer decrypts it, and the application layer displays:

"Happy Birthday Jack! ๐ŸŽ‚"

Jack sees it and replies "thx."

One word. After all that. Typical Jack. Busy guy. ๐Ÿ˜‚

The whole thing took less than a second.

That whole back-and-forth is the point of the stack: encapsulate, route, deliver, decapsulate. And when something breaks, the OSI model gives you a way to ask the right question instead of just staring at the screen and calling it "the internet being weird."

The Question

You've been doing this thousands of times a day, every text, every Google search, every scroll through social media. And you never once thought about the invisible symphony happening behind your screen?

The Problem

Here's what's wild. This system is so good that we've completely taken it for granted.

We get frustrated when a page takes 3 seconds to load. THREE SECONDS. Your data just traveled across an ocean, through a dozen routers, bounced between servers, got encrypted, decrypted, compressed, decompressed, and rendered into a visual page on your screen. And you're mad it took 3 seconds.

That's like getting mad at a pizza delivery guy who drove across the entire country to bring you a fresh pizza and arrived 3 seconds later than expected. "Why was it late though?" Bro.

We build our entire lives on top of this system without knowing it exists. Banking, communication, entertainment, work, education... everything runs on these layers. If the OSI/TCP-IP model suddenly stopped working tomorrow, the world would literally collapse. Not figuratively. LITERALLY. No banking, no communication, no navigation, no emergency services.

And the people who built and maintain this? They don't get monuments. No one makes fan edits of network engineers. Nobody's making "Day in the life of a TCP packet" content. (Actually, someone should. That'd go viral. CONTENT!!!)

Even if I'm wrong about how dramatic the impact would be, even if society would somehow stumble along without networks for a while... the point stands. We built the most complex communication system in human history, and then we got so used to it that we forgot to be amazed.

The Takeaway

Here's the clean version of what this writing covered.

The OSI and TCP/IP models aren't just "networking concepts for CS students to memorize before exams." They're the invisible architecture holding the modern world together.

Every single thing you do online follows this layered system. Your data gets prepared, encrypted, chunked, addressed, routed, physically transmitted, received, and reassembled on the other side. Every. Single. Time.

The reason it works so beautifully is BECAUSE of the layers. Each layer does its own job and trusts the other layers to do theirs. The Application Layer doesn't worry about routing. The Physical Layer doesn't care about encryption. Everyone stays in their lane, and the whole thing works.

If you remember nothing else, remember this: data is prepared, wrapped, routed, transmitted, received, and unwrapped again. That flow is the whole game.

"There's honestly a life lesson buried in there. Each layer does its own job and trusts the other layers to do theirs. Everyone stays in their lane, and the whole thing works."

- Fisholophy

More To Explore

If this got your curiosity going, here are a few rabbit holes worth diving into next.

Let's Talk About It

Did this make networking click for you? Still confused? Want me to break down something deeper? Drop me a message and let's nerd out together.

That's a wrap on the OSI and TCP/IP deep dive. If you made it this far, I genuinely appreciate your time and patience; it means more than you think. Feel free to check out the other writings if you haven't already, or come back later when there's something new cooking.

Thank you so much for reading and visiting. Your support keeps this corner of the internet alive. Until next time, stay curious, stay kind, and respect the layers. If you want to add something, feel free to send a message here.

โ† Back to All Writings