TechKnowSurge
CompTIA Network+ 1.1 Cisco CCNA 1.1 Cisco CCST Networking 1.1 Cisco CyberOps Associate 4.8 Cisco CCNA 1.3 Cisco CCNA 3.2 Cisco CCST Networking 4.4
VideoNetworkFree

DEMO: Legos and the OSI Model

The OSI model defines how data is packaged, addressed, and transmitted across networks — from application-layer requests down through transport, network, and data link layers to physical signals. Each layer adds or removes specific information as data moves between devices on different network segments.

Complete this video to capture a CTF flag worth 1 point.

About this video

The OSI model provides a layered framework that explains how data travels from one application on one machine to an application on another, across any number of intermediate networks and devices. When a client requests a web page hosted by Apache on a remote server, the process begins at the upper layers — layers 5 through 7 — where the application data is generated. A TCP header is then added at layer 4 to identify the destination port, in this case port 80, ensuring the data is delivered to the correct service on the receiving machine. An IP header is added at layer 3, carrying the destination IP address that routers will use to forward the packet toward its final destination. Together, these headers encapsulate the payload in preparation for transmission across multiple networks. As the packet moves from router to router, the layer 1 and layer 2 headers are replaced at each hop to match the technology of the next link. The first local area network uses Ethernet, which provides both a MAC address for local delivery and a physical preamble to initialize communication on the wire. The connection between routers may use entirely different protocols — Point-to-Point Protocol over an ISDN line, HDLC over an RS-232 connection, or other combinations — each appropriate to the physical infrastructure in place between those specific devices. At each router, the incoming layer 1 and 2 headers are discarded once processed, the IP address is examined to determine the next hop, and a new layer 1 and 2 header is constructed for the outgoing link. When the packet finally arrives at the destination machine, each header is removed in sequence — the Ethernet frame confirms the correct MAC address, the IP header confirms the destination IP, and the TCP header identifies port 80, directing the data to Apache. This process of encapsulation on the sending side and decapsulation on the receiving side is the practical function of the OSI model, and the specific protocols used at layers 1 and 2 can vary widely depending on the available technology and the network design in use.

What you'll learn

What's covered

OSI Model in Action

Aligned to

CompTIA Network+
1.1 Explain concepts related to the Open Systems Interconnection (OSI) reference model.
Cisco CCNA
1.1 Explain the role and function of network components
1.3 Compare physical interface and cabling types
3.2 Determine how a router makes a forwarding decision by default
Cisco CCST Networking
1.1 Identify the fundamental conceptual building blocks of networks
4.4 Explain basic routing concepts
Cisco CyberOps Associate
4.8 Interpret the fields in protocol headers as related to intrusion analysis

Key terms

Open Systems Interconnection Model
OSI
A conceptual framework that standardizes network communication into seven distinct layers.
Encapsulation
The process of wrapping data with protocol headers as it passes down the layers of the OSI model.
Physical Layer
Layer 1 of the OSI model, responsible for the transmission of raw bits over a physical medium.
Data Link Layer
Layer 2 of the OSI model responsible for node-to-node data transfer and error detection on a single network segment.
Network Layer
Layer 3 of the OSI model, responsible for logical addressing and routing data packets between networks.
Transport Layer
Layer 4 of the OSI model, responsible for end-to-end communication, flow control, and error recovery.
Media Access Control
MAC
A sublayer of the Data Link layer that controls how devices on a network gain access to a medium and transmit data.
Router
A network device that forwards data packets between networks based on IP addresses.
Point-to-Point Protocol
PPP
A data link protocol used to establish a direct connection between two nodes.
High-Level Data Link Control
HDLC
A bit-oriented synchronous data link layer protocol used for point-to-point WAN connections, providing framing, flow control, and error detection. Cisco's proprietary version of HDLC is the default encapsulation on Cisco serial interfaces and adds a protocol type field absent from the ISO standard.
RS-232
A Layer 1 standard defining electrical signaling for serial communication between two devices over a point-to-point link.
Packet
A unit of data formatted for transmission over a network, containing a header, payload, and sometimes a trailer.

Transcript

I created a little network in Legos to help illustrate the point of the OSI model and how it's used.

The network

Here's our network all laid out. On one side we have a local area network — all of these laptops that are communicating on this local area network, as well as this router that is on the edge of it. So this is one local area network over here. Over on the other side we have another local area network. Both these local area networks speak Ethernet, by the way.

This one right here is a laptop, and I'm going to host a website off of this laptop. So I install Apache on it, and Apache is what I use to host this website. Now we have a machine that actually wants to access this website over here. What needs to happen is that this machine needs to communicate across these routers — we've got router 1, router 2, and router 3 — to this local area network on this side.

So it's going to go through the process of resolving and figuring out what the IP address of this machine is. The IP address is 1 192.168.57, so we have that IP address over here. We need to route information from this machine, which is requesting those web resources, from this machine, which is hosting those web resources.

Encapsulation

We have data that needs to be requested. The data is going to be sent from this laptop over here, across the routers, to this laptop, and then there's going to be a response, and so a different set of data is then going to be sent back. Of course we have to make a connection here, and when this data gets over to this server it's going to need to be routed to the proper program, which is Apache. The program over here, Apache, is tied to port 80. So there's some information that we need to get over here, and we need to address that specific service right there.

What we need to do is put a TCP header on this. This TCP header is going to be additional information that's going to be carried over here so that it can get to the proper service, which is port 80. So we've got that information in here — that it needs to hit port 80 — as well as quite a bit of other information in this TCP. We're going to encapsulate the data with this TCP header, that additional information.

