Purpose of the layered model
Designing a complete communication system requires electrical signals, addressing, error checking, data formatting, application interfaces, and many other functions. Describing all of these functions at once makes design difficult. The OSI model organizes them into layers.
The Open Systems Interconnection (OSI) Model is an abstract reference model that organizes the functions of a telecommunication or computing system into seven logical layers. It is not an implementation specification. Its primary purpose is to help systems from different manufacturers through a common reference point for designing network protocols.
Principles of layered communication
Communication in a layered model follows several principles:
- Abstraction: Each layer performs a specific, well-defined set of functions. Its operation does not require knowledge of the details of the layers above or below.
- Peer-to-peer communication: In the model, Layer N on the sending machine communicates logically with Layer N on the receiving machine. Peer layers use the same protocol.
- Services and interfaces: In an implementation, data passes vertically. Each layer provides services to the layer directly above it and uses the services of the layer directly below it through a well-defined interface.
The Process: Encapsulation and Decapsulation
As data moves down the stack on the sending device, a layer may add control information in a header or trailer. This process is called encapsulation. It resembles putting a letter into an envelope and then putting the envelope into a larger courier pouch. The unit of data at each layer has a specific name, known as a .
The receiver performs the reverse process, decapsulation, removing information added during encapsulation as the data moves up towards the application.
Protocol Data Units (PDUs) by Layer
- Layers 7, 6, 5 (Application, Presentation, Session): The PDU is generally referred to as Data.
- Layer 4 (Transport): The PDU is a Segment (for TCP) or Datagram (for UDP).
- Layer 3 (Network): The PDU is a Packet.
- Layer 2 (Data Link): The PDU is a Frame.
- Layer 1 (Physical): The PDU consists of Bits. In some transmission techniques, bits are represented by Symbols.
An Analogy: Sending an Office Memo
The roles of the layers can be shown through an office message sent by a project manager named Erik to a manager named Louis in another building.
- (Layer 7) Application - Erik, the Project Manager: Creates the original message or request (e.g., "Request for Q4 sales data").
- (Layer 6) Presentation - The Translator: Translates the message into a standard company format and language that Louis' office will understand. It may encrypt the message for confidentiality.
- (Layer 5) Session - The Cryptographer/Session Clerk: Establishes and manages the formal communication "session" with Louis' office, ensuring both sides are ready to communicate.
- (Layer 4) Transport - The Secretary: Takes the long message and splits it into numbered pages so it can be reassembled in the correct order. In this example, it represents reliable transport and handles acknowledgements.
- (Layer 3) Network - The Postmaster: Puts the pages into an envelope with Louis' full mailing address (street, city, zip code). Chooses an overall route for the mail truck.
- (Layer 2) Data Link - The Mailroom Clerk: Takes the envelope from the postmaster and puts it in the correct local courier bag for the next stop (e.g., the bag going to the downtown postal hub). Adds a local delivery tag.
- (Layer 1) Physical - The Courier (Van, Plane): The physical means of transport. The courier is responsible for moving the item from point A to point B.
The Seven Layers of the OSI Model
The seven OSI layers perform the following functions, from top to bottom.
Layer 7: Application Layer
The Application Layer is the closest to the end-user. It provides the interface through which applications access network services. Its scope includes protocols used by applications, without the programs themselves, such as a web browser.
- Functions: Network virtual terminal, file transfer, access and management (FTAM), mail services, directory services.
- Examples: HTTP, FTP, SMTP, DNS.
Layer 6: Presentation Layer
The Presentation Layer defines a data format that the receiving application can understand. It may handle data formatting, character-set conversion, compression, and encryption.
- Functions: Character code translation (e.g., ASCII to EBCDIC), data compression, encryption and decryption.
- Examples: SSL/TLS (an encryption mechanism operating above transport), JPEG, MPEG (image and video formats).
Layer 5: Session Layer
The Session Layer can establish, manage, and terminate communication sessions between applications. It handles dialogue control and synchronization by placing checkpoints in the data stream.
- Functions: Session establishment, maintenance and termination; dialogue control; synchronization.
- Examples: Protocols or functions associated with this layer: the NetBIOS Session Service and synchronization points.
Layer 4: Transport Layer
The Transport Layer provides end-to-end communication services between hosts. Depending on the protocol, it may provide segmentation of upper-layer data, flow control, error detection, and reliability mechanisms.
- PDU: Segment (TCP), Datagram (UDP).
- Functions: Segmentation and reassembly, connection control, flow control, error control.
- Protocols: TCP (reliable, connection-oriented), UDP (connectionless, with no delivery guarantee).
Layer 3: Network Layer
The Network Layer is responsible for logical addressing and forwarding packets across multiple networks. Routing mechanisms participate in choosing a path from source to destination.
- PDU: Packet.
- Functions: Logical addressing (IP addresses), routing.
- Devices: Routers.
- Protocols: IP (IPv4, IPv6), ICMP, OSPF.
Layer 2: Data Link Layer
The Data Link Layer provides transfer between adjacent nodes. Depending on the protocol, it may provide link addressing, framing, flow control, and error detection on the physical link.
- PDU: Frame.
- Functions: Framing, link addressing (e.g., MAC), flow control, error detection (e.g., CRC).
- Devices: Switches, Bridges.
- Protocols: Ethernet, HDLC, PPP.
Layer 1: Physical Layer
The Physical Layer defines the electrical, mechanical, and functional properties of a physical connection. It transmits signals representing bits over the physical medium.
- PDU: Bits.
- Functions: Defines voltage levels, pinouts, cable types, connectors (e.g., RJ-45), and signal timing.
- Devices: Hubs, repeaters, cables; Network Interface Cards (NICs) combine physical-layer and data-link functions.