The OSI (Open System Interconnection) Model

The most popular packet-based structure of layers, or protocol stack, is called the OSI model (Open System Interconnection) which was created, oddly enough by the reverse acronymn, the ISO (International Organization for Standardization).  It defines 7 layers.  The user interface (Application Layer) is the top layer, since users work directly with applications.  As you work your way down toward the lower layers, the protocols become more detailed toward the nuts and bolts of the operation.  They define the details of actually preparing and moving data.  

Although there is officially no layer 0 or 8 - conceptually they exist as the physical link (the cable) and the User, as shown below.  Note how the packets get larger as each successive layer adds it's own header to the packet that was handed down to it from the layer above.

NOTE:  a unit of data at Layer 1 can be a single "bit" or a framed set of bits, depending on your interpretation.  Actually, for all layers, there is a frames series of bits, and this series of bits could be viewed one at a time, in which case the units of data is simply a bit.  The most common telecom transmission standard is the T-carrier system (DS0, DS1or T1, DS3 or T3), and it uses "frames" to transmit data, where each frame is composed of 193 bits and the 193rd bit is the framing bit, used for synchronization (see Telecom 101). 

 

Other Interconnection Models

Although OSI is by far the most popular - there are other models as well.  Pay particular attention the the TCP/IP layered model below, and how it relates to the OSI model:

The 7 Layers

Although there are seven layers in the OSI model, they can be grouped into three areas:

The following Table describes each layer:

Application
(Layer 7)
This layer supports application and end-user processes. Communication partners are identified, quality of service is identified, user authentication and privacy are considered, and any constraints on data syntax are identified. Everything at this layer is application-specific. This layer provides application services for file transfers, e-mail, and other network software services. Telnet and FTP are applications that exist entirely in the application level. Tiered application architectures are part of this layer.
Presentation
(Layer 6)
This layer provides independence from differences in data representation (e.g., encryption) by translating from application to network format, and vice versa. The presentation layer works to transform data into the form that the application layer can accept. This layer formats and encrypts data to be sent across a network, providing freedom from compatibility problems. It is sometimes called the syntax layer.
Session
(Layer 5)
This layer establishes, manages and terminates connections between applications. The session layer sets up, coordinates, and terminates conversations, exchanges, and dialogues between the applications at each end. It deals with session and connection coordination.
Transport
(Layer 4)
Usually TCP (the top half of TCP/IP). This layer provides transparent transfer of data between end systems, or hosts, and is responsible for end-to-end error recovery and flow control. It ensures complete data transfer.
Network
(Layer 3)
Typically IP (the bottom half of TCP/IP).  This layer provides switching and routing technologies, creating logical paths, known as virtual circuits, for transmitting data from node to node. Routing and forwarding are functions of this layer, as well as addressing, internetworking, error handling, congestion control and packet sequencing.
Data Link
(Layer 2)
Ethernet, ATM, Frame Relay, etc.  At this layer, data packets are encoded and decoded into bits. It furnishes transmission protocol knowledge and management and handles errors in the physical layer, flow control and frame synchronization. The data link layer is divided into two sublayers: The Media Access Control (MAC) layer and the Logical Link Control (LLC) layer. The MAC sublayer controls how a computer on the network gains access to the data and permission to transmit it. The LLC layer controls frame synchronization, flow control and error checking.
Physical
(Layer 1)
This layer conveys the bit stream - electrical impulse, light or radio signal -- through the network at the electrical and mechanical level. It provides the hardware means of sending and receiving data on a carrier, including defining cables, cards and physical aspects. Fast Ethernet, RS232, and ATM are protocols with physical layer components.

 

OSI Model Terminology (for the units of data passed between Layers)

The Problem

The Problem - the OSI model has 7 layers that communicate with one another by passing units of data.  The unit of data at Layer N is called a PDU (Protocl Data Unit), and the unit of data at the Layer above that (Layer N+1) is called an SDU (Service Data Unit).  This is confusing, since there is no single term for a unit of data !!

The Solution and why it is not a good One - only high-tech folks that work with the nuts and bolts of datacom refer to these units of data as PDU's or SDU's.  For the masses, and even most technical folks - they are most frequently called messages, and some call them packets.  Unfortunately, messages and packets are also used to refer to units of data at a single layer !!!  For example, a packet usually refers to a Layer 3 IP packet.

The Terminology

Communication between Layers (Vertical Communication)

Moving from the top, down - messages get larger and larger ! !   A message is passed down, and the lower layer adds a header to it.  This is called encapsulation, because it is like placing an object into a capsule.  The header is sometimes called a wrapper.  Each successive lower layer encapsulates what it receives from the layer above it. 

Moving from the bottom, up - messages get smaller and smaller ! !  A message is first stripped of it's header, and then the inner contents (the "data" portion) is passed up.  This is "decapsulation" but no one uses that term.  Each successive upper layer receives the data message from the layer below, and then strips off it's own header and passes the data up.

 

OSI Model Communication between two Stations (Horizontal Communication)

