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”.
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)
- The layers of the TCP/IP model and their practical importance in Internet networks
- 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!
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
ARPANET
ARPA, an agency of the US Department of Defense, connects the computers of four universities with a packet network.
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.
“Flag day”
On 1 January ARPANET switches completely to TCP/IP. This date is often called the “birthday” of the Internet.
The OSI model
The ISO 7498 standard is published — the 7-layer reference model.
RFC 1122
Requirements for Internet hosts: the TCP/IP layers (link, internet, transport, application) are formally described.
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 · 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.
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.
Port numbers: the bridge between the transport and application layers
| Port | Protocol | Transport | Purpose |
|---|---|---|---|
| 20, 21 | FTP | TCP | file transfer (data, control) |
| 22 | SSH | TCP | secure remote administration |
| 25 | SMTP | TCP | sending mail (between servers) |
| 53 | DNS | UDP (and TCP) | converting a domain name into an IP address |
| 67, 68 | DHCP | UDP | automatic IP address assignment |
| 80 | HTTP | TCP | web (unencrypted) |
| 443 | HTTPS | TCP (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
| Criterion | OSI | TCP/IP |
|---|---|---|
| Author | ISO (the International Organization for Standardization) | DARPA researchers, later the IETF |
| Number of layers | 7 | 4 (5 in the teaching variant) |
| How it came about | first the model, then the protocols | first the protocols, then the model |
| Service, interface, protocol | clearly separated — theoretically clean | not clearly separated |
| Session and presentation | separate layers | inside the application layer |
| Transport layer | Connection-oriented and connectionless services | TCP (connection-oriented) and UDP (connectionless) |
| Network layer | connection-oriented and connectionless modes | connectionless only (IP datagrams) |
| In practice | a reference, teaching and diagnostic language | the whole Internet and almost all LANs |
| Standards | ISO documents | open 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.
bytes.fromhex() skips the spaces between the hexadecimal pairs by itself — the second and third tests check exactly this.
Common mistakes
| Misconception | In 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
- TCP/IP (RFC 1122): Application, Transport, Internet, Network access. Teaching variant: 5 layers.
- OSI 5–7 → TCP/IP application; OSI 4 → transport; OSI 3 → Internet; OSI 1–2 → network access.
- IP is the narrow waist of the “hourglass”: everything over IP, IP over everything.
- OSI is the reference model (ISO, 1984), TCP/IP is the working stack (ARPANET, 1983).
- Packet analyzer: Ethernet 14 B → IP 20 B → TCP 20 B → data.
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.
- 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.
- On your computer run
netstat -an(Windows) orss -tuln(Linux); choose 5 connections and find out which service their ports belong to. - Write a 1-page comparative essay on the two models: “Why do engineers speak the language of OSI but work with TCP/IP?”
| Criterion | Points |
|---|---|
| The protocols are placed correctly in both models | 2 |
| The transport protocols and ports are indicated correctly | 1 |
| The netstat/ss output has been analyzed | 1 |
| The essay is logical and gives examples | 1 |
Summary
Your lesson results
Your results are saved in this browser. Read all the sections and complete the exercises and assignments.