1. Home
  2. Computer Networks
  3. OSI & TCP/IP Layers

OSI & TCP/IP Layers

Follow one web request down the 7 layers of the sender, across the wire, and up the receiver — watching each layer add and remove its header in 3D.

Interactive 3DBeginner12 min readCNUpdated

Drag to rotate · Right-drag to pan · Click, then scroll to zoom · Space play · ←→ step

What's happening

Pseudocode

    Try this in the 3D model

    • Press Send a message and watch the packet grow on the way down. In what order do the headers appear?
    • Pause at the Network layer and read the IP header. Which addresses does it carry?
    • Switch to TCP/IP (4 layers) and compare the slab heights with the OSI model.

    Why layers?

    Sending a web page across the world involves apps, encryption, reliable delivery, addressing, routing, Wi-Fi radio and fibre optics. Instead of one giant program doing everything, networking is split into layers. Each layer:

    • does one job,
    • uses the services of the layer below, and
    • offers services to the layer above.

    You can replace one layer (e.g. Wi-Fi instead of Ethernet) without touching the others.

    The OSI model (7 layers)

    Remember top-down with “All People Seem To Need Data Processing”:

    # Layer Job Examples Data unit
    7 Application Network services for apps HTTP, DNS, SMTP, FTP Data
    6 Presentation Format, encode, encrypt, compress TLS, JPEG, UTF-8 Data
    5 Session Open, manage, close sessions RPC, sockets Data
    4 Transport End-to-end delivery, ports, reliability TCP, UDP Segment
    3 Network Logical addressing and routing IP, ICMP Packet
    2 Data Link Delivery on one link, MAC addresses, error detection Ethernet, Wi-Fi Frame
    1 Physical Bits as signals Cables, radio, fibre Bits

    Encapsulation and decapsulation

    On the sender, data travels down the stack. Each layer adds its own header (and the data link layer also adds a trailer):

    [ data ]                                             Application
    [ TCP | data ]                                       Transport  → segment
    [ IP | TCP | data ]                                  Network    → packet
    [ MAC | IP | TCP | data | FCS ]                      Data Link  → frame
    0101101001110…                                       Physical   → bits

    On the receiver, the data travels up and each layer reads and removes the header added by its peer layer. That’s exactly the animation in the 3D model.

    Each layer “talks” only to the same layer on the other machine (via headers), even though physically everything passes through the layers below.

    The TCP/IP model (4 layers)

    The internet actually uses the simpler TCP/IP model:

    TCP/IP layer OSI layers Protocols
    Application 7, 6, 5 HTTP, DNS, SMTP, TLS
    Transport 4 TCP, UDP
    Internet 3 IP, ICMP
    Network Access (Link) 2, 1 Ethernet, Wi-Fi

    OSI is the reference model used for teaching and troubleshooting (“is it a layer 2 or layer 3 problem?”); TCP/IP is the implementation.

    Devices and layers

    Device Layer Looks at
    Hub, repeater 1 Just signals
    Switch 2 MAC addresses
    Router 3 IP addresses
    Firewall / load balancer 3–7 IPs, ports, sometimes content

    What happens when you open a website?

    1. DNS (application) turns example.com into an IP address.
    2. TCP opens a connection with a 3-way handshake.
    3. TLS encrypts the conversation.
    4. The browser sends an HTTP request; it is encapsulated down the layers and sent.
    5. Routers forward the packets hop by hop using routing algorithms.
    6. The server decapsulates the request, sends back the page, and the process repeats in reverse.

    Common mistakes

    • Mixing up the order of layers — use the mnemonic.
    • Saying switches route packets — they forward frames within one network; routers move packets between networks.
    • Thinking TCP and IP are the same layer: TCP is transport (4), IP is network (3).

    Complexity at a glance

    Case / operationTimeWhy
    OSI layers7Reference model for teaching and troubleshooting.
    TCP/IP layers4The model the internet actually uses.

    Quick check

    Test yourself — pick an answer to see if you got it.

    1. Which layer adds the source and destination IP addresses?

    2. What is the PDU (data unit) called at the Transport layer?

    3. Encapsulation means…

    4. Which device works mainly at the Network layer?

    Saved only in this browser — no account needed.
    Spotted a mistake or a bug in the 3D model?

    Report a mistake

    in OSI & TCP/IP Layers. Thank you — every report makes the lesson better for the next reader.

    We'll also include a link to the step of the 3D model you're on and your browser type, so we can reproduce it.