The OSI and TCP/IP models
Sending a message across a network is complicated, so it was split into layers. Each layer has one job and serves the layer above it. Think of a shipping company: one team packs, another labels, another drives, and none needs the others' details.
When you send data, each layer wraps it in its own header; this is called encapsulation. At the receiver, each layer removes its header until the message reaches the application.
| 7 · Application | What programs talk to: HTTP for the web, DNS, SMTP for email. |
| 4 · Transport | TCP (reliable, ordered) or UDP (fast, no guarantees). Ports live here. |
| 3 · Network | IP addresses and choosing a path. The router's job. |
| 2 · Data link | MAC addresses and delivery within one network. The switch's job. |
| 1 · Physical | Cables, fibre and Wi-Fi radio: the raw bits. |
Watch outTo remember layers 1 to 7: Please Do Not Throw Sausage Pizza Away = Physical, Data link, Network, Transport, Session, Presentation, Application.
OSI is a teaching and reference model. The internet actually runs on the TCP/IP model with four layers: it merges OSI's top three into “Application” and the bottom two into “Network access”.
Watch outInterviews and certifications like Network+ and CCNA ask a lot about layers. And “it's a layer 1 problem” simply means: the cable is unplugged!