The OSI Model Explained
Looking to communicate between multiple computers over the network? Conceptually, the way that this is done between two applications can be described using the Open Systems Interconnection model (OSI). This describes a series of layers that take an application from one end user or service to another, and potentially back again. First defined in 1978 and later refined in 1984, there are seven layers in the model. It is important to point out again that this is a conceptual model. Networking protocols like TCP/IP may not explicitly use the model, but it is often described using the seven layers of the OSI model. Here is a look at each, from a top-down approach.
Layer 7: Application Layer
The easiest layer to understand is the application layer. It is how the user directly interacts with the network. Using a well-defined protocol like Hypertext Transfer Protocol (HTTP), you communicate between applications. You typically don’t care how the HTTP command travels under the covers between applications; you just know that when you send an HTTP command, the application (or Web server) at the other end knows how to process it. Domain Name System (DNS), Simple Mail Transport Protocol (SMTP), Telnet, File Transport Protocol (FTP) and Dynamic Host Configuration Protocol (DHCP) are all examples of application layer protocols.
Layer 6: Presentation Layer
The presentation layer takes the data from the application format, and then it converts it to the networking format, potentially encrypting or compressing the data representation. Nowadays, application and presentation layers may be combined to use XML or JSON for transport of data between applications. ASCII or Unicode can also be thought of as presentation layer examples, as each side needs to know how the networking commands are encoded. Other examples include Multi-Purpose Internet Mail Extensions (MIME) for email and the Secure Socket Sockets Layer (SSL) and Transport Layer Security (TLS) for data encryption.
Layer 5: Session Layer
The session layer is probably the least understood, as people tend to think of sessions maintained within the application layer, like the session of a browser. This layer is not that. Instead, it keeps multiple processes within an end-user application in sync. For instance, with something like a Skype video call, you need to keep the audio and video tracks in sync or else it looks like an old kung fu movie dubbed in English. The session layer helps keep track of synchronization points within the exchanged information. There is also a mechanism for checkpointing and recovery of sessions, though that is one aspect of the Session Layer that TCP/IP doesn’t take advantage of.
Layer 4: Transport Layer
In the OSI world, the transport layer provides a reliable means of sending data between two systems. With TCP/IP, it is the TCP side of the house. It provides the error correction, ordering, retransmission processing to make sure the session layer data gets from point A to point B. It makes sure your data gets delivered, like the post office. It doesn’t care what is inside, but gets the job done. As the U.S. Postal Service (USPS) creed says: Neither snow nor rain nor heat nor gloom of night stays these couriers from the swift completion of their appointed rounds.
Layer 3: Network Layer
The networking layer takes the complete data needed to transport across the network and breaks it up into packets or datagrams that are individually addressed for delivery. In the TCP/IP world, this is literally the IP side.
Layer 2: Data Link Layer
The data link layer provides a reliable data connection between two systems. It makes sure each packet created by the networking layer is transmitted successfully. If an error occurs during transmission, it is corrected and retransmitted. Ethernet, Wi-Fi, Token Ring, LACP (IEEE 802.3ad), and PPP are commonly known link layer protocols.
Layer 1: Physical Layer
The physical layer is probably the one most people are familiar with. It describes the protocol of how data goes from machine A to machine B. It defines how electrical signals (bits) are sent, received, and processed by physical equipment. Think ISDN, DSL, Coaxial Cable, Twisted Pair, or Optical Fiber here.
Nowadays, you tend not to think about much below the transport layer when communicating over the Internet. Everything is typically done using well-defined protocols that work on top of TCP/IP typically. However, everything still tends to be described in terms of layers of the OSI model.
Doing a complete mapping of the OSI model to the TCP/IP model will change the seven OSI layers to just four with TCP/IP. You will still find the Application layer at the top, but that literally replaces the top three layers of the OSI model, including all of the Presentation and Session layers. The Transport layer keeps its place, handling Host-to-Host connectivity. This is the Transfer Control Protocol (TCP) if you want reliable communications, or User Datagram Protocol (UDP) if unreliable is OK. Think video streaming with the latter, where it might be OK to lose a frame. The Network layer is now the Internet layer, handling the IP part of TCP/IP, either IPv4 or the newer IPv6. Below that is the Network Access layer, replacing the Data Link and Physical layers in the OSI model. If it is hard to grasp the actual differences between these two layers of the OSI model, you’ll appreciate the single true layer in the TCP/IP model.