OSI (Open Systems Interconnection) is reference model for how applications can communicate over a network.This blog post describes a series of layers that take an application from one end user or service to another and back again. First defined in 1978 and later refined in 1984, there are seven layers in the model. It is important to mention again that this is a conceptual model.
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. 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.
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.