Demystifying the Web

A Deep Dive into OSI Model, DNS, TCP/UDP, and Internet Functionality

The internet is an essential part of our daily lives, whether we’re browsing social media, streaming videos, or working online. But have you ever stopped to think about how it all works? How does a website load in seconds, or a message travel halfway across the world instantly? Behind the scenes, there’s a fascinating system at play, involving the OSI model, DNS, TCP and UDP, and countless other technologies working together. In this article, we’ll break down these key components in simple terms and explore the magic(not really you will get to know later) that makes the internet tick

Let’s start by!


Understanding the OSI Model

To Interpret the OSI Model, we need to first understand why it is needed what problem is it solving? . So before the OSI model was introduced, there was no standardized way of defining the different layers involved in network communication. This caused confusion and inefficiency, as different systems and technologies used incompatible methods for sending and receiving data.

The OSI model makes things simpler by breaking down the complicated process of communication into seven distinct layers, each handling a specific job. Imagine it like a team, where each layer has its own responsibility—whether it's making sure the data gets from one point to another, ensuring security, or managing the format of the information. This structure makes troubleshooting much easier, as it’s clear where things might be going wrong.

Seven Layers of OSI Model

  1. Physical Layer: This is where the action begins. It's the foundation, responsible for transmitting raw data through physical media like cables, radio waves, or fiber optics. Think of it like the delivery truck that carries the goods. It determines how fast data can travel, how it gets encoded into electrical signals, and the voltage needed for transmission.

  2. Data Link Layer: Now, imagine you’re sending a package from one point to another. The Data Link Layer ensures that package doesn’t get lost or damaged along the way. It’s the reliable middleman that ensures the data is transferred correctly over a physical connection. It also checks for errors and handles how devices within the same network communicate (like how Ethernet works).

  3. Network Layer: This layer is the GPS of the data journey. It’s responsible for figuring out how to get the data from one network to another, even if it has to cross several different networks. It assigns logical addresses (like IP addresses) and routes the data to its destination.

  4. Transport Layer: Think of this layer as the manager who ensures that data arrives in perfect condition. It breaks large chunks of data into smaller, manageable pieces and makes sure everything is delivered reliably. It checks for any errors along the way and manages the flow of data between devices (using protocols like TCP or UDP).

    I have discussed this component in detail in later part

  5. Session Layer: This one’s the organizer. It’s in charge of setting up, maintaining, and ending communication sessions between applications. Imagine it like a meeting planner who schedules the session, keeps everything running smoothly, and then closes things out when the conversation is done.

  6. Presentation Layer: This layer’s job is to make sure data is in a format the receiving application can understand. It’s like a translator, converting data into something the other side can read. It handles tasks like encryption (to keep your data secure) and compression (to make sure the data isn’t too bulky).

  7. Application Layer: Finally, this is where the user gets involved. This layer is all about the apps you interact with, like web browsers or email clients. It provides the services that allow these applications to communicate over the network, using protocols like HTTP, FTP, and DNS.

Now after understanding the OSI Model and it’s layers can you connect the dots now

it’s no magic it’s all Tech!

This is for all about the OSI Model let’s take a look into TCP and UDP [Protocols]

TCP / UDP , Which one’s great?

TCP (Transmission Control Protocol) and UDP (User Datagram Protocol) are two fundamental communication protocols used for transmitting data over the internet. Now you are sending information over the requests here comes the transport layer

To discern the difference which one to use it’s not like you take the blue pill or red in this you can take both but we will take that later in part for now lets comprehend what is UDP and TCP?

What is TCP?

TCP (Transmission Control Protocol) is one of the core protocols of the Internet Protocol Suite, commonly known as TCP/IP. It is responsible for ensuring reliable, ordered, and error-free communication between devices over a network. It operates at the Transport Layer (Layer 4) of the OSI model and is widely used for most types of data transmission, such as web browsing, file transfers, and email.


  • Reliable - TCP ensures that each data packets are delivered accurately

  • Ordered - Data is transmitted in packets(information jargon), and TCP ensures that packets arrive in the correct order.

  • Three-Way Handshake:
    Before any data is transmitted, TCP establishes a connection between the sender and the receiver using the following steps:

    • SYN (Synchronize): The sender sends a request to the receiver to initiate the connection.

    • SYN-ACK (Synchronize-Acknowledge): The receiver responds, acknowledging the sender's request and indicating readiness.

    • ACK (Acknowledge): The sender acknowledges the receiver’s response, and the connection is established.

