eli5 What the layers of the OSI Model do


I have memorized the 7 layers of the OSI model by watching Jeremy’s IT lab and Neil Andersons Udemy course. I understand how the physical, transport, and session layers work, but I don’t understand layers 2, 3, 6, and 7 work.

In: 2

**Application Layer** – Where humans and computers interact with each other.

**Presentation Layer** – Where the computer converts the data into something useable for people or usable for the network, as appropriate. Also where encryption/dectryption happens.

**Session Layer** – Manages the connections between computers.

**Transport Layer** – Transmits/receives the data sent between computers

***———- Dividing Line between your software and network hardware ———-***

**Network Layer** – Decides what path the transmitted data will take

**Data Link Layer** – Decides what the transmitted data will look like, or its format

**Physical Laye**r – The actual, physical path.

It’s worth noting that this is a conceptual framework and isn’t gospel by any stretch of the imagination.

Say you work in a big office building, and you need to send messages via letter to a colleague working at another big office building.

**Layer 1** is the **Physical** layer. It is concerned with all the details about how your message physically moves in the real world. In our analogy, that would cover details like, “Are your letters going to be delivered by truck, or by plane?”

**Layer 2** is the **Data Link** layer. This is concerned with how your messages need to be packaged up to “fit” through whatever physical layer you chose on each “hop” of its travel. Our letters will probably move through several post offices on their trip, “hopping” from one to the next. Each time a letter “hops” like that, it has to be sorted into a specific bundle of mail destined for that next stop, after which it will be un-bundled and scanned. Then, a choice is made where it needs to go next, and it is re-bundled and sent to the next stop. The data link layer handles the bundling, next-step sending, and un-bundling parts. Basically, everything that involves getting letters physically on and off trucks, and nothing else.

**Layer 3** is the **Network** layer. It is concerned with the details of the overall route from your office to your colleague’s office. It’s the `To:` and `From:` you wrote on the envelope. It also includes the decision-making part of the process described in the previous layer. For our letter example, that would be all of the machines inside the mail sorting facilities that read the To, From info and decide which post office it needs to be sent to next.

At this point we’ve more or less covered all the layers concerned with getting the letters physically delivered from one office building to another. Everything after this point is concerned more with how the letters move within the office buildings themselves, how the letters are split up, and how they are written.

**Layer 4** is the **Transport** layer. This layer is concerned with how you actually take the thing you need sending and chunk it up into pieces that can fit into all of the other layers we talked about. Like, the postal system has restrictions on how big and heavy a letter is allowed to be, right? If you have to send a *really big* letter, you may have to break it up into multiple envelopes and send them individually. The transport layer will dictate the details on how you break that big letter into chunks, and provide instructions for how the receiver on the other end should put them back together again. It may or may not also provide some protocols for sending acknowledgements about getting all the pieces (“Did you get Part 1?” “Yes, I got Part 1.” “Did you get Part 2?” “Yes, I got Part 2”, etc…) or provide instructions on how to proceed of some parts get lost (“I didn’t get Part 7.” “Oh, okay, I’ll send it again.”) It is *also* concerned with multiplexing. In our letter example, that would be, “Okay, so the letter made it to the *office building* it was heading for, but what *office number inside the building* should it go to?” It would also be like apartment numbers for getting mail sent to apartment complexes, or hotel rooms when you’re ordering pizza to a hotel, etc.

**Layer 5** is the **Session** layer. “Session” in this context is basically code for “conversation”. That is, this layer controls when a conversation is started and ended. You and your colleague may send a lot of individual messages back and forth, but logically, they are all a part of one big conversation. There are things you have to remember between messages for the contents of each new message to continue making sense. This has to be continually remembered until at some point, the conversation is considered “finished”, and you can go back to not thinking about it. If a new message comes in from your friend, it has to start a brand new conversation. You could even have multiple conversations all going on simultaneously, and the session layer should help you figure out which letters are a part of which conversation. If this example were email, the `Subject:` line would probably be part of the session layer.

**Layer 6** is the **Presentation** layer. It’s concerned with how the messages are actually written. What language are they written in? What are the grammar rules about where you put punctuation, paragraph breaks, etc? What font is it styled in? If you’re communicating in cipher, what cipher are you using? All of the stuff an end-reader would care about how the letter *looks* is dealt with here.

This is where the analogy breaks down quite a bit, as everything up to this point has been assuming that you and your colleague are actually both computers, not humans. So, in the analogy, the Presentation layer was concerned with stuff like how a physical written letter would appear, but in reality, it’s more about things like how a JSON file is structured. Stuff that the *computer* reading it would care about.

**Layer 7** is the **Application** layer. This is all about the computer, having finally read and understood the message, shows it to us stupid humans. What the program on your computer does with the raw data to make it visible to us. Whether that be displaying it on a screen, playing back sound, whatever. It also includes all of the stuff going the other way: interpreting human input controls via keyboard, mouse, etc, as instructions on what it should do next.