Computer Networks / Lecture / Lecture 9
Lecture · Computer Networks

TCP/IP model and its comparison with OSI

OSI is the ideal map from the textbook, while TCP/IP is the real city streets. The page you are reading now, your Telegram message, your Payme payment — all of it travels through the TCP/IP stack. In this lesson you will study the layers of the TCP/IP model, compare it side by side with OSI and take apart a real packet byte by byte in a Wireshark-style “analyzer”.

:ik-kitob: Lecture 9 ⏱ 2 academic hours (80 minutes) 🚇 Packet simulators ⚡ The map and the real road
09

Lesson goals and plan

By the end of the lesson you will…

  • name the 4 layers of the TCP/IP model (and the 5-layer teaching variant) with their functions
  • explain how TCP/IP came into being and why the Internet runs on exactly this stack
  • map the OSI and TCP/IP layers onto each other
  • place the main protocols (HTTP, DNS, TCP, UDP, IP, ICMP, ARP, Ethernet) in both models
  • split the bytes of a real packet by layer and read the header fields
  • compare the strengths and weaknesses of the two models with sound arguments

Plan (according to the syllabus)

  1. The layers of the TCP/IP model and their practical importance in Internet networks
  2. Comparing the layers, functions and protocols of the TCP/IP and OSI models

OSI promised me 7 envelopes, but on the Internet I usually wear only 4: application data, TCP or UDP, IP, and Ethernet or Wi-Fi. Today you will “undress” me in a packet analyzer — I am not shy!

Which model “won” and why?

In the 1980s the world stood at a fork: the carefully designed OSI protocols backed by international organizations, or TCP/IP, already running on the US research network. Governments declared OSI an official standard, but universities and companies kept installing TCP/IP, which was free, tested and working right now. The result: today OSI is mostly a teaching and explanation model, while TCP/IP is the working stack of the whole Internet. Still, you cannot be a network engineer without knowing both.

Key terms

The layers of the TCP/IP model and their practical importance in Internet networks

TCP/IP went from “practice to theory”, not from “theory to practice”. The protocols were written and tested first, and the model took shape afterwards to describe them.

A short history

1969

ARPANET

ARPA, an agency of the US Department of Defense, connects the computers of four universities with a packet network.

1974

The Cerf and Kahn paper

Vint Cerf and Bob Kahn publish the idea of a protocol that unites different networks. It was later split into TCP and IP.

1983

“Flag day”

On 1 January ARPANET switches completely to TCP/IP. This date is often called the “birthday” of the Internet.

1984

The OSI model

The ISO 7498 standard is published — the 7-layer reference model.

1989

RFC 1122

Requirements for Internet hosts: the TCP/IP layers (link, internet, transport, application) are formally described.

1991 – today

The Web and the mobile Internet

The WWW, then smartphones, cloud services — all on the same TCP/IP foundation. IPv6 is being introduced step by step to solve the shortage of addresses (as of 2026 a significant share of Internet traffic, but not yet all of it, goes over IPv6).

Four layers

4 · ApplicationHTTP, HTTPS, DNS, SMTP, DHCP, SSH 3 · TransportTCP, UDP (QUIC — UDP ustida) 2 · InternetIPv4, IPv6, ICMP 1 · Network access (Link)Ethernet, Wi-Fi, PPP, ARP The “language” of programs: what do we ask for?identifier: URL, domain Which program, and is it reliable?identifier: port Which network, which host?identifier: IP address How do we deliver it within this segment?identifier: MAC address
Figure 9.1. The TCP/IP model (4 layers according to RFC 1122)

4 · Application

Protocols used by user programs. The functions of the OSI session and presentation layers are here too — the program or a library (for example, TLS) performs them itself.

3 · Transport

TCP — sets up a connection, resends what is lost, restores the order (web, mail). UDP — fast, “fire and forget” (DNS, online games, voice calls).

2 · Internet

IP — the “single language” of the Internet: it carries a packet to its address over any network (Wi-Fi, optical fiber, 4G). “Best effort”: it gives no guarantees, and the transport layer fills that gap.

1 · Network access

Carrying the packet over a specific physical network: an Ethernet frame, a Wi-Fi frame, mobile communication. TCP/IP deliberately left this layer “open” — any technology can be plugged in.

4 layers or 5?

RFC 1122 describes four layers. Many textbooks (for example, Kurose and Ross) use a 5-layer hybrid model for teaching: Application, Transport, Network, Link, Physical — that is, they split the network access layer in two. Both are correct; just be clear about which model you are speaking in.