Let's consider how these corresponding layers communicate using protocols. First, recall that every layer in the model, except the bottom (physical) layer, is really a program or algorithm running on a computer. There is no way for, say, a Web browser and a Web server to actually connect together directly—they are just software programs, after all. Instead, the software running at various layers communicates logically. That is to say, through the use of software and procedures, a process running at layer 5 on one machine can accomplish logical communication with a similar process running at layer 5 on another machine.

Since machines are only physically connected at layer 1, this means that in order for a protocol at layer 5 to function, the data on the sending machine must “pass down” the data through the layers between layer 5 and layer 1. The data is then transmitted over the physical connection to layer 1 of the other machine, and “passed up” the protocol stack of the receiving machine to layer 5. This is how the two machines are logically linked at layer 5, even though they have no physical connection at that layer.

Thus, with the exception of the actual physical connection at layer 1, all horizontal communication also requires vertical communication—down the stack on one machine, and then back up the stack on the other. The communication doesn’t always go all the way back up the stack for each connection, however, as in the case of routing.

 

The term “protocol” has many meanings; in the context of the OSI Reference Model, it refers specifically to software or hardware elements that accomplish communication between corresponding layers on two or more devices. For example, the Internet Protocol is said to be a layer 3 protocol because each device uses IP software to communicate at layer 3. The actual transmission and reception of data only occurs at the lowest, physical layer; higher-layer protocols communicate logically, by passing data down interfaces until it reaches layer 1, transmitting at layer 1, and then passing the data back up to the appropriate layer at the recipient.

Protocols are what describe the rules that control horizontal communication, that is, conversations between processes that run at corresponding layers within the OSI Reference Model. At every layer (except layer one) these communications ultimately take the form of some sort of message that is sent between corresponding software elements on two or more devices. Since these messages are the mechanism for communicating information between protocols, they are most generally called protocol data units (PDUs). Each PDU has a specific format that implements the features and requirements of the protocol.

Layer Services and Data Encapsulation

As we’ve already discussed in our look at protocols, the communication between layers higher than layer one is logical; the only hardware connection is at the physical layer. Thus, in order for a protocol to communicate, it must pass down its PDU to the next lower layer for transmission. We’ve also already seen that using OSI terminology, lower layers are said to provide services to the layers immediately above them. One of the services each layer provides is this function: to handle and manage data received from the layer above.

At any particular layer N, a PDU is a complete message that implements the protocol at that layer. However, when this “layer N PDU” is passed down to layer N-1, it becomes the data that the layer N-1 protocol is supposed to service. Thus, the layer N protocol data unit (PDU) is called the layer N-1 service data unit (SDU). The job of layer N-1 is to transport this SDU, which it does in turn by placing the layer N SDU into its own PDU format, preceding the SDU with its own headers and appending footers as necessary. This process is called data encapsulation, because the entire contents of the higher-layer message are encapsulated as the data payload of the message at the lower layer.

What does layer N-1 do with its PDU? It of course passes it down to the next lower layer, where it is treated as a layer N-2 SDU. Layer N-2 creates a layer N-2 PDU containing the layer N-1 SDU and layer N-2’s headers and footers. And the so the process continues, all the way down to the physical layer. In the theoretical model, what you end up with is a message at layer 1 that consists of application-layer data that is encapsulated with headers and/or footers from each of layers 7 through 2 in turn, as shown below.

Each protocol creates a protocol data unit (PDU) for transmission that includes headers required by that protocol and data to be transmitted. This data becomes the service data unit (SDU) of the next layer below it. This diagram shows a layer 7 PDU consisting of a layer 7 header (“L7H”) and application data. When this is passed to layer 6, it becomes a layer 6 SDU. The layer 6 protocol prepends to it a layer 6 header (“L6H”) to create a layer 6 PDU, which is passed to layer 5. The encapsulation process continues all the way down to layer 2, which creates a layer 2 PDU—in this case shown with both a header and a footer—that is converted to bits and sent at layer 1.

Data Encapsulation in TCP/IP

The “N-1, N-2” stuff makes this seem more difficult than it really is, so let’s use a real-world (simplified) example instead. The Transmission Control Protocol (TCP) operates at layer 4 of the OSI model. It transmits messages called segments that contain data encapsulated from higher-layer protocols. The layer below TCP is the Internet Protocol (IP) at layer 3. It receives data from TCP and encapsulates it for transmission.

So, in the formal language of the OSI Reference Model, TCP segments are created as layer 4 PDUs. When passed to IP, they are treated as layer 3 SDUs. The IP software packages these SDUs into messages called IP packets or IP datagrams, which are layer 3 PDUs. These are in turn passed down to a layer 2 protocol, say Ethernet, which treats IP datagrams as layer 2 SDUs, and packages them into layer 2 PDUs (Ethernet frames) which are sent on layer 1. (Actually, in some technologies further encapsulation even occurs at layer one prior to transmission.)

On the receiving device, the process of encapsulation is reversed. The Ethernet software inspects the layer 2 PDU (Ethernet frame) and removes from it the layer 2 SDU (IP datagram) which it passes up to IP as a layer 3 PDU. The IP layer removes the layer 3 SDU (TCP segment) and passes it to TCP as a layer 4 PDU. TCP in turn continues the process, going back up the protocol layer stack. The complete process is illustrated below: