The OSI model is a useful reference, but the internet actually runs on the TCP/IP protocol suite, which has its own, simpler model.

The TCP/IP Model

The TCP/IP model grew out of the US ARPANET research network in the 1970s and became the basis of the internet. It is usually described with four layers (some textbooks use five, separating physical from data link). 1. Network access (link) layer: combines the OSI physical and data link layers; it moves frames over a particular network, such as Ethernet or Wi-Fi. 2. Internet layer: corresponds to the OSI network layer; IP addresses and routes packets across networks, helped by ICMP (error and control messages, used by ping) and ARP (address resolution). 3. Transport layer: provides end-to-end communication between processes using TCP (reliable, connection-oriented) or UDP (fast, connectionless). 4. Application layer: combines the OSI session, presentation and application layers; it includes HTTP/HTTPS, FTP, SMTP, POP3, IMAP, DNS, DHCP and SSH.

Definition: TCP/IP model. The four-layer model of the internet protocol suite, consisting of the network access, internet, transport and application layers, named after its two main protocols, TCP and IP.

Comparison of OSI and TCP/IP

The OSI model has seven layers; TCP/IP has four. OSI was designed as a theoretical reference before its protocols existed; TCP/IP was built from protocols that already worked, and the model was described afterwards. OSI separates the session and presentation layers, while TCP/IP merges them into the application layer. OSI defines services, interfaces and protocols distinctly; TCP/IP is less strict. OSI's transport layer is connection-oriented, while TCP/IP offers both TCP and UDP. In practice, the OSI model is used for teaching and troubleshooting, and TCP/IP is the model that is implemented on the internet.

Ports and Sockets

At the transport layer, processes are identified by port numbers from 0 to 65535: well-known ports (0–1023) such as 80 (HTTP), 443 (HTTPS), 25 (SMTP), 53 (DNS), 21 (FTP) and 22 (SSH); registered ports (1024–49151); and dynamic ports (49152–65535). An IP address together with a port, such as 142.250.70.4:443, is a socket, which identifies one end of a connection.

Table 1.3: OSI and TCP/IP compared

Feature OSI TCP/IP
Layers 7 4
Developed by ISO (theory first) ARPANET/DoD (protocols first)
Session and presentation Separate layers Part of application layer
Transport Connection-oriented TCP and UDP
Use Reference, teaching The internet

Example 1.3: Mapping OSI to TCP/IP

Problem: Map each OSI layer to the TCP/IP layer that covers it.

Solution:

  1. Application, Presentation and Session (OSI 7, 6, 5) map to the Application layer.
  2. Transport (4) maps to Transport.
  3. Network (3) maps to Internet.
  4. Data link and Physical (2, 1) map to Network access.

Result: 7–5 → Application, 4 → Transport, 3 → Internet, 2–1 → Network access.

ports = {"HTTP": 80, "HTTPS": 443, "SMTP": 25, "DNS": 53,
         "FTP": 21, "SSH": 22, "POP3": 110, "IMAP": 143}
for name, p in sorted(ports.items(), key=lambda x: x[1]):
    kind = "well-known" if p < 1024 else "registered"
    print(f"{name:<6} port {p:<4} ({kind})")

Output

FTP    port 21   (well-known)
SSH    port 22   (well-known)
SMTP   port 25   (well-known)
DNS    port 53   (well-known)
HTTP   port 80   (well-known)
POP3   port 110  (well-known)
IMAP   port 143  (well-known)
HTTPS  port 443  (well-known)

Common mistakes

  • Saying that TCP/IP has seven layers.
  • Placing IP in the transport layer. IP is in the internet layer.
  • Thinking that the internet uses the OSI protocols. It uses TCP/IP.

Key takeaways

  • TCP/IP has four layers: network access, internet, transport and application.
  • IP is in the internet layer; TCP and UDP are in the transport layer.
  • OSI is the reference model; TCP/IP is the working model of the internet.
  • A socket is an IP address plus a port number.

Practice questions

  1. Name the four layers of the TCP/IP model.
  2. Which OSI layers are merged into the TCP/IP application layer?
  3. What is the well-known port of HTTPS?

Answers to the practice questions

  1. Network access, internet, transport and application.
  2. Session, presentation and application.

Sources

  • Official BCA syllabus Computer Networks, course code 26BCA404DS02, Unit I