What is OSI 7 Layer Model?
In 1978, ISO developed an architecture that would allow the devices of different manufacturers to work together to communicate with different operating systems. In 1984, the ISO architecture became an international standard known as the Open Systems Interconnection (OSI) reference model.
This architecture determines how hardware, software,topologies, and protocols exist and operate on a network. The OSI model is based on seven layers, as shown in the following figure. Each layer adds functionality to the previous layer and communicates with the layers directly above and below it.
This model defines seven Layers that describe how applications running upon network-aware devices may communicate with each other. The model is generic and applies to all network types, not just TCP/IP, and all media types, not just Ethernet.
In an exchange between users, there will be a flow of data through each layer at one end down through the layers in that computer; and when the message arrives at its destination, there will be another flow of data up through the layers in the receiving computer that ultimately ends up at the application.
The seven layers of the OSI reference model can be divided into two categories: upper layers and lower layers. The upper layers of the OSI model deal with application issues and generally are implemented only in software. The lower layers of the OSI model handle data transport issues. The physical layer and the data link layer are implemented in hardware and software.
It should be noted, however, that most protocols in day-to-day use work on a slightly modified layer system. TCP/IP, for example, uses a 6- rather than a 7-layer model. Nevertheless, in order to ease the exchange of ideas, even those who only ever use TCP/IP will refer to the 7-layer model when discussing networking principles with peers from a different networking background.
1. Physical Layer
The Physical layer (Layer 1) handles the mechanical and electrical communications. In other words, it translates bits (0s and 1s) into data that can be transmitted.
Layer 1 specifications determine the shape, size, and pin-out of connectors; what voltages and currents are used; and how the physical media and electrical components work together.
Devices that operate at the Physical layer include network interface cards (NIC), hubs, repeaters, multistation access units, media filters, and transceivers.
2. Data Link Layer
The Data Link layer (Layer 2) provides flow, error control, and synchronization for the Physical layer. It takes information from the Network layer and sends it to the intended device through the Physical layer on the same network.
The specifications defined at this layer are network and protocol characteristics. This includes physical addressing, network topology, error notification, sequencing of frames, and flow control.
- Physical addressing defines how devices are addressed.
- Network topology determines the specifications that define how devices are to be physically connected.
- Error notification alerts upper-layer protocols that a transmission error has occurred.
- Sequencing reorders frames that are transmitted out of order.
- Flow control monitors the transmission of data so that the receiving device is not overwhelmed with more traffic than it can handle at one time.
3. Network Layer
The Network layer (Layer 3) manages the routing of packets that are to be forwarded on to different networks.
The Network layer relies on the use of routable protocols to deliver packets to distant networks. The Network layer defines the network address, which is different from the MAC (Media Access Control) address. The MAC address is considered the physical address, and the network address is considered the logical address.
Because this layer defines the logical network layout, routers can use it to determine how to forward packets. Because routers function at this layer,much of the design and configuration of a network is done here.
See the following figure for examples of the devices that operate on the first three layers of the OSI model.
The Network Layer provides the functional and procedural means of transferring variable length data sequences from a source host on one network to a destination host on a different network, while maintaining the quality of service requested by the Transport Layer (in contrast to the data link layer which connects hosts within the same network). The Network Layer performs network routing functions, and might also perform fragmentation and reassembly, and report delivery errors. Routers operate at this layer—sending data throughout the extended network and making the Internet possible. This is a logical addressing scheme – values are chosen by the network engineer. The addressing scheme is not hierarchical.
The Network Layer may be divided into three sub-layers:
- Subnetwork Access – that considers protocols that deal with the interface to networks, such as X.25;
- Subnetwork Dependent Convergence – when it is necessary to bring the level of a transit network up to the level of networks on either side
- Subnetwork Independent Convergence – which handles transfer across multiple networks.
4. Transport Layer
The Transport layer (Layer 4) manages the connection between the source and the destination to ensure that the data has reliable delivery. The Transport layer accepts data and segments it for transport across the network. Generally, the Transport layer is responsible for making sure that the data is delivered error free and in the proper sequence.
Flow control generally occurs at the Transport layer. Flow control manages data transmission between devices so that the transmitting device does not send more data than the receiving device can process.
Reliable delivery involves error checking and recovery. Error checking involves detecting transmission errors, while error recovery involves acting to resolve any errors that occur.
Transport protocols can be characterized as being either connection-oriented or connectionless. In general, connection-oriented services provide some level of delivery guarantee, whereas connectionless services do not.
- Connection-oriented services must first establish a connection with the desired service before passing any data.
- A connectionless service can send the data without any need to establish a connection first.
Connection-oriented service involves three phases: establishing the connection, transferring the data, and terminating the connection. The protocol is also responsible for putting the packets in the correct sequence before passing on the data. Connection-oriented network services have more overhead than connectionless ones. Connection-oriented services must negotiate a connection, transfer data, and tear down the connection, whereas a connectionless transfer can simply send the data without the added overhead of creating and tearing down a connection.
An example of this is similar to the difference between regular mail and certified mail. Using regular mail delivery, you mail a letter and assume it will get there. Using certified mail delivery, the Post Office contacts the recipient, gives them the mail, and makes them sign for it.
OSI defines five classes of connection-mode transport protocols ranging from class 0 (which is also known as TP0 and provides the least features) to class 4 (TP4, designed for less reliable networks, similar to the Internet). Class 0 contains no error recovery, and was designed for use on network layers that provide error-free connections. Class 4 is closest to TCP, although TCP contains functions, such as the graceful close, which OSI assigns to the Session Layer. Also, all OSI TP connection-mode protocol classes provide expedited data and preservation of record boundaries. Detailed characteristics of TP0-4 classes are shown in the following table:
5. Session Layer
The Session layer (Layer 5) manages the communication between the applications after a connection is made. It sets up the session, manages the information exchanges, and then breaks it down when the session ends.
The Session layer establishes, manages, and terminates communication sessions. These sessions consist of service requests and responses that occur between applications located in different network devices. The sessions are coordinated by protocols implemented at this layer. It also monitors the identification of the session participants to be sure that only nodes that are authorized can participate in the session.
An example of this is a conference call. To connect, you need a participant number. The call is usually run by a moderator who decides who can talk and for how long. The call ends when the moderator disconnects.
The Session Layer controls the dialogues (connections) between computers. It establishes, manages and terminates the connections between the local and remote application. It provides for full-duplex, half-duplex, or simplex operation, and establishes checkpointing, adjournment, termination, and restart procedures. The OSI model made this layer responsible for graceful close of sessions, which is a property of the Transmission Control Protocol, and also for session checkpointing and recovery, which is not usually used in the Internet Protocol Suite. The Session Layer is commonly implemented explicitly in application environments that use remote procedure calls.
6. Presentation Layer
The Presentation layer (Layer 6) formats the data for exchange between the Application layer and the Session layer. Data compression and encryption also occur at this layer. This layer converts incoming and outgoing data from one presentation format to another through the use of standard image, sound, and video formats; standard data compression schemes; and standard data encryption schemes.
Presentation layer implementations are not typically associated with a particular protocol stack. Some well-known standards include Motion Picture Experts Group (MPEG), Graphics Interchange Format (GIF), Joint Photographic Experts Group (JPEG), and Tagged Image File Format (TIFF).
This is where application data is either packed or unpacked, ready for use by the running application. Protocol conversions, encryption/decryption and graphics expansion all takes place here.
The Presentation Layer establishes context between Application Layer entities, in which the higher-layer entities may use different syntax and semantics if the presentation service provides a mapping between them. If a mapping is available, presentation service data units are encapsulated into session protocol data units, and passed down the stack.
This layer provides independence from data representation (e.g., encryption) by translating between application and network formats. The presentation layer transforms data into the form that the application accepts. This layer formats and encrypts data to be sent across a network. It is sometimes called the syntax layer.
The original presentation structure used the basic encoding rules of Abstract Syntax Notation One (ASN.1), with capabilities such as converting an EBCDIC-coded text file to an ASCII-coded file, or serialization of objects and other data structures from and to XML.
7. Application Layer
The Application layer (Layer 7) provides the user interface for communication. The Application layer is the OSI layer closest to the end user, which means that both the OSI Application layer and the user interact directly with the software application. Application layer functions typically include file transfer, file management, message handling, and database query functions.
The Application layer also determines the availability of an application with data to transmit, and decides whether sufficient network resources for the communication exist. The Application layer is not itself an application that is communicating; rather it is a layer that provides application services. Some examples of Application layer implementations include Telnet, File Transfer Protocol (FTP), and Simple Mail Transfer Protocol (SMTP).
Application layer functions typically include identifying communication partners, determining resource availability, and synchronizing communication. When identifying communication partners, the application layer determines the identity and availability of communication partners for an application with data to transmit. When determining resource availability, the application layer must decide whether sufficient network or the requested communication exist. In synchronizing communication, all communication between applications requires cooperation that is managed by the application layer.
Some examples of application layer implementations also include:
On OSI stack:
- FTAM File Transfer and Access Management Protocol
- X.400 Mail
- Common management information protocol (CMIP)
On TCP/IP stack:
- Hypertext Transfer Protocol (HTTP)
- File Transfer Protocol (FTP)
- Simple Mail Transfer Protocol (SMTP)
- Simple Network Management Protocol (SNMP)