The “hourglass” shape: why is IP in the middle?

The TCP/IP stack is compared to an hourglass: at the top, hundreds of application protocols (web, video, games, payments); at the bottom, dozens of physical technologies (optics, Wi-Fi, 4G/5G, satellite); and in the narrow “waist” in the middle, a single protocol — IP. That is why you do not need to know about the cable to create a new application, and when a new cable technology appears you do not have to rewrite the applications. The rapid growth of the Internet depends on exactly this principle.

HTTP · DNS · SMTP · SSH · WebRTC · MQTT · BitTorrent · … TCP · UDP · QUIC IP Ethernet · Wi-Fi · PPP · LTE/5G copper cable · optics · radio · satellite · …
Figure 9.2. “Everything over IP, IP over everything”

Port numbers: the bridge between the transport and application layers

Table 9.1. Popular ports
PortProtocolTransportPurpose
20, 21FTPTCPfile transfer (data, control)
22SSHTCPsecure remote administration
25SMTPTCPsending mail (between servers)
53DNSUDP (and TCP)converting a domain name into an IP address
67, 68DHCPUDPautomatic IP address assignment
80HTTPTCPweb (unencrypted)
443HTTPSTCP (UDP in HTTP/3)web (encrypted with TLS)

Comparing the layers, functions and protocols of the TCP/IP and OSI models

Let us put the two models side by side. On the map below, click a protocol — the layer it occupies in OSI and the layer it occupies in TCP/IP will light up. Use the button above to switch between the 4- and 5-layer TCP/IP variants.

:ik-xarita: OSI ↔ TCP/IP map

OSI (7)
TCP/IP (4)
Choose a protocol.
Table 9.2. OSI and TCP/IP: a detailed comparison
CriterionOSITCP/IP
AuthorISO (the International Organization for Standardization)DARPA researchers, later the IETF
Number of layers74 (5 in the teaching variant)
How it came aboutfirst the model, then the protocolsfirst the protocols, then the model
Service, interface, protocolclearly separated — theoretically cleannot clearly separated
Session and presentationseparate layersinside the application layer
Transport layerConnection-oriented and connectionless servicesTCP (connection-oriented) and UDP (connectionless)
Network layerconnection-oriented and connectionless modesconnectionless only (IP datagrams)
In practicea reference, teaching and diagnostic languagethe whole Internet and almost all LANs
StandardsISO documentsopen RFC documents, free of charge

Strengths of OSI

  • The functions of the layers are very clear — convenient for learning and explaining
  • Universal: any stack can be described
  • The question “which layer?” when troubleshooting

Weaknesses of OSI

  • Its protocols are hardly used in practice
  • The session and presentation layers are often empty
  • Some functions (error control) are repeated at several layers

Strengths of TCP/IP

  • Real, tested, works all over the world
  • Adapts to any physical network (IP is the narrow waist)
  • Open and free standards

Weaknesses of TCP/IP

  • The model is secondary and awkward for general description
  • The physical and link layers are not distinguished
  • Security was not originally intended (TLS and IPsec were added later)

Opening a real packet: the analyzer

Below is a realistic 91-byte frame sent from a computer to a web server (without the FCS — Wireshark usually does not show it either). In the tree on the left, click a field — the hexadecimal (hex) bytes on the right light up. You will see with your own eyes which byte belongs to which layer. Note: this is HTTP (port 80), so the text of the request is visible; with HTTPS this spot would hold encrypted “jumbled” bytes.

:ik-qidiruv: Packet analyzer (Wireshark style)

Now let us do the same thing in Python. The 20 bytes of an IPv4 header have a strict structure: byte 9 (index 8, counting from 0) is TTL, byte 10 (index 9) is the protocol, indexes 12–15 are the source IP, and 16–19 are the destination IP.

Hint

bytes.fromhex() skips the spaces between the hexadecimal pairs by itself — the second and third tests check exactly this.

Common mistakes

MisconceptionIn reality
“TCP/IP is two protocols”TCP/IP is a stack of hundreds of protocols, named after the two main ones.
“TCP/IP also has 7 layers, they are just named differently”4 layers (5 in the teaching variant). Session and presentation fall into the application layer.
“The Internet layer means connecting to the Internet (Wi-Fi)”The Internet layer is IP and routing. Wi-Fi belongs to the network access layer.
“ICMP is a transport protocol because it is carried inside IP”Even though ICMP is carried in an IP packet, by its function it belongs to layer 3.
“OSI is outdated, there is no need to learn it”OSI numbers (L2, L3, L7) are in engineers’ everyday speech; they are necessary for diagnostics.
Mixing the layer numbers of the two models in one sentence (“layer 3 of TCP/IP is IP”)Say which model you mean: IP is OSI 3, and in TCP/IP (4 layers) it is layer 2 (Internet).

