The OSI model is a framework that defines how data travels across a network by dividing communication responsibilities into distinct layers, each with a specific role in preparing, addressing, and delivering data. From application-level protocols like HTTP to physical bit transmission over Ethernet, each layer adds or interprets information to move data reliably from source to destination.
OSI Model Layers
We're going to get into the OSI model layers and start understanding what each layer is responsible for.
We're going to start out at layer 7, and I want to give an example of HTTP, one of the most common protocols that are out there. Actually, HTTP is really being replaced by HTTPS. HTTPS is the same thing, except it's HTTP Secure. It adds an element of security by using SSL/TLS to be able to secure or encrypt that data.
So we've got this application layer, and we're going to actually treat layers 5 through 7 all at once here. We're going to explain that all at once, because HTTP really just has this one layer, this layer 7, or layer 5 through 7, or however you want to express that. It really doesn't do these separate connections. In fact, a lot of our common protocols nowadays, these layers 5 through 7, is all just one layer here. So we've got HTTP traffic here. We call this data. At this point in time, on these three layers, it's just data. If we were actually having these three layers separated out, there'd just be a manipulation of this data that would happen here, but we just call this data.
So what does this look like? The application layer, layer 7 here, is an app on this side talking to an app on this side. It's just software. It's just a program that's running on either side here. On this side right here, since we're talking about HTTP, so we're doing all web traffic, we're going to open up a browser on this side. So the app that we're using would be Safari or Chrome or Firefox. Let's just use Chrome as an example right here. And it's connecting to some sort of software on this side. So let's say Apache is running over on this side. So we've got our Chrome that's going to be connecting to Apache. So Chrome needs to make a request to Apache. What it's going to use is this HTTP protocol. And so now we have a protocol that's going to make the request on this side to this Apache server. And then there's going to be a response that comes back. So that's the application layer. The application layer is just two applications talking to each other.
Layer 4 is the transport layer, and we're going to use an example of TCP. TCP is a protocol, and it's one of the most common protocols that are out there for this layer 4 here. We call layer 4 the segment, and one reason is because we break this data down into smaller segments. So we've got data into a smaller segment here now, and we're adding some information here at the beginning. So we're adding a TCP header at the front of this.
Here are some of the things that layer 4 is responsible for, especially TCP. So let's take a look at a few of these. First of all, we have segmentation. So in this case, right now, we're requesting web services. Let's say that message is really large and it needs to be broken down into smaller pieces. Now, in actuality, a request would just take a packet or two. A simple request wouldn't be four packets big, but let's say this is an awfully large request for some reason, and so now we need to break it down into these little segments. So we've got our segments here. And of course, since we have segments, we need to put it in a sequence, so we're going to add sequence numbers to it. Now, TCP uses sequence numbers that look quite a bit different than this, but this will get us to the point of what it's trying to do. So it adds sequence numbers so that way this server knows what order those segments go in.
And then another thing that this layer is responsible for is connections. So instead of just flat out making the request and saying, hey, give me this web page, what will happen is like a little introductory that will happen first. So there'll be a packet that's sent over that says, hey, I'd like to talk with you. And then there's a packet that's sent back and says, okay, let's talk. And then there's one more exchange that says, great, we're talking now. So there's this three-way handshake that happens. So it just establishes a connection. It also terminates a connection. So that's all part of layer 4, that's responsible for that.
Another thing is that this server could have DNS running on it. It could have DHCP running on it. It could have our web server, so maybe it's got Apache running on it. It actually could have a lot of different services on it. So how do we address a specific server or service? That's where the ports come into play. So it's port 80 if it's HTTP, and it's port 443 if it's HTTPS. So those are the different ports that are running on this for Apache, so Apache can deliver this website. So what will happen is layer 4 will have that port that it's trying to address, the destination port. And if the destination port is port 80, then it's probably HTTP traffic. And if it's 443, then it's probably HTTPS.
Another thing that will happen is we've got to count on some of these packets maybe not making it to its final destination. So what happens is there's the sequence numbers that get sent over. 1, 2 and 4 get over here. And there's an acknowledgement that happens. And I'm not going to get in depth into what the acknowledgement looks like, but essentially the acknowledgement will flag that it didn't receive packet 3, and then this machine then will retransmit packet 3. So layer 4 is responsible for retransmission.
And then we also have flow control. So the flow control here is there's an acknowledgement that happens every once in a while. And if this machine doesn't receive an acknowledgement — it'll wait to receive an acknowledgement now and then, and so therefore it will send a group of packets over and then wait for an acknowledgement, send another group of packets over and then wait for acknowledgement. So it will wait for those acknowledgements, and if it doesn't receive an acknowledgement, then it will wait a little bit longer. So therefore you don't get all this buildup, all this congestion. It just doesn't keep sending things over. So it's responsible for flow control. So that's layer 4.
Now, one thing to note about this is most of this is really specifically talking about TCP, which is one of the most common protocols at layer 4. But if you're looking at UDP, which is another common protocol at this layer, it looks quite a bit different. So just because TCP has all of this, and we're going to talk about layer 4 having all of this, doesn't mean that every protocol has all of this.
Next up, we have layer 3, the network layer. Some examples of that are IP version 4, IP version 6, and ICMP. All common protocols. IP version 4 being our most common right now, but we're trying to transition that to IP version 6. This is called the packet. And so a lot of times you'll hear me refer to the packet, because the packet remains the same going from location A to location Z, all the way along the way. It remains relatively the same. And so a lot of times we just refer to everything that we're sending over as being a packet. In fact, when I was talking about the segment one time, I called it a packet as well, because the segment goes into the packet. We're just adding a header, this IP header, to the front of the segment. So we've got our segment, and now we've got a packet. The packet is the whole thing.
And the biggest thing that layer 3 is responsible for is getting it to its destination. So addressing — we've got addressing and routing. So we have a machine right here trying to talk to another machine over here, and we add the destination IP address. We also add the source IP address, but the key to this is the destination IP address. It gets sent over and routed to this other location. Now, the cloud, we just put it in there because it represents a lot of different routers. It'll go through a lot of different routers to get to its final destination and get routed to there. And we use the cloud because it's not all mapped out, and so it's just representative of all these networks that are in between these two locations.
A lot of times when I talk about routing, I'll use this as an example instead. So if this machine is talking to this machine, we send over this packet and it gets to this router right here. And the router then chooses, okay, I need to get to this network right here to get to this location, so how do I do that? Well, I'm going to send it either this way — looks like I can get there from there — or this way, I can get there from there as well. So I'll choose one of these. I'll send it to the next hop, which then will send it to the next hop, to be delivered. And it all does that based off of that layer 3 header, which has the IP address.
And then for that local delivery, we have this layer 1 and 2. And with layer 1 and 2, we're going to be talking about Ethernet. And Ethernet really straddles both layers 1 and 2. So we can associate this 100BASE-T and Ethernet. This is all kind of Ethernet technology arena right here. So we just call it Ethernet here.
The protocol data unit, we call this a frame. And the physical layer, we just call bits. It's a stream of bits here. And so we add a frame. We add a header frame on here, or we could also add maybe a trailer at the end. And what this does is it just allows it to communicate on that local network.
And the bits — there is a little bit that gets added with the bits. For the most part, it's just this little starter. We call it the preamble. Something that just kind of wakes up the equipment on the other side. So maybe it sends a series of like 1 0 1 0 1 0 1 0 to say, hey, I'm starting this transmission, so you better wake up because here it comes. And the key to this is that layer 2 is for that local delivery here. So it's just so it can send it on its local network to its destination, and then those will be dropped off only to be recreated on the next segment.
Here's one final glance at all of those different layers there. And so they all work together to deliver data from one location to another.
TechKnowSurge builds IT and cybersecurity professionals through hands-on, concept-first training built around real understanding — not memorization. Free interactive tools, structured programs, and 25+ years of real-world experience, all in one place.
Explore free tools and programs →