Why a reference model exists
Networking is a field of thousands of protocols, standards and boxes from vendors who never agreed on anything. The OSI model is the shared filing system that lets you compare any two of them.
The Open Systems Interconnection reference model was published by the ISO to give the industry a common point of reference. It divides everything a network does into seven layers, each responsible for one family of jobs, each depending on the layer beneath it and serving the layer above it.
What the model actually buys you
- A common vocabulary. Saying “this is a Layer 2 problem” tells another engineer more in four words than a paragraph of description would.
- Interoperability reasoning. Two devices can talk if they share a protocol at the layer in question. Your laptop and a web server on the other side of the world have almost nothing in common — but they both speak IP at Layer 3, so they can reach each other.
- A troubleshooting order. Faults can be chased layer by layer instead of guessed at. There is a whole module on this at the end of the lesson.
- Separation of concerns. Fibre replaced copper without rewriting HTTP, because the physical layer changed and nothing above it needed to care.
Think of it as a bookcase
A useful way to picture the model is a bookcase with seven shelves. Similar books are grouped on a shelf; similar protocols and functions are grouped in a layer. The shelves have an order and things generally sit where you expect — but the bookcase is a convenience for finding things, not a law of physics.
Payload, and why the distinction matters
When you load a web page, the thing you actually want is the text and images. Everything else — addresses, ports, checksums — exists only to get that content to you. The generic term for “the data itself, as distinct from the delivery information wrapped around it” is the payload. Every layer treats what it received from the layer above as payload, and adds its own delivery information around it. That single idea is the whole of encapsulation, which you will meet two modules from now.
Why is the application layer numbered 7 and not 1?
The layers are numbered from the wire upwards, because that is the order data physically moves through them on arrival. Layer 1 is closest to the medium; Layer 7 is closest to the human. Drawing the stack with Layer 1 at the bottom is convention and every diagram you meet on the exam will follow it.
The seven layers
Seven layers, from the wire up to the software. Click any layer to see what it owns.
Application
Provides network services to software, and advertises what is available.
- PDU
- Data
- Addressing
- —
- In one word
- Services for applications
What it does
- Application services — file sharing, email, name resolution, web
- Service advertisement and discovery (printers announcing themselves, services registering with a directory)
Devices
Next-generation firewalls, web application firewalls, proxies, Layer 7 load balancers
Protocols and standards
HTTP, HTTPS, DNS, DHCP, FTP, SFTP, SMTP, IMAP, POP3, SNMP, LDAP, SSH, Telnet, NTP, SMB, Syslog, RDP
Memorising the order
You will need the order cold — plenty of questions do nothing more than ask which layer sits above or below another. Two mnemonics cover both directions:
- All→L7 Application
- People→L6 Presentation
- Seem→L5 Session
- To→L4 Transport
- Need→L3 Network
- Data→L2 Data Link
- Processing→L1 Physical
The whole model on one page
| Layer | PDU | Addressing | Devices | Example protocols |
|---|---|---|---|---|
| L7 Application | Data | — | Next-generation firewalls, web application firewalls, proxies, Layer 7 load balancers | HTTP, HTTPS, DNS, DHCP, FTP, SFTP, SMTP, IMAP, POP3, SNMP, LDAP, SSH, Telnet, NTP, SMB, Syslog, RDP |
| L6 Presentation | Data | — | TLS/SSL offload appliances, encryption gateways | SSL/TLS, ASCII, EBCDIC, Unicode, JPEG, GIF, MPEG |
| L5 Session | Data | — | Session-aware gateways and proxies | SIP, H.323, NetBIOS, RPC, PPTP (control channel) |
| L4 Transport | Segment (TCP) / Datagram (UDP) | Port number | Layer 4 load balancers, stateful firewalls, PAT/NAT devices | TCP, UDP |
| L3 Network | Packet | IP address | Routers, multilayer (Layer 3) switches, Layer 3 firewalls | IPv4, IPv6, ICMP, IPsec, OSPF, EIGRP, BGP, RIP, NAT |
| L2 Data Link | Frame | MAC address | Switches, bridges, NICs, wireless access points | Ethernet (802.3), Wi-Fi (802.11), STP, VLANs (802.1Q), LACP, PPP, HDLC, ARP* |
| L1 Physical | Bits | — | Cabling, transceivers and SFPs, repeaters, media converters, patch panels, hubs (legacy) | 100BASE-TX, 1000BASE-T, 10GBASE-SR, RS-232, DSL, modulation and multiplexing schemes |
Upper layers and lower layers
Layer 4 is the dividing line. Layers 1 to 3 are the lower or media layers — they are the network’s business, concerned with getting bits from one place to another. Layers 5 to 7 are the upper or host layers — they are the application’s business and run on the endpoints. The transport layer sits between the two, taking messages from above and handing segments below.
PDUs and encapsulation
Data does not travel down the stack unchanged. Each layer wraps what it was given in its own header — and the wrapped-up result gets a different name at each level.
Protocol data units
A protocol data unit (PDU) is the name for the chunk of information a given layer hands to its peer on the other host. Engineers say “packet” loosely for all of them, but the exam expects the precise name:
| Layer | PDU | What was added |
|---|---|---|
| Layers 7, 6, 5 | Data | Formatting, encryption, session context |
| Layer 4 — Transport | Segment (TCP) or Datagram (UDP) | Ports, sequence and acknowledgement numbers |
| Layer 3 — Network | Packet | Source and destination IP addresses, TTL |
| Layer 2 — Data Link | Frame | Source and destination MAC addresses, plus a trailing checksum |
| Layer 1 — Physical | Bits | Nothing — the frame becomes a signal |
Encapsulation, step by step
Walk a single HTTP request from your browser down to the wire and out the other side. Watch what gets added at each step, and what it is for.
The application produces data
Your browser builds an HTTP request. At Layers 7, 6 and 5 the PDU is simply called data: it has been formatted and possibly encrypted, and it belongs to a session, but nothing has been added for the network yet.
Decapsulation on the way up
The receiver reverses the process. Crucially, each layer knows what to do next because the layer below told it: the Ethernet header has an EtherType field saying “this is IPv4”, the IP header has a Protocol field saying “this is TCP”, and the TCP header has a destination port saying “this is for the web server”. That chain of hand-offs is what makes the stack work without any layer needing to understand the others.
- Encapsulation
- Wrapping data from an upper layer in the header (and sometimes trailer) of a lower layer as it moves down the stack.
- Decapsulation
- Stripping those headers back off, layer by layer, as data moves up the stack on the receiving host.
- PDU
- Protocol data unit — the named unit of data at a given layer: data, segment, packet, frame, bits.
- Payload
- The data being carried, as distinct from the headers wrapped around it to deliver it.
- MTU
- Maximum transmission unit — the largest payload a link will carry in one frame, commonly 1500 bytes on Ethernet. Anything larger must be fragmented or dropped.
Layer 1 — Physical
Puts raw bits onto a wire, a fibre, or the air — and defines what a bit physically is.
The physical layer is the only layer that touches anything you can hold. It is concerned with the transmission of bits and with the physical and electrical characteristics of the network. It has no idea what an address is.
How a bit is represented
Data is binary, and something physical has to stand for a 1 and a 0. Two broad approaches:
- Current state modulation — the presence or absence of voltage (on copper) or light (on fibre) represents the bit. Voltage present is a 1, voltage absent is a 0.
- State transition modulation — the change between states represents the bit, rather than the state itself.
Radio adds its own family: amplitude modulation varies signal strength, frequency modulation varies frequency.
Bit synchronisation
Both ends have to agree on where one bit ends and the next begins, or the receiver reads garbage from a perfectly good signal.
| Method | How it works |
|---|---|
| Asynchronous | The sender sends a start bit, the receiver starts its own internal clock, and a stop bit marks the end. No shared clock is needed, but the start and stop bits are overhead on every unit. |
| Synchronous | Both ends reference a common clock — often one supplied by the service provider — so no per-unit start and stop bits are required. |
Bandwidth usage: baseband and broadband
| Approach | Meaning | Example |
|---|---|---|
| Baseband | One signal uses the entire available frequency range of the medium. | Ethernet — the BASE in 1000BASE-T |
| Broadband | The medium is divided into channels, each carrying a separate stream. | Cable: TV channels plus upstream and downstream data on one coax |
Multiplexing
Multiplexing is how several conversations share one physical medium.
| Scheme | How the medium is shared |
|---|---|
| TDM — time-division | Sessions take turns in fixed time slots, whether or not they have anything to send. |
| StatTDM — statistical TDM | Time slots are handed out on demand, so an idle session does not waste one. |
| FDM — frequency-division | The frequency range is split into channels, one per session. This is broadband. |
| OFDM — orthogonal FDM | Data is encoded across many closely spaced carrier frequencies. Used by DSL, Wi-Fi, digital TV and 4G/5G. |
| OFDMA — orthogonal FDM access | The multi-user version of OFDM: one channel is split into subchannels so several clients transmit at once. This is the Wi-Fi 6 efficiency feature. |
Also defined here
- Wiring standards — the TIA/EIA-568A and 568B pinouts that say which coloured pair lands on which pin of an RJ45 connector.
- Physical topology — how the cabling is physically laid out: star, bus, ring, mesh, hub-and-spoke. Contrast this with the logical topology, which is a Layer 2 concept.
Devices
Cabling, transceivers and SFPs, repeaters, media converters, patch panels, hubs (legacy).
A patch cable is crushed under a chair leg and the link light goes out. Which layer?
Layer 1. No signal means no bits, and everything above is starved. The classic Layer 1 symptoms are no link light, high error or CRC counters on the interface, intermittent connectivity when a cable is moved, and everything working the moment you swap the cable.
Layer 2 — Data Link
Packages bits into frames and moves them across a single link, hop by hop.
The data link layer is responsible for:
- Packaging data into frames and transmitting them on the network
- Keeping frames within the maximum transmission unit (MTU) of the media
- Error detection and correction
- Uniquely identifying devices by physical address
- Flow control
The only layer with sublayers
Layer 2 is split in two, and the exam expects you to know which half does what.
LLC — Logical Link Control
Upper half. Talks to Layer 3.
- Connection services — acknowledgements that provide flow control (stop the sender overwhelming the receiver) and error control (tell the sender a frame was missing or corrupt)
- Synchronising transmissions — isochronous, asynchronous or synchronous
- Identifies which Layer 3 protocol the frame is carrying
MAC — Media Access Control
Lower half. Talks to Layer 1.
- Physical addressing — the 48-bit MAC address
- Logical topology — how the network behaves, as opposed to how it is cabled
- Method of transmitting on the media — the rules deciding when a device may send, so two stations do not talk over each other
MAC addresses
A MAC address is 48 bits, written as twelve hexadecimal digits — for example 58:55:CA:EB:27:83. It splits neatly in half:
Error detection
| Mechanism | How it works | Weakness |
|---|---|---|
| Parity bit | One extra bit per byte, set so the total number of 1s is even (even parity) or odd (odd parity). | Two errors in the same byte cancel out and go undetected. |
| CRC — cyclic redundancy check | A mathematical function is run over the data and the result sent along with it. The receiver recalculates and compares. | Detects corruption, but does not repair it — the frame is simply discarded. |
Devices and protocols
Devices: Switches, bridges, NICs, wireless access points.
Protocols: Ethernet (802.3), Wi-Fi (802.11), STP, VLANs (802.1Q), LACP, PPP, HDLC, ARP*
Two hosts on the same VLAN can ping each other; hosts on different VLANs cannot. Which layer is the fault most likely at?
Layer 3. Within a VLAN, forwarding is pure Layer 2 and it is working. Crossing between VLANs requires routing, so suspect the router or the switch’s Layer 3 interface — a missing gateway, a missing route, or an access list. A genuine Layer 2 fault would break communication inside a VLAN too.
Layer 3 — Network
Forwards data between networks using logical addresses.
Layer 2 moves a frame across one link. Layer 3 is what gets data across a network of networks — it is the layer the internet is built on. Most people think “routing and IP” when they hear network layer, and that is right, but the layer owns more than that.
Logical addressing
Where Layer 2 uses a burned-in physical address, Layer 3 uses a logical address — one that is assigned, can be changed, and carries structure. An IP address encodes both a network and a host within it, which is what makes routing possible at all: a router does not need to know about every host on the internet, only about networks.
Switching techniques at Layer 3
“Switching” here means deciding how data should be forwarded — not the Layer 2 box on your rack. Three techniques:
| Technique | How it works | Example |
|---|---|---|
| Packet switching | The stream is divided into packets, each independently carrying source and destination Layer 3 addresses. Another name for this is routing. | The internet |
| Circuit switching | A dedicated link is brought up between two parties for the duration of the conversation, then torn down. | A traditional landline telephone call |
| Message switching | Whole messages are tagged with a destination and stored briefly at each hop before being forwarded — a store-and-forward network. Too slow for real time. | Email relaying between mail servers |
Route discovery and selection
A router forwards using its routing table, which gets populated three ways:
- Directly connected — networks the router has an interface on
- Static routes — entered by hand by an administrator
- Dynamic routing protocols — OSPF, EIGRP, BGP and RIP, which learn routes from neighbouring routers and adapt when topology changes
Connection services
Layer 3 offers its own reliability helpers, which matter when the data link layer’s LLC sublayer is not providing them:
- Flow control (congestion control) — stop a sender transmitting faster than the receiver can absorb
- Packet reordering — reassemble packets into the right sequence, which is needed because load balancing across multiple links can deliver them out of order
Inside the IPv4 header
Two fields are worth committing to memory. TTL (time to live) is decremented by one every time the packet passes through a router; at zero the packet is discarded, which is what stops a routing loop consuming the network forever — and it is also the mechanism traceroute exploits to map a path. Protocol names the Layer 4 protocol inside: 6 for TCP, 17 for UDP, 1 for ICMP.
Devices and protocols
Devices: Routers, multilayer (Layer 3) switches, Layer 3 firewalls.
Protocols: IPv4, IPv6, ICMP, IPsec, OSPF, EIGRP, BGP, RIP, NAT
Layer 4 — Transport
Decides whether delivery is reliable, and which application on the host gets the data.
The transport layer is the dividing line in the model. Messages from the upper layers (5–7) are taken and encapsulated into segments for the lower layers (1–3); data arriving from below is decapsulated and passed up. It answers two questions: how reliable does this need to be, and which application is it for.
TCP versus UDP
| TCP | UDP | |
|---|---|---|
| Connection | Connection-oriented — a handshake first | Connectionless — just send |
| Reliability | Reliable: drops are detected and retransmitted | Unreliable: a drop is never noticed |
| Ordering | Sequence numbers restore the original order | None — arrival order is arrival order |
| Acknowledgements | Yes | No |
| Flow control | Windowing | None |
| Header size | Large (20 bytes minimum) | Small (8 bytes) |
| PDU name | Segment | Datagram |
| Suits | Web, email, file transfer, remote access — anything where a missing byte ruins it | Voice, video, DNS, DHCP, streaming — anything where a late byte is worse than a missing one |
Flow control at Layer 4
Two mechanisms, and they are not the same thing:
- Windowing — the sender transmits several segments before pausing for an acknowledgement, and a single acknowledgement can cover the whole window. TCP uses a sliding window: it starts small, and the window grows as acknowledgements come back cleanly. If an acknowledgement fails to arrive within the round-trip time, or a configured maximum is reached, growth stops.
- Buffering — a device such as a router holds segments in a queue when there is not enough bandwidth to send them right now. Queues are finite, so sustained congestion eventually means drops.
Ports
A port number identifies which application on a host the data belongs to. It is 16 bits, so the range is 0 to 65535, and it splits into three bands:
| Range | Name | Used by |
|---|---|---|
| 0 – 1023 | Well-known | Standard services: HTTPS 443, HTTP 80, SSH 22, DNS 53, SMTP 25 |
| 1024 – 49151 | Registered | Vendor-assigned application ports, e.g. SQL Server 1433, RDP 3389 |
| 49152 – 65535 | Dynamic / ephemeral | Temporary source ports a client picks for one conversation |
- Socket
- The combination of an IP address and a port number. A pair of sockets — one at each end — uniquely identifies a single conversation.
- Round-trip time (RTT)
- How long it takes for a segment to reach the receiver and its acknowledgement to come back. TCP uses it to decide when a segment is lost.
- Segmentation
- Splitting an upper-layer message into pieces small enough for the network to carry, and numbering them so the receiver can reassemble.
Layers 5–7 — The upper layers
The three layers above transport run on the hosts, not on the network. In practice they are often handled together by a single protocol — which is exactly why the TCP/IP stack collapses them into one. The exam still expects you to separate them.
Layer 5 — Session
Sets up, maintains and tears down the conversation between two applications.
A session is a conversation that must be kept distinct from other conversations, so data from two of them never intermingles. The layer’s job splits three ways:
| Phase | What happens |
|---|---|
| Setting up | Checking credentials, numbering the session’s flows so each is identifiable, negotiating which services are needed, and agreeing which side transmits first. |
| Maintaining | Transferring data, acknowledging receipt, and re-establishing the session if it drops. |
| Tearing down | Ending the session by mutual agreement — or detecting that the other party has vanished and closing your own side. |
Example protocol: SIP, which sets up, maintains and tears down voice and video calls. NetBIOS and RPC are also commonly cited here.
Layer 6 — Presentation
Translates data into a format both ends agree on, and encrypts or compresses it.
- Data formatting. One application may encode text as ASCII and another as EBCDIC; the presentation layer translates so both sides understand the same bytes. The same applies to media formats — JPEG, GIF, MPEG.
- Encryption. Scrambling data so an interceptor cannot read it, and unscrambling it for the intended recipient. TLS is the protocol usually placed here.
- Compression. Shrinking the data before it is handed down.
Layer 7 — Application
Provides network services to software, and advertises what is available.
- Application services — the network-facing services software calls on: file sharing, email, name resolution, web.
- Service advertisement — some services announce themselves periodically (a networked printer broadcasting its availability); others register with a central directory such as Active Directory, which other devices then query.
Sorting the upper three
Place each function at the layer that owns it.
- Encrypting a credit card number before transmission
- Resolving www.example.com to an IP address (DNS)
- Tearing down a voice call when the other party hangs up
- Converting text from EBCDIC to ASCII
- A network printer advertising that it is available
- Re-establishing a dropped connection to a file server
OSI vs. the TCP/IP stack
The OSI model was designed to be generic. Almost every network you will touch runs TCP/IP — so there is a second, four-layer model that describes the same journey with less ceremony.
The TCP/IP stack, also called the DoD model, was developed by the US Department of Defense. It has four layers rather than seven, and the difference is entirely in where the boundaries are drawn — nothing is missing.
| TCP/IP layer | OSI layers | What it holds |
|---|---|---|
| Application | Layers 5, 6 and 7 | HTTP, HTTPS, DNS, DHCP, FTP, SMTP, SSH, SNMP — plus the formatting, encryption and session handling that OSI splits out |
| Transport | Layer 4 | TCP and UDP |
| Internet | Layer 3 | IP specifically, plus ICMP, IPsec and the routing protocols |
| Network interface | Layers 1 and 2 | Ethernet, Wi-Fi, cabling, MAC addressing. Also called the network access layer. |
Why both models still exist
The four-layer model is easier to apply: you rarely have to agonise over whether something is session or presentation, because the question does not arise. SIP is a good example — placing it in OSI takes some thought, but in TCP/IP it is obviously an application layer protocol that gets encapsulated inside TCP.
The seven-layer model won the vocabulary war anyway. Nobody says “a network interface layer problem”; they say “a Layer 2 problem”. Even engineers working purely in TCP/IP use the OSI numbers, which is precisely why the exam tests the model you use less and talk about more.
A web request, layer by layer
One request, all seven layers, real numbers. This is the scenario most OSI exam questions are a slice of.
A client at 10.1.1.1 loads a page from a web server at 172.16.1.2. Here is what each layer contributes on the way out.
| Layer | What happens | What it adds |
|---|---|---|
| L7 Application | The browser builds an HTTP request for /index.html. | The request itself |
| L6 Presentation | The request is encoded, and TLS encrypts it because this is HTTPS. | Encoding and encryption |
| L5 Session | The conversation with this server is tracked separately from every other tab. | Session context |
| L4 Transport | TCP segments the data and stamps ports: source 50412, destination 443. | TCP header — ports, sequence, acknowledgement, window |
| L3 Network | IP addresses the packet from 10.1.1.1 to 172.16.1.2 and sets a TTL. | IP header — source and destination address, TTL, protocol 6 |
| L2 Data Link | Ethernet frames the packet for the first hop: this NIC’s MAC to the default gateway’s MAC. | Ethernet header plus FCS trailer |
| L1 Physical | The frame is transmitted as electrical, optical or radio signal. | Nothing — it becomes signal |
Addresses and ports, both directions
| Field | Value |
|---|---|
| Source IP | 10.1.1.1 |
| Source port | 50412 (ephemeral) |
| Destination IP | 172.16.1.2 |
| Destination port | 443 (well-known) |
The client picks an unused ephemeral port above 1023 as its source and aims at the server’s well-known port. The pair of IP addresses plus the pair of ports is the socket that identifies this one conversation.
What changes at each router along the way
The packet crosses several routers before it arrives. At each one the same three things happen, and nothing else:
- The incoming frame is discarded entirely after its FCS is validated — Layer 2 addressing only ever described that one link.
- The TTL is decremented by one, and the header checksum recalculated. If TTL hits zero the packet is dropped and an ICMP time-exceeded message is returned to the sender.
- A new frame is built with the router’s own MAC as source and the next hop’s MAC as destination, and it goes back out.
The IP addresses, the ports and the payload are untouched from end to end — unless NAT is in the path, in which case the source IP address and port are rewritten at the network boundary (Layers 3 and 4), which is precisely why NAT is described as operating there.
Why does the reply arrive at the correct browser tab and not another?
Because of the ephemeral source port. Each tab’s connection was assigned its own high port number, and the server sends its reply to that exact port. The four-tuple of source IP, source port, destination IP and destination port uniquely identifies the conversation — that is the entire reason the transport layer has ports.
Troubleshooting by layer
This is why the model earns its place on the exam. A layered model turns “the internet is broken” into a sequence of questions with definite answers.
Three approaches
| Approach | How | When to reach for it |
|---|---|---|
| Bottom-up | Start at Layer 1 and work up — check the cable, then the link, then the IP, then the port, then the app. | A hard failure with no connectivity at all. Cheapest checks first. |
| Top-down | Start at Layer 7 and work down — check the application, then work towards the wire. | One application misbehaving while everything else works. |
| Divide and conquer | Start in the middle, usually Layer 3 with a ping, and let the result tell you which half to search. | You have a hunch, or the symptoms are ambiguous. Usually the fastest. |
Symptom to layer
| Symptom | Most likely layer | What to check |
|---|---|---|
| No link light on the switch port | L1 Physical | Cable, connector, port, transceiver, patch panel |
| Link is up but CRC errors are climbing | L1 / L2 | Damaged cable, duplex mismatch, interference, failing transceiver |
| Two hosts on the same VLAN cannot see each other | L2 Data Link | VLAN assignment, switch port config, spanning tree blocking, MAC table |
| Same-subnet works, other subnets do not | L3 Network | Default gateway, routing table, subnet mask, access list |
| You can ping the server but the service will not connect | L4 Transport | Port blocked by a firewall, service not listening, wrong port |
| HTTPS fails while HTTP works | L6 Presentation | Expired or untrusted certificate, TLS version mismatch, cipher mismatch |
| Everything resolves by IP but not by name | L7 Application | DNS server, DNS records, resolver configuration |
| Voice calls set up then drop after a fixed interval | L5 Session | Session timeouts, SIP ALG on a firewall, keepalive settings |
Place these faults
Which layer would you investigate first?
- A user’s IP address is 169.254.10.4 and nothing works
- Duplicate MAC addresses reported by the switch
- The web server responds to ping but refuses connections on 443
- A fibre run was cut by a contractor
- Users reach sites by IP but every hostname fails
- Traffic loops until TTL expires
Knowledge check
Twelve questions across everything in this lesson. Every answer comes with an explanation — read them even when you get it right.
1At which layer of the OSI model does a switch primarily operate?
2What is the correct name for the protocol data unit at the network layer?
3Which of the following is a connectionless transport layer protocol?
4A router receives a packet and forwards it out another interface. Which of these changes?
5Which two sublayers make up the data link layer?
6How many bits are in a MAC address, and what does the first half identify?
7Which OSI layer is responsible for encryption and data formatting?
8What is the maximum value of a port number?
9A packet is discarded because its TTL reached zero. Which layer’s header carried that field?
10The TCP/IP stack’s application layer corresponds to which OSI layers?
11A user can ping a file server by IP address but the file share will not open. Which layer should you investigate first?
12Which statement about the application layer is correct?
Where to go next
You now have the framework every other Network+ topic hangs off. When you meet a new protocol or device, the first question worth asking is which layer it lives at — the answer usually tells you most of what it does.