Transcript for:
Understanding the OSI Model Layers

Hello, welcome to another lesson from the first module of my new course on networking fundamentals. In this lesson, we'll be taking a practical look at the OSI model. If you haven't seen the videos for lesson one, I'd highly recommend you start there. This lesson is simply a direct continuation of what I've heard in lesson one. That said, let's get into discussing the OSI model. The overall purpose of networking as an industry is to allow two hosts to share data with one another. Before networking, if I want to get data from this host to this host, I'd have to plug something into this host, walk it over to the other host, plug it into the other host. Networking allows us to automate all that by allowing the host to share data automatically across the wire. And for these hosts to do this, they must follow a set of rules. This is no different than any language. English has a set of rules that two English speakers must follow. Spanish has its own set of rules. French has its own set of rules. While networking also has its own set of rules. The rules for networking are divided into seven different layers and those layers are known as the OSI model. Now to give you an analogy, the human body is made up of various systems. The skeletal system, the respiratory system, the nervous system, the cardiovascular system, the muscular system. And if each of those systems are operating as intended, then the goal of the human body is attained, meaning the human lives. Well, networking works the same way. Each of the layers of the OSI model serve a specific function. And if all seven functions are accomplished, then the goal of networking is attained, which is to say, hosts can share data. Now, the goal of this lesson is not simply to memorize the OSI model. The goal of this lesson is to take a look at the purpose of each layer in the OSI model and see how it contributes to the overall goal of networking, which is allowing two hosts to share data with one another. That said, let's just jump right into it, starting with the first layer of the OSI model known as the physical layer. Data on computers exists in the form of bits, that is, ones and zeros. The first thing that needs to exist for these hosts to share data with another is something has to transport those ones and zeros from this computer to the next. That something is the physical layer. The goal of the physical layer is transporting bits. And anything that contributes to moving ones and zeros from this computer to this computer is considered a layer one technology. For example, cables all fall under the concept of layer one technologies. All of these cables serve the purpose of taking bits from one end and taking them out to the other end. But don't get too caught up on the word physical. The OSI model was written well before the idea of wireless internet communication was ever thought of. Wi-Fi is considered to be a layer 1 technology because Wi-Fi solely exists to carry ones and zeros from one computer to the next. Now not only do these cables or Wi-Fi exist at layer 1, there are some devices that also exist at layer 1. One of those devices is known as a repeater. In the last listen, we identified that repeaters simply amplify signals from one end out the other end. In a way, a repeater is really nothing more than something that allows you to extend a wire, meaning it contributes to this goal. Therefore, a repeater is considered to be a layer 1 technology, which means that multi-port repeaters, like hubs, would also be considered layer 1 technologies. All of these items serve the function of transporting bits from one computer to the next. That is the goal of layer 1. Which brings us to layer 2. Layer 2 is going to interact with the physical layer. It's going to actually put bits on the wire and retrieve bits from the wire, which means Whatever this wire actually connects to on this PC is considered a layer 2 item. Meaning the NIC or the network interface card that this wire is actually connected to on this computer is considered layer 2. The Wi-Fi access card is also considered layer 2 because it's interacting with those Wi-Fi radio waves. Now NICs and Wi-Fi access cards don't really look like this anymore, but there was a time when you had to buy separate cards and actually install them into computers and able to access the network or Wi-Fi. Nowadays, Wi-Fi access cards can fit in your smartphone or your watch. The overall goal of Layer 2 is what I'm going to call hop-to-hop delivery, meaning Layer 2 exists to take ones and zeros from this NIC and move it to the other NIC. This is what I'm calling a hop. Now, to accomplish this goal, Layer 2 is going to use a specific addressing scheme. That addressing scheme is known as a MAC address. MAC addresses are 48 bits which are represented as 12 hex digits. Here are three examples of a MAC address. Now in all cases, these are the exact same MAC address. The only thing that's different is how they're displayed. Windows machines typically use the dashes in between the hex digits. Linux machines typically use those colons. And Cisco routers and switches typically use the four hex digits with a dot in between. Either way, it's still just 12 hex digits, which are converted into 48 bits. The way it works is every single NIC has a unique MAC address. Meaning this computer's NIC over here has the MAC address A1A1, and this computer's NIC has the MAC address E8E8. Now I'm only showing you the first four digits of the MAC address simply to conserve screen real estate, but in reality this is what a MAC address looks like. Either way, this MAC address is what's going to allow data to go from one NIC to the next, i.e. from one hop to the next. So we've identified that NICs exist at layer 2. But there's another type of device that also exists at layer 2 and that is switches. Recall from the last lesson that we discussed that switches are devices which facilitate communication within a network. Meaning if these two hosts are connected via this switch, the switch is what's going to help traffic move along to accomplish this hop. Moreover switches allow you to connect many devices to them. If these two hosts want to speak to each other, The switch is going to internally connect these wires such that data can traverse this hop from this NIC to this NIC. So switches are considered layer 2 technologies because they aid in the accomplishment of this goal. Now generally with the internet you're commuting with things that are far away, not necessarily things that are in the same network. So it's very common for communication between hosts to require multiple hops, meaning we need to jump across multiple routers to get to the target host. Well, each of those routers are connected to a wire using a NIC, and therefore, each of those NICs have their own MAC addresses. And Layer 2 will handle taking data from the first MAC address and delivering it to the next MAC address, and then from this NIC to the next NIC, and then from this NIC to the next NIC, and then finally from this NIC to the next NIC. So you'll notice, in all cases, Layer 2 is handling the hop-to-hop delivery of data, which begs the question, If layer 2 is taking care of every hop, what's taking care of ensuring data goes from this endpoint to the next? Well, that's where layer 3 comes into play. Layer 3's goal is what's called end-to-end delivery. To accomplish its goal, layer 3 is going to use its own addressing scheme known as IP addresses. Now, we unpacked IP addresses in the prior lesson. IP addresses are 32 bits represented as four octets, each that can be the numbers 0 through 250. 55. Every host is going to be identified by its IP address. And these IP addresses are what's going to allow data to go from here all the way to here. Now, as you can see from this illustration, aiding in the goal of delivering data from end to end is routers. So routers are considered to exist at layer three of the OSI model. Hosts are also considered to exist at layer three of the OSI model. But really, anything with an IP address can be considered to exist at layer three. of the OSI model. Now at this point, a question typically comes up. And that question is, if we have IP addresses at layer 3, why do we need MAC addresses? Or alternatively, if we have MAC addresses at layer 2, why do we need IP addresses? Answering that question will help reveal how packets flow through the internet. The reason we have two different addressing schemes is that each of those addressing schemes serve different purposes. So let me show you. Let's say This host has some data that needs to send to this host. Now, of course, that data is just a bunch of ones and zeros. Layer 2 and layer 3 don't know what that data contains. It's just an arbitrary set of ones and zeros that need to get to this host over here. Since this computer knows the data needs to get to this endpoint over here, it's going to add some layer 3 information to that data. That layer 3 information is going to include the source IP address and the destination IP address. in order to get this data from one end to the other. But now this computer knows that the first step will be getting that data to the first router, which will prompt the computer to add Layer 2 information to that data. And that Layer 2 information is going to have a source MAC address of the computer's NIC and a destination MAC address of the first router's NIC. That's what's going to get this information to the first router. Once it gets there, we can remove that Layer 2 information. Remember, the whole purpose of that Layer 2 header was simply to get this construct from here. to here through the first hop. From this point, this router now knows that this needs to get moved to the next router. And it's going to do this by adding another layer2 header. But notice this time the source and destination MAC address identify these two MAC addresses. That's what's going to take this packet to the next router. And here, once again, we can get rid of that layer2 information. Again, the whole purpose of that layer two header was simply to get the packet from here to here. Since it did that successfully, we no longer need it. This process will continue with this middle router over here, adding layer two information that'll take care of this hop. And finally, the last router in the sequence will add the final layer two header, which will take the packet from this NIC to the end host NIC. Once it gets to the final host, again the Layer 2 header can be removed. The purpose of that header was again just to bring the packet from here to here. Moreover, the Layer 3 header can be removed, because the purpose of that header was to bring the data from here to here, from end to end. Finally, this gets the data to the computer, and the data can be processed by the receiving host. That is why we need both IP addresses and MAC addresses. because they serve different functions. And we've been talking about IP addresses and MAC addresses as independent functions. And indeed, they are. But I should mention at this point that there is a protocol that's going to tie these together. That protocol is known as the Address Resolution Protocol. It's going to link a Layer 3 address, like an IP address, to a Layer 2 address, like a MAC address. ARP is crucial to understanding how data flows through a network. We're going to be talking about ARP. later on in this module. But if you can't wait, I did write an article series that discusses all the different forms of ARP. You can access that series at pracnet.net slash ARP. As for us, that wraps up the first part of our practical discussion of the OSI model. In this video, we discussed layer 1, layer 2, and layer 3, and how each of those layers have a specific goal which contributes to how data flows through a network. In particular, we illustrated how layer 2 and layer 3 work together, to move data across the many different hops required to get data from one end to another. So that wraps up part one of our discussion. In part two, we'll pick up right where we left off, discussing the transport layer. But the main takeaways for this lesson are on your screen right now. I hope you enjoyed this video. I want to thank you for watching, and we'll see you in the next video as we continue our discussion of the OSI model. Hey YouTube, I hope you enjoyed that free lesson from my new course on networking fundamentals. I'll be releasing the entire first module for free here on YouTube. I want this course to be the ultimate networking fundamentals course. And since I'm still scoping out the outline, you could have a say in what topics will be covered. Let me know in the comments below what subjects you want included in this course. Otherwise, remember to like and subscribe. And of course, if you learned something from this video, the best way to thank me is to share this video. It's a small act of gratitude, but one I appreciate greatly. I hope you enjoyed this lesson. I want to thank you for watching and I'll see you in the next one.