Introduction
- Models that provide abstract representation of how data is transmitted over a network.
- Each model is described by a so-called stack of layers, because each layer is dependent on its adjacent layers.
- The OSI stack has 7 such layers and TCP/IP stack has 4.
The OSI Model
- Stands for Open System Interconnection Model and was created by ISO (International Standards Organization) in the 1970's as a way to organize the efforts around the creation of new networking protocols, and to provide a common perspective for the existing network protocols at the time.
- The OSI model has 7 layers, the bottom 4 layers are referred to as "media" layers and are used for performing tasks like data transport, addressing and data delivery. The top 3 layers are referred to as "Host" layers that use the media layers to enable communication between applications.
Breakdown of each layer:
-
Application Layer (Layer-7)
- Responsible for Human-Computer interaction.
- Handles services and programs that use the network to transmit and receive data, such as web browsers and email clients.
- Includes protocols like HTTP, FTP, SMTP, and DNS.
-
Presentation layer (Layer-6)
- Responsible for formatting and presentation of data.
- This layer handles things like compression/decompression, encryption/decryption, and encoding/decoding. Basically, ensuring the data is in a usable format for the next layer (Layer 5 if sending data, Layer 7 if receiving it).
-
Session layer (Layer-5)
- Responsible for Managing Communication between devices.
- This layer is responsible for setting up, maintaining, and tearing down sessions, in addition to performing functions like authentication and authorization. This ensures connections between clients are opened for as long as needed to transfer data, then torn down as soon as the transfer is complete.
-
Transport Layer (Layer-4)
- Responsible for Transporting data between hosts.
- This is the layer that handles ports, like HTTP at port 80, HTTPS at port 443. Being responsible for data delivery, this layer also handles breaking large data transfers into pieces for delivery, and then reconstituting them at the other end.
- There are two main protocols that are used at this layer: TCP and UDP.
- TCP (Transmission Control Protocol):
- Reliable, ensures data arrives correctly
- Checks for errors and lost packets
- Slower due to these checks
- UDP (User Datagram Protocol):
- Faster but less reliable
- Doesn't check for errors or lost packets
- Better for streaming media, gaming
-
Network Layer (Layer-3)
- This layer handles packet forwarding and routing between different networks, i.e., routing!
- Provides logical addressing (e.g., IP addresses).
- Manages traffic control and packet sequencing.
-
Data Link Layer (Layer-2)
- Responsible for providing node-to-node data transfer.
- Detects and possibly corrects errors from the Physical layer.
- Defines how data is formatted for transmission.
- Includes MAC (Media Access Control) addressing.
-
Physical Layer (Layer-1)
- Responsible for Transmitting data over a physical medium, such as a cable or over-the-air.
- Defines hardware specifications (cables, switches, network interface cards).
- Handles the transmission and reception of raw bit streams.
The TCP/IP Model
- The TCP/IP model combines OSI layers 1 & 2 (Physical, Data Link) into a single layer 1 (Network Access).
- Similarly, layers 5, 6, 7 (Application, Presentation, Session) are combined into a single layer 4 (Application).
- It also renames the network layer (layer 3) to Internet.
Layer 1 - Network Access:
- Combines OSI layers 1 & 2 (Physical and Data Link)
- Handles the physical transmission of data and hardware-level protocols
Layer 2 - Internet:
- Renamed from the OSI Network layer (layer 3)
- Deals with logical addressing and routing
Layer 3 - Transport:
- Equivalent to OSI layer 4 (Transport)
- Manages end-to-end communication and data flow
Layer 4 - Application:
- Combines OSI layers 5, 6, & 7 (Session, Presentation, and Application)
- Handles high-level protocols and user interfaces
Notes:
- The TCP/IP model is more compact than the OSI model.
- It merges multiple OSI layers into single layers in some cases.
- The "Internet" layer in TCP/IP is essentially a renamed "Network" layer from OSI.
- This model is more closely aligned with how networks actually operate in practice.