Skip to content

OSI Model

Physical Layer (Layer 1)

The Physical Layer is the lowest layer of the OSI model, responsible for transmitting raw bits (0s and 1s) over a physical medium. It defines hardware specifications and signaling methods for communication.

Key Functions of the Physical Layer:

  • Bit Transmission – Converts digital data into electrical, optical, or radio signals.
  • Physical Media Specifications – Defines cables, fiber optics, and wireless standards.
  • Data Rate Control – Determines how fast data can be transmitted (bps, Mbps, Gbps).
  • Signal Modulation & Encoding – Converts digital signals into analog (for transmission) and vice versa.
  • Synchronization – Ensures sender and receiver are aligned in timing.
  • Topology & Transmission Modes – Defines network layout (bus, star, ring) and communication type (simplex, half-duplex, full-duplex).

Examples of Physical Layer Technologies:

  • Ethernet (Copper - Twisted Pair, Coaxial, Fiber Optic)
  • Wi-Fi (IEEE 802.11, Wireless Radio Signals)
  • Bluetooth, NFC
  • Optical Fiber (Light Transmission)
  • DSL, ISDN, 4G/5G Cellular Networks
  • RS-232, USB, HDMI, SATA (Interface Standards for Communication)

This layer doesn’t understand data structure or meaning—it just moves bits across the medium.


  • Role: Provides error-free transfer of data frames between devices on the same network and handles physical addressing.

Key Functions:

  • Framing: Divides data into frames (structured units) for transmission over the physical layer.
  • Error Detection and Correction: Ensures that frames are transmitted correctly by detecting errors (using CRC, for example) and requesting retransmission if necessary.
  • MAC Addressing: Uses Media Access Control (MAC) addresses to uniquely identify devices on a local network (Ethernet).
  • Flow Control: Manages the pace at which data is sent to prevent congestion on the network.
  • Link Establishment and Termination: Manages the establishment and termination of the data link between devices.

Protocols and Standards:

  • Ethernet: The most common protocol for local area networks (LANs), defining how data is packaged into frames and transmitted.
  • PPP (Point-to-Point Protocol): Used for direct communication between two devices, often over serial links or dial-up connections.
  • HDLC (High-Level Data Link Control): A protocol used for communication over synchronous serial links.
  • MAC (Media Access Control): The sublayer of the Data Link Layer that deals with device addressing and access control (e.g., Ethernet MAC addresses).

Examples in Action:

  • Ethernet: In a wired network, Ethernet protocols ensure that data frames are transmitted between devices within the same local network.
  • Wi-Fi (Wireless): Wireless networking standards like Wi-Fi also operate at the Data Link Layer to manage wireless frames and access control.
  • Switching: Network switches operate at the Data Link Layer, forwarding data based on MAC addresses.

The Data Link Layer is responsible for reliable communication over a physical link between two directly connected devices. It handles framing, error detection, flow control, and MAC addressing, ensuring that data is correctly formatted and transmitted within a local network.


Layer 3: Network Layer

  • Role: Handles routing, addressing, and traffic control to ensure data is delivered from the source to the destination across multiple networks.

Key Functions:

  • Routing: Determines the best path for data to travel across networks, ensuring it reaches the correct destination.
  • Logical Addressing: Uses IP addresses (IPv4/IPv6) to uniquely identify devices and route data across networks.
  • Packet Forwarding: Transmits data packets from the source to the destination based on the IP address, using routers to forward the data along the best route.
  • Fragmentation and Reassembly: Splits large packets into smaller ones for transmission and reassembles them at the destination.

Protocols and Standards:

  • IP (Internet Protocol): The core protocol for addressing and routing packets across the internet. It defines IP addresses and routing rules.
    • IPv4: 32-bit addressing system.
    • IPv6: 128-bit addressing system, used to accommodate the growing number of devices.
  • ICMP (Internet Control Message Protocol): Used for diagnostic purposes, such as the "ping" command to check connectivity.
  • ARP (Address Resolution Protocol): Resolves IP addresses to MAC addresses in local networks.
  • RIP, OSPF, BGP: Routing protocols used by routers to determine the best path for data.

Examples in Action:

  • Internet Communication: When accessing a website, the Network Layer handles routing the data from your device to the web server based on the IP address.
  • IP Addressing: Devices on a network are assigned unique IP addresses, allowing routers to direct data to the correct destination.
  • Ping Command (ICMP): Sends a request to check the availability of a network device, receiving a response if the device is reachable.

