Computer Networks

OSI Model vs TCP/IP Model: Layers, Functions and Protocols

Computer Networks Study guides

Compare the 7-layer OSI model with the 4-layer TCP/IP model. See what each layer does, which protocols and devices belong to it, and how data is encapsulated.

A network model splits communication into layers, where each layer provides a service to the layer above and uses the layer below. The OSI model has seven layers. From top to bottom: Application (user services such as HTTP, SMTP, DNS), Presentation (data format, encryption, compression), Session (opening, managing and closing sessions), Transport (end-to-end delivery, segments, ports, TCP and UDP), Network (logical addressing and routing, packets, IP, routers), Data Link (framing, MAC addresses, error detection, switches) and Physical (bits on the medium, cables, hubs, signals).

The TCP/IP model has four layers: Application (covers OSI application, presentation and session), Transport (TCP and UDP), Internet (IP, ICMP, ARP-related addressing) and Network Access or Link (covers OSI data link and physical). TCP/IP is the model the real internet uses, while OSI is a reference model used for teaching and troubleshooting. A helpful memory phrase for OSI from the bottom is Please Do Not Throw Sausage Pizza Away.

When a host sends data, each layer adds its own header in a process called encapsulation: data becomes a segment at the transport layer, a packet at the network layer, a frame at the data link layer and bits at the physical layer. The receiver reverses this (decapsulation). TCP is connection-oriented and reliable, with acknowledgements and retransmission, while UDP is connectionless and faster with no delivery guarantee, so it suits streaming and DNS queries.

Key points

  • OSI: Application, Presentation, Session, Transport, Network, Data Link, Physical.
  • TCP/IP: Application, Transport, Internet, Network Access.
  • Data units: segment, packet, frame, bits.
  • Router works at the network layer, switch at the data link layer, hub at the physical layer.
  • TCP is reliable and connection-oriented, UDP is fast and connectionless.

Worked example

A browser requests a web page. HTTP at the application layer creates the request. TCP adds a source and destination port (80 or 443) and makes a segment. IP adds source and destination IP addresses and makes a packet. Ethernet adds MAC addresses and a frame check sequence and makes a frame, which is sent as bits. The router reads only up to the IP header, and the switch only up to the MAC header.

Common questions

How many layers do the OSI and TCP/IP models have?

OSI has 7 layers and TCP/IP has 4.

At which layer does a router work?

The network layer (layer 3), because it forwards packets using IP addresses.

Related topics

BASMAGLY is an independent student project, not an official Delta University site. Check lectures and your instructor for the final word.