Reinforcement

// REMEMBER IN 1 MINUTE

  1. TCP/IP (RFC 1122): Application, Transport, Internet, Network access. Teaching variant: 5 layers.
  2. OSI 5–7 → TCP/IP application; OSI 4 → transport; OSI 3 → Internet; OSI 1–2 → network access.
  3. IP is the narrow waist of the “hourglass”: everything over IP, IP over everything.
  4. OSI is the reference model (ISO, 1984), TCP/IP is the working stack (ARPANET, 1983).
  5. Packet analyzer: Ethernet 14 B → IP 20 B → TCP 20 B → data.
:ik-globus:Every dayYour Instagram feed: HTTPS (application) → TCP or QUIC/UDP (transport) → IP (Internet) → Wi-Fi or 4G (access).
:ik-server:At workAn engineer says “L2 switch”, “L3 switch”, “L7 load balancer” — these are OSI numbers.
:ik-qidiruv:WiresharkEvery packet tree opens in exactly the order of the TCP/IP layers.

Final test

Review questions

Name the layers of the TCP/IP model and give an example for each.

Application (HTTP, DNS), Transport (TCP, UDP), Internet (IP, ICMP), Network access (Ethernet, Wi-Fi, ARP).

How did TCP/IP come about?

In the ARPANET project; the Cerf and Kahn idea in 1974, ARPANET switched to TCP/IP on 1 January 1983; the standards are in RFCs (RFC 791, 1122, etc.).

Why does the Internet run on TCP/IP in particular?

It was tested in practice, is open and free, and works over any physical network; by the time the OSI protocols were ready, TCP/IP was already widespread.

What does the “hourglass” principle mean?

Many applications and many physical technologies are linked through a single IP layer; this lets the two sides develop independently.

Map the OSI and TCP/IP layers onto each other.

OSI 7, 6, 5 → application; 4 → transport; 3 → Internet; 2, 1 → network access.

Name 3 main differences between the two models.

Number of layers (7 and 4); how they came about (model→protocols and protocols→model); use (a reference and a working stack). In addition: OSI clearly separates service, interface and protocol.

Why is the 5-layer hybrid model needed?

By splitting the network access layer of TCP/IP into link and physical, it gives a picture that is both practical and clear (the Kurose and Ross textbook).

How large are the Ethernet, IP and TCP headers in a packet analyzer?

Ethernet — 14 bytes (+ 4 bytes FCS), IPv4 — at least 20 bytes, TCP — at least 20 bytes.

Why is the “Protocol” field in the IPv4 header needed?

The receiver knows which transport (or other) protocol to hand the data inside the packet to: 1 — ICMP, 6 — TCP, 17 — UDP.

Independent work

The independent study topic in the course syllabus: “Interaction of the OSI and TCP/IP models and of network layers.” (6 hours). If you did the OSI part in Lecture 8, now you will finish the topic from the TCP/IP side.

  1. For the set of protocols in your assigned variant, build a two-column table: for each protocol, its OSI layer and TCP/IP layer, transport protocol and port.
  2. On your computer run netstat -an (Windows) or ss -tuln (Linux); choose 5 connections and find out which service their ports belong to.
  3. Write a 1-page comparative essay on the two models: “Why do engineers speak the language of OSI but work with TCP/IP?”
Assessment criteria (individual assignment)
CriterionPoints
The protocols are placed correctly in both models2
The transport protocols and ports are indicated correctly1
The netstat/ss output has been analyzed1
The essay is logical and gives examples1

Summary

TCP/IP — 4 layersApplication, Transport, Internet, Network access (5 in teaching).
HistoryARPANET → TCP/IP in 1983; OSI — 1984, ISO.
MappingOSI 5–7 = application, 4 = transport, 3 = Internet, 1–2 = access.
HourglassIP is the narrow waist that joins all applications and all networks.
DifferenceOSI is a reference and a language, TCP/IP is a working stack.
Ports80 HTTP, 443 HTTPS, 53 DNS, 22 SSH, 25 SMTP, 67/68 DHCP.
Inside a packetEthernet 14 B → IPv4 20 B → TCP 20 B → data; type 0x0800, protocol 6.

Your lesson results

Your results are saved in this browser. Read all the sections and complete the exercises and assignments.

My personal notes