What is UDP?

UDP (User Datagram Protocol) is another core protocol in the Internet Protocol Suite, but it operates differently from TCP. While TCP focuses on reliable, ordered communication, UDP is a simpler, connectionless protocol that prioritizes speed over reliability. It operates at the Transport Layer (Layer 4) of the OSI model, like TCP, but with a different approach to handling data transmission.

  • No Reliability - UDP does not guarantee that packets will arrive at their destination, nor does it ensure that they are received in the correct order

  • Connectionless - UDP does not establish a connection before sending data

  • Faster Data Transmission - Since UDP does not require confirmation or error checking, it transmits data faster, which is beneficial for applications where speed is critical, and occasional data loss is acceptable.

Now, Whom will you wield a sword against for your protection?

well the answer is twofold

The Role of TCP/UDP in Your Requests:

FeatureUDPTCP
Connection-TypeConnectionless(No-handshake)Connection-oriented (2-way-handshake)
ReliabilityNo guarantee of deliveryGuarantees delivery and order
SpeedFaster, lower overheadSlower due to reliability mechanisms
OrderNo-orderOrdered

DNS(Domain Name System)

Imagine trying to call a friend, but instead of their name, you need to memorize their 10-digit phone number. That’s how the internet would feel without the Domain Name System (DNS). DNS works behind the scenes to translate easy-to-remember website names, like www.google.com, into the IP addresses that computers and servers understand, like 142.250.64.110.

Why does DNS matter?

  • It makes the internet usable. You don’t need to remember a jumble of numbers for every website you visit.

  • It connects the dots. DNS acts as the internet’s phonebook, making sure your request reaches the right destination.

DNS Hierarchy: From Root to Authoritative Servers

  1. Request To DNS Server : When you make a request by typing the url like chaicode.com on the browser the request is sent to the DNS server, It doesn’t know the exact answer but knows which Top-Level Domain (TLD) server to ask next

  2. TLD Servers: Narrowing It Down : TLD server responsible for .com,.net,.io and so on. It says check authoritative for chaicode.com

  3. Authoritative Servers: The Final Answer
    Finally, the authoritative server knows exactly where chaicode.com lives and gives your browser the IP address it needs.

    • Example: It responds, “Here you go: 192.168.1.1.
  4. Then the after getting the ip of chaiocode.com DNS server give us the chaicode.com

Let’s Put It All Together: A Real-Life Example

Suppose you open your browser and type www.chaicode.com. Here’s what happens:

  1. Your browser says, “Where’s www.chaicode.com?”

  2. It asks a DNS resolver (a middleman) for help.

  3. The resolver checks with the root server: “Hey, where’s .com?”

  4. The root server sends it to the .com TLD server.

  5. The TLD server points it to chaicode.com’s authoritative server.

  6. Finally, the authoritative server says, “Here’s the IP: 192.168.1.1.”

  7. Your browser uses that IP to connect to the website.

This entire process happens in milliseconds, making it feel like magic.

DNS Records

Every time you use the internet, DNS records are at work behind the scenes. Here are some you’ve probably interacted with without even knowing:

💡
After grasping all of these concepts, you can now understand that the so-called "magic" of the internet is actually the result of several fundamental components working together. The basic elements we've discussed form the backbone of how the web operates, making everything connect seamlessly. It's not magic—it's technology, and now you know how it all works behind the scenes.

The article delves into the fundamental technologies that power the internet, breaking down complex concepts like the OSI model, DNS, TCP, and UDP into simple terms. It explains the layers of the OSI model and their roles in network communication, the differences between TCP and UDP protocols, and the significance of DNS in translating domain names into IP addresses. These insights reveal the technical workings behind the seamless and instant data transmission we experience online, demystifying the "magic" of the internet.