The Network Layer is responsible for routing data across networks, using logical addressing (IP addresses), and ensuring data is transmitted efficiently and correctly from source to destination, even across multiple networks.


Layer 4: Transport Layer

  • Role: Ensures reliable data transfer between devices, providing error detection, correction, and flow control.

Key Functions:

  • Segmentation and Reassembly: Divides large data from the application layer into smaller segments for transmission and reassembles them on the receiving end.
  • End-to-End Communication: Establishes and maintains communication between the sender and receiver, ensuring the data is delivered to the correct application.
  • Error Detection and Correction: Ensures data integrity by detecting errors during transmission and handling retransmissions.
  • Flow Control: Manages data flow to prevent congestion and ensure that the receiver isn’t overwhelmed by too much data.
  • Connection Management: Establishes, maintains, and terminates connections between devices.

Protocols and Standards:

  • TCP (Transmission Control Protocol): A reliable, connection-oriented protocol that ensures error-free delivery of data and guarantees the correct order of segments.
  • UDP (User Datagram Protocol): A connectionless, faster protocol that doesn't guarantee delivery or order, typically used in real-time applications like streaming.
  • SCTP (Stream Control Transmission Protocol): A message-oriented protocol designed to ensure reliable delivery with multi-homing support (e.g., for telecommunication systems).

Examples in Action:

  • Web Browsing (TCP): When a browser requests a web page, TCP ensures the data is transmitted reliably and in the correct order.
  • Streaming (UDP): Video or audio streaming uses UDP to send data quickly, prioritizing speed over reliability, as minor data loss is acceptable.
  • File Transfers (TCP): File transfer protocols like FTP use TCP to ensure all parts of the file are correctly received.

The Transport Layer is responsible for end-to-end communication, ensuring that data is segmented, transmitted reliably, error-free, and in the correct order. It manages flow control, error detection, and connection establishment.


Layer 5: Session Layer

  • Role: Manages and controls the communication session between two devices. It establishes, maintains, and terminates connections.

Key Functions:

  • Session Establishment: Initiates, maintains, and terminates sessions between applications on different devices.
  • Session Management: Keeps track of the conversation state, ensuring data is properly synchronized.
  • Data Synchronization: Handles checkpoints and recovery, allowing data transfer to resume from the last checkpoint in case of interruptions.
  • Full-Duplex/Half-Duplex Control: Controls the data flow in a communication session, ensuring proper transmission direction and speed.

Protocols and Standards:

  • NetBIOS: Network Basic Input/Output System for communication between devices on a local network.
  • RPC: Remote Procedure Call for allowing programs to execute code on remote systems.
  • SMB: Server Message Block used for sharing files and printers over a network.
  • PPTP: Point-to-Point Tunneling Protocol used for creating VPN connections.

Examples in Action:

  • Video Conference: The Session Layer manages the connection between the participants, ensuring that the session remains active and synchronized.
  • File Sharing: When transferring files, the session layer establishes the communication channel and ensures the integrity of the data exchange between devices.

The Session Layer is responsible for managing the sessions or connections between applications, ensuring proper data synchronization, session control, and recovery in case of interruptions.


Layer 6: Presentation Layer

  • Role: Translates, formats, encrypts, and compresses data for the application layer.

Key Functions:

  • Data Translation: Converts data between different formats (e.g., character encoding like UTF-8 to ASCII).
  • Data Compression: Reduces data size to optimize bandwidth and improve transmission efficiency (e.g., ZIP, gzip).
  • Data Encryption: Encrypts data to secure it during transmission (e.g., SSL/TLS).
  • Data Formatting: Ensures that data is in a readable and understandable format for both sender and receiver (e.g., image formats like JPEG or text formats like ASCII).

Protocols and Standards:

  • SSL/TLS: Provides encryption and secure communication (e.g., HTTPS).
  • MIME: Encodes binary data (like images or documents) into text for email transmission.
  • JPEG, GIF, PNG: Standards for compressing image files.
  • ASCII, EBCDIC: Character encoding formats for text data.
  • XDR: Standard for transmitting data in a platform-independent way, commonly used in RPC.

Examples in Action:

  • Web Browsers: Converts HTML, images, and other data into a readable format and uses SSL/TLS to secure the data.
  • Email: MIME encodes attachments so they can be transmitted over email.
  • Media Streaming: Compresses and formats video/audio data (e.g., MP4, MP3) for streaming.

The Presentation Layer ensures data is in the right format, compressed, and encrypted for secure and efficient transmission across the network.


Layer 7: Application Layer

  • Role: Provides end-user services and interfaces directly with the application to enable network communication.

