Layer 4 - The “Transport” Layer
Whereas layer 3 simply sent off its packets without caring about their ultimate destination, Layer 4 concerns itself with end-point communication integrity. You could say that layer 4 provides the service of managing end-to-end communications, and ensuring that the message both reaches its destination and is accurate and complete. Involved in this are the duties of tracking packet fragmentation, recognizing packets that are out of order, and solving other similar problems. The TCP protocol is on layer four, and excels at ensuring reliable communications. UDP is also a layer 4 protocol, though much less reliable.
Layer 5 - The “Session” Layer
The Session layer is one of the less glorious of the seven, its valuable role often being ignored. We’re going to give it the love it deserves, though. The Session layer is responsible for the maintenance of communication between two points. When you request communication with another point, such as a website, the Session layer is engaged in order to establish that communication - and then it stays into play ensuring that the session remains open and functional. When you are finished with your communication, the Session layer performs what is known in TCP as a “graceful close”, ensuring that the link is terminated.
Layer 5 figures heavily into environments that make use of Remote Procedure Calls (RPC). Layer 5 and RPCs have the potential of being exploited and abused. There are hacking scripts that will continually open sessions with a machine and not let them close, essentially overwhelming the resources of a computer. This will ultimately either lead to shutdown and reboot, or worse: If paging is enabled on the computer’s hard disk, this situation can be exploited to write malicious code to the disk, corrupting the entire machine. Think of it this way: Imagine a whole group of people wanting to shake your hand, and then not letting go. By the time the third hand is extended, you don’t have an available hand to intercept and the open palm instead morphs into a slap in the face.
Layer 6 - The “Presentation” Layer
The Presentation layer is by far the most confusing of the seven. It does very little that we can actually bear witness to, and its entire duty can essentially be summed up by: It turns network data into something that can be recognized by the Application layer. It doesn’t, however, deal with specific protocols such as HTTP, FTP, SMTP, etc, so its actual role is hard to define. Layer 6 is also responsible for some forms of encryption (though it is by far not the only layer capable of such).
Layer 7 - The “Application” Layer
The final Application layer is the one that lays closest to the end user - yes, a human being. This layer interacts directly with an application being used by an end user. A good example of the application would be a web browser that a user is using to surf the web. The Application layer protocol in use here is most likely HTTP (hyper-text transfer protocol) which provides encoded data to the browser that then reads it and presents it to us in the form of images, links, text, etc. Other layer 7 protocols include FTP, Telnet, and SMTP. All of these directly interface with a specific application, which is being used by the end user.
This post is part of the series: The OSI Reference Model
The 7-layer OSI Reference model is designed to organize and explain technology and protocols used in networking. The seven layers each have a unique role, and provide services to the layer above it. Using this reference model we can gain a better understanding of how networking works.