How does the Internet Work : From OSI Model to DNS Resolution

When we browse a website, watch a video, or join a Zoom call, a complex series of events occurs behind the scenes. Understanding how the internet works requires exploring the OSI Model, TCP/IP protocols, HTTP communication, and DNS Resolution.

OSI Model : The Foundation of Networking

The Open Systems Interconnection (OSI) model is a conceptual framework used to understand how data travels across a network. It consists of 7 layers, each with a specific responsibility.

The OSI Model

Quick Overview of Layers

  1. Application Layer – Direct interaction with user applications (e.g., web browsers using HTTP).

  2. Presentation Layer – Handles data translation, compression, encryption.

  3. Session Layer – Establishes, manages, and terminates communication sessions.

  4. Transport Layer – Ensures data delivery using TCP (reliable) or UDP (fast but unreliable).

  5. Network Layer – Responsible for routing and IP addressing.

  6. Data Link Layer – Converts data into frames and manages MAC addresses.

  7. Physical Layer – Transmits raw bits (0 and 1) over cables, Wi-Fi, or fiber.


Transport Layer: TCP and UDP

The Transport Layer is where data integrity and delivery are managed. It has two major protocols:

  1. TCP (Transmission Control Protocol)

Key Characteristics:

  • Reliable: Ensures all packets reach the destination.

  • Ordered: Reassembles packets in the correct order.

  • Connection-Oriented: Uses a 3-Way Handshake.

TCP 3-Way Handshake

Client                        Server
    | ----------- SYN ----------> |
    | <-------- SYN-ACK --------- |
    | ----------- ACK ----------> |
    |------ Connection Established ------|
  • SYN: Client requests a connection.

  • SYN-ACK: Server acknowledges and responds.

  • ACK: Client confirms; connection established.

TCP ensures reliability but introduces latency, making it slower for real-time communication.

  1. UDP (User Datagram Protocol)

  • Fast and lightweight

  • Unreliable: Packets can be lost or arrive out of order.

  • No Handshake: Lower latency.

Use Cases:

  • Video calls (like Zoom)

  • Live gaming

  • VoIP calls

Real-World Scenarios

ApplicationProtocol UsedReason
Cricket Score Update (live website)TCPReliability is more important than speed
Video Call (Zoom, Meet)UDPLow latency is critical
YouTube Live StreamingTCPAcceptable latency for reliable playback

Zoom optimizes by using UDP for hosts and TCP for muted participants, ensuring a mix of low latency and reliability.


HTTP and its Evolution

The HyperText Transfer Protocol (HTTP) is the backbone of web communication. It works at the Application Layer and typically uses TCP at the Transport Layer.

HTTP Versions: 1.0 → 1.1 → 2 → 3

Evolution of HTTP

  1. HTTP 1.0 – A new TCP handshake was required for every request.

  2. HTTP 1.1 – Introduced persistent connections, reusing the TCP handshake.

  3. HTTP 2 – Added multiplexing, sending multiple requests over one connection.

  4. HTTP 3 – Uses QUIC over UDP for faster, low-latency communication.

TCP vs UDP in Web Communication

  • TCP: Reliable but slower (used in standard web browsing, YouTube Live).

  • UDP: Faster with acceptable packet loss (used in real-time apps like Zoom calls).


DNS : The Phonebook of the Internet

Even with TCP and HTTP, your computer cannot connect to a website without knowing its IP address. This is where DNS (Domain Name System) comes in.

What is DNS?

DNS translates human-readable domain names (e.g., www.google.com) into machine-readable IP addresses (e.g., 142.250.182.206).

Without DNS, we would need to remember IPs for every website.

Step-by-Step DNS Resolution

  1. User types www.example.com in a browser.

  2. Local DNS Resolver (ISP or OS) checks its cache.

  3. If not found, it queries the Root DNS Server.

  4. Root DNS returns the TLD Server (like .com).

  5. TLD server returns the Authoritative DNS Server for the domain.

  6. Authoritative server provides the IP address.

  7. Resolver returns IP to the browser.

  8. Browser connects to the web server using that IP.

Which Protocol Does DNS Use?

  • UDP on Port 53 – Fast and efficient for small queries.

  • TCP – Used for large responses or zone transfers.


DNS Records

DNS records are instructions stored in authoritative DNS servers that provide information about a domain, such as its IP address, mail server, and other essential data. Learn more about DNS records here: Cloudflare DNS Records Guide

DNS Records and Their Types

DNS Records define how a domain should be resolved.

Record TypePurposeExample
AMaps to IPv4 addressexample.com → 192.0.2.1
AAAAMaps to IPv6 addressexample.com → 2001:db8::1
CNAMEAlias of another domainwww → example.com
MXMail Exchange serverexample.com mail.com
TXTStores arbitrary text / verificationSPF, DKIM records
NSPoints to authoritative name serversns1.example.com
PTRReverse lookup (IP → Domain)192.0.2.1 → example.com

Fun Experiment : Performing a DNS Lookup Command

You can use the dig command to perform a DNS lookup:

dig example.com

the result of dig command

This command queries the DNS system and returns information about the domain, including its IP address and other DNS records.


Putting It All Together

When you open a website:

  1. Application Layer (HTTP) – You request www.example.com.

  2. DNS Lookup – Translates domain to IP.

  3. Transport Layer (TCP/UDP) – Establishes connection (TCP) or sends packets (UDP).

  4. Network Layer (IP) – Routes packets to the destination server.

In short:

  • OSI Model gives the framework.

  • TCP/UDP ensures data transport.

  • HTTP handles web communication.

  • DNS resolves names to IPs.

All these layers work together to make the modern internet function seamlessly.

11
Subscribe to my newsletter

Read articles from Anushka Banerjee directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Anushka Banerjee
Anushka Banerjee