The other thing that needs to happen is this needs to be routed from router to router, because there could be many networks in between. So it needs to be able to route to this IP address. What we need to do is also attach the IP address to this. This is the IP header, and there is additional information in this header, but for now we're just mainly concerned with this IP address. So we're going to encapsulate the data and the TCP with this IP header here, and that's going to be the information that's needed to route to this final destination.

But the first step is that this laptop needs to send the information to this router. That's the first thing that needs to happen, and it needs to have some local addressing here to be able to get it to the router. The local addressing is the MAC address. The MAC address of this router is AB 2C1244 F112.

So we've got that information that needs to be sent there. What we do is we have the Ethernet frame right here that needs to be added to it — the Ethernet header needs to be added to this, we need to encapsulate it with the Ethernet information. The Ethernet information actually spans multiple layers, so we've got layer 1 and layer 2 all wrapped up into this. By the way, this is layer 3 and layer 4: layer 3 is the IP and layer 4 is the TCP.

So we've got this additional information, and the information is the MAC address, so it can be delivered locally to this router, as well as the layer 1. Layer 1 has some signaling to get the communication started, and it starts out with a bunch of ones and zeros. I represented this by some ones and zeros here. This is kind of like a wakeup signal to get devices on this network listening. So I've got this layer 2 and layer 1, and I'm going to attach this to my data as well, so it can be sent over.

Hop one: across the Ethernet LAN

Now this laptop can send this information over on the local area network to this router. This router receives this information and it can take a look — once again, the preamble here is like the little wakeup signal — and it says, is this my MAC address? And it says, yep, that matches up, that's my MAC address. So now this layer 1 and layer 2 has done its job, it's no longer needed, so it takes this information and gets rid of it.

Next what it needs to do is take this IP address and figure out what the next hop is. So it goes through the process of figuring out where it needs to route this traffic, and it figures out it needs to go to router 2.

Hop two: point-to-point protocol over ISDN

With router 2, the connection between these is a little different type of connection that we've set up between router 1 and router 2 — not an Ethernet connection, but a point-to-point connection. We're using point-to-point protocol. This is a protocol that is many times used between routers like this. It's just point-to-point, so there are just two devices on this network. It just needs to send out essentially a broadcast to the other side, so this other device receives it, which is all ones in the case of point-to-point protocol.

So we're going to attach this point-to-point protocol to this. This is the layer 2 header, so that when it gets over to this other destination, router 2, then it will be able to see where it's come from and be able to process that packet.

But it's going across this link right here, which is physically set up as an ISDN line. I don't want to get into the specifics of what an ISDN line is, but that's the layer 1 technology going between these two devices. The layer 1, the ISDN, starts out with a series of ones, so I've got this represented here, and that's the preamble, kind of the wakeup signal. So it attaches this now to this, and now we've got our new layer 2 and layer 1 here. Then it can be sent over to this router right here.

That router is going to take a look at the layer 1 and say, is this for me? This is being sent over, and it's woken up, and so yes, it gets this and it says, I need to process this. It takes away the layer 1. The layer 2 now, right here, the point-to-point protocol, says, is this for me? It says, yeah, this is for me. So now it no longer needs this.

Hop three: HDLC over RS-232

Next it needs to take a look at the IP address and see where it needs to be routed next, and it determines it needs to be routed to router 3 here. The connection that we've set up between router 2 and router 3 is an HDLC connection, so now we've got this HDLC protocol that's set up between these two routers. It's a much different protocol. Here's the address to it — we've got some sort of address marking on here — and it needs to address this router 3 right here. So we're going to take that HDLC and encapsulate our packet with it.

But we also have that layer 1 connection across there, which is an RS-232. So we've got the RS-232, and what starts the RS-232 connection, and we're going to attach that here and send it across. It's going to physically send that across now to router 3.

Router 3 has this now. It takes a look at the RS-232 and does whatever it needs to do with that, and does away with that because it's no longer needed. It's got the HDLC; it makes sure that it's addressed to router 3, and sure enough, it is. It sees the 192.168.57, realizes that that is a directly connected network and needs to send it to this device.

Delivery on the far LAN

This LAN over here is using Ethernet, so it needs to form a new Ethernet frame right here. We've got the Ethernet information; this operates on both layer 1 and layer 2. It needs to determine a MAC address, and the MAC address of this laptop over here is 34 1 F 7 A 61 BB 4B. So there's the MAC address of this machine over here, and it needs to put that MAC address in this Ethernet frame. Of course it's got the preamble as well, the little wakeup signal. It attaches this to this packet right here — in fact, I'm going to flip that around — and then it sends it into this network to be delivered.

The switch then delivers it to that MAC address, so it gets here. This computer will take a look at this and say, okay, I need to process this. It says, oh yeah, this is destined for me. It no longer needs that layer 2 information. It takes a look at the IP, processes the IP, which does several different things, but the main one is, hey, is this my IP address? Sure enough, it is. It takes a look at the TCP right here; with the TCP it looks at the port and says, I know which port this is associated with, this is associated with Apache. So now I'm going to send my data to Apache so that Apache can process it. The Apache program processes this data, realizes it's a request for some web services, and starts forming the reply back, and then the reply happens so that the information can get back to this laptop.

The layers together

So that's how the different layers are. We've got layers 5 through 7, the application layer. We've got the TCP, which is layer 4. We've got the IP, which is layer 3. And then we've got layer 1 and layer 2, which could be Ethernet, or it could be these other protocols that I showed here — HDLC with RS-232, or ISDN and point-to-point protocol — or perhaps we could have any one of a number of these different configurations. Once again, these layers can work together to provide all this communication back and forth, and we would choose which protocols we would use based off of what's available to us, and what technologies, and what we're trying to accomplish.

About TechKnowSurge

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 →