Key Functions:

  • User Interface: Provides the interface for user interaction with applications (e.g., browsers, email clients).
  • Application Services: Supports specific network services like file transfer, email, or remote access (e.g., FTP, SMTP).
  • Data Representation: Ensures that data is understandable to the user or application.
  • Protocol Support: Defines communication rules for applications and manages network services (e.g., HTTP, FTP, DNS).

Protocols and Standards:

  • HTTP/HTTPS: Protocols for transferring web pages over the Internet (e.g., browsing websites).
  • FTP: File Transfer Protocol for transferring files between a client and server.
  • SMTP: Simple Mail Transfer Protocol for sending emails.
  • DNS: Domain Name System for translating domain names to IP addresses.
  • POP3/IMAP: Protocols for receiving and storing emails.
  • Telnet/SSH: Remote login protocols for accessing servers and other devices over the network.

Examples in Action:

  • Web Browsing: HTTP/HTTPS protocols manage communication between a web browser (client) and a web server.
  • Email Communication: SMTP sends emails, while POP3/IMAP fetches them from a mail server.
  • File Transfer: FTP allows users to upload/download files between a client and server.

The Application Layer directly interacts with the user, enabling network communication and providing services like web browsing, email, and file transfers. It defines the rules and protocols for application-specific communication.


How a Request and Response Move Through the OSI Model

When a client (e.g., a web browser) requests a webpage from a server, the data flows down the OSI model layers on the client-side, across the network, and then up the OSI layers on the server-side. The response follows the same process in reverse.


Step-by-Step Data Flow (Client to Server and Back)

1. Client Sends a Request (Web Page Request)

Example: A browser sends an HTTP request to www.example.com.

OSI Layer Function in Request Transmission
Layer 7: Application Browser creates an HTTP request (GET /index.html).
Layer 6: Presentation Encrypts data if HTTPS is used (TLS/SSL).
Layer 5: Session Maintains a session (e.g., keeps the user logged in).
Layer 4: Transport TCP divides data into segments, adds a sequence number, and attaches a source/destination port (e.g., 80 for HTTP).
Layer 3: Network Adds an IP header with source and destination IP addresses (e.g., 192.168.1.10 → 93.184.216.34).
Layer 2: Data Link Encapsulates into an Ethernet frame with source and destination MAC addresses.
Layer 1: Physical Converts frames into bits (electrical signals, fiber optics, or radio waves) and transmits over the network.

2. Data Travels Through the Network

  • The router reads the IP Packet (Layer 3) and forwards it towards the destination.
  • The switch uses the MAC Frame (Layer 2) to send data to the correct network device.

3. Server Receives the Request

Once the request reaches the web server (www.example.com), the data moves up the OSI layers:

OSI Layer Function in Request Reception
Layer 1: Physical The server receives raw bits and converts them into frames.
Layer 2: Data Link The Ethernet Frame is processed, and the MAC address is checked.
Layer 3: Network The IP packet is examined; if the destination IP matches the server, it moves up.
Layer 4: Transport The TCP segment is reassembled, and ports are identified (HTTP uses port 80).
Layer 5: Session The session is maintained for this connection.
Layer 6: Presentation If HTTPS is used, the request is decrypted.
Layer 7: Application The web server (Apache, Nginx, etc.) processes the HTTP request.

4. Server Sends a Response (Web Page Data)

The web server generates an HTTP response (e.g., HTTP 200 OK) and sends it back down the OSI layers.

OSI Layer Function in Response Transmission
Layer 7: Application Web server sends an HTTP response with the requested HTML.
Layer 6: Presentation Encrypts the response if using HTTPS.
Layer 5: Session Maintains the session for the client.
Layer 4: Transport TCP segments are created with sequence numbers and a destination port.
Layer 3: Network The response is encapsulated into an IP packet with the source/destination IP addresses reversed (93.184.216.34 → 192.168.1.10).
Layer 2: Data Link An Ethernet frame is created with the server’s MAC address as the source and the client’s MAC as the destination.
Layer 1: Physical The bits are transmitted back to the client over the network.

5. Client Receives the Response

When the response reaches the client, it moves up the OSI layers:

OSI Layer Function in Response Reception
Layer 1: Physical The client receives raw bits and reconstructs them into frames.
Layer 2: Data Link The MAC address is checked, and the frame is extracted.
Layer 3: Network The IP packet is processed and checked against the client’s IP.
Layer 4: Transport TCP segments are reassembled, and data is sent to the correct port (e.g., 80 for HTTP).
Layer 5: Session The session is maintained for ongoing communication.
Layer 6: Presentation If encrypted, the response is decrypted (TLS/SSL).
Layer 7: Application The browser reads the HTTP response, renders the HTML, and displays the webpage.

Summary

  1. Client sends an HTTP request, which moves down the OSI layers.
  2. The request travels through the network via routers and switches.
  3. Server receives the request, processes it, and sends a response back.
  4. Response travels back through the network following the reverse OSI process.
  5. Client receives and processes the response, rendering the requested webpage.

This breakdown applies to any network communication, including emails (SMTP), file transfers (FTP), and video streaming. Let me know if you need a deeper dive into any part.


How Data is Converted to Bits in Networking

When a computer sends data over a network, the information is broken down from human-readable content into raw binary (bits) before transmission. This process happens step by step as the data moves down the OSI model.

This area of content is merely scraping the depth of what each frame, packet or segment holds. ie A single IPV4 packet holds a vast range of header fields, such as flags, TTL, header checksum,DSCP, version and many more. This is why understanding a simple concepts first help. This page does not dive into holdings of these packets and frame in detail.


1. Data Breakdown Through OSI Layers

Layer Data Unit (PDU) What Happens to the Data?
Layer 7: Application Data Raw data (e.g., an HTTP request, email, or file) is created.
Layer 6: Presentation Data If needed, the data is encrypted, compressed, or encoded (e.g., TLS for HTTPS).
Layer 5: Session Data Ensures session integrity (e.g., maintaining an open HTTP session).
Layer 4: Transport Segment (TCP) / Datagram (UDP) The data is split into segments, adding source and destination ports.
Layer 3: Network Packet Each segment gets encapsulated into an IP packet with source/destination IPs.
Layer 2: Data Link Frame The IP packet is wrapped in an Ethernet frame with MAC addresses.
Layer 1: Physical Bits The Ethernet frame is converted into bits (binary 1s and 0s) and transmitted as electrical signals, light pulses, or radio waves.

2. Step-by-Step Breakdown of Data to Bits

A. Application Layer (Raw Data)

  • Example: A user types www.example.com into a browser.
  • The browser creates an HTTP request (GET /index.html).
  • The data is still human-readable text.

B. Presentation Layer (Encoding & Encryption)

  • If the connection is secure (HTTPS), TLS encryption is applied.
  • The text is now transformed into an encrypted binary format.

C. Transport Layer (TCP/UDP Segmentation)

  • The data is divided into segments (for TCP) or datagrams (for UDP).
  • A header is added containing:
  • Source and destination ports (e.g., 12345 → 80 for HTTP).
  • Sequence numbers (for reordering packets at the receiver).

D. Network Layer (IP Packets)

  • Each segment is encapsulated into an IP packet.
  • An IP header is added containing:
  • Source and destination IP addresses (e.g., 192.168.1.10 → 93.184.216.34).
  • Time To Live (TTL), so packets don’t loop indefinitely.
  • The IP packet is encapsulated into an Ethernet frame.
  • A frame header is added containing:
  • Source and destination MAC addresses.
  • EtherType field to indicate the network protocol (IPv4, IPv6).
  • A frame check sequence (FCS) is added for error detection.

F. Physical Layer (Bits)

  • The Ethernet frame is converted into bits:
  • 1s and 0s (binary) represent the entire frame.
  • These bits are converted into electrical signals (copper cables), light pulses (fiber optics), or radio waves (Wi-Fi).
  • Example binary sequence:
    01101010 10111011 11010101 00001111...
    
  • The network card (NIC) converts the binary into signals and sends it through the medium.

3. How the Receiver Reconstructs the Data

The receiving computer follows the reverse process, moving up the OSI layers:

  1. Physical Layer: Converts signals back into bits.
  2. Data Link Layer: Reads the Ethernet frame, extracts the IP packet.
  3. Network Layer: Checks the IP header, extracts the TCP/UDP segment.
  4. Transport Layer: Uses sequence numbers to reassemble data in order.
  5. Session Layer: Maintains the session state.
  6. Presentation Layer: If encrypted, decrypts and decodes the data.
  7. Application Layer: The browser reads the HTTP response and displays the webpage.

4. Summary

  • Application Data (e.g., HTTP request) is processed.
  • Segmentation occurs at the Transport Layer.
  • Encapsulation into IP packets at the Network Layer.
  • Framing at the Data Link Layer with MAC addresses.
  • Bits are transmitted via Physical Layer using electrical, optical, or radio signals.

This layered breakdown ensures reliability, security, and efficient data transmission. Let me know if you need further details.