The seven OSI layers and what each one does
Layer 1 (Physical) deals with raw bit transmission. Cables, voltage levels, optical signals, and connectors. If a cable is unplugged, you are dealing with a Layer 1 problem. Hubs operate at Layer 1 because they simply repeat electrical signals to every port without any intelligence.
Layer 2 (Data Link) handles frame delivery on a single network segment using MAC addresses. Ethernet and 802.11 (Wi-Fi) live here. Switches operate at Layer 2: they read the destination MAC address in each frame and forward it only to the correct port. This is why switches are smarter than hubs.
Layer 3 (Network) handles logical addressing and routing between networks. IP addresses live here. Routers operate at Layer 3: they read destination IP addresses and make forwarding decisions based on routing tables. ICMP (the protocol behind ping) and OSPF also operate at Layer 3.
Layer 4 (Transport) provides end-to-end delivery, segmentation, and flow control. Port numbers live here. TCP provides reliable, ordered, connection-oriented delivery using a three-way handshake, acknowledgments, and retransmission. UDP is connectionless and unreliable, sending data without waiting for acknowledgment. This makes UDP faster and suitable for real-time traffic like video and voice where a dropped packet is better than a delayed one.
Layers 5, 6, and 7 (Session, Presentation, Application) handle session management, data formatting (encryption, compression, encoding), and user-facing protocols. HTTP, HTTPS, FTP, SMTP, DNS, DHCP, and SSH all live at Layer 7. For exam purposes, these three upper layers are often treated as one when the TCP/IP Application layer is being discussed.
Encapsulation and PDU names by layer
As data travels down the stack from the application to the physical layer, each layer wraps the data in its own header. This is encapsulation. When you send an email, the application layer creates the message. Transport adds a TCP segment header. Network adds an IP packet header. Data Link adds an Ethernet frame header and trailer. Physical converts everything to bits.
Each layer's version of the data has a specific name: Data at the upper layers (7-5), Segment at Layer 4 for TCP or Datagram for UDP, Packet at Layer 3, Frame at Layer 2, and Bits at Layer 1. The exam uses these names precisely. When a question says a router drops a packet, it is operating at Layer 3. When a switch floods a frame, it is Layer 2.
Decapsulation is the reverse: the receiving device strips each header as the data moves up the stack. The destination does not process the encapsulation from layers its application does not care about. The Ethernet frame header is removed at Layer 2, leaving the IP packet for Layer 3 processing, and so on up to the application.
TCP/IP model and how to choose the correct answer
The TCP/IP model has four layers that map to OSI: Network Access (combines OSI Layers 1 and 2), Internet (OSI Layer 3), Transport (OSI Layer 4), and Application (OSI Layers 5, 6, and 7). TCP/IP is the model that reflects how actual protocols are implemented. OSI is the reference model used for teaching, troubleshooting, and vendor-neutral discussion.
Device layer identification: Hub = Layer 1 (repeats bits). Switch = Layer 2 (forwards by MAC). Router = Layer 3 (routes by IP). Layer 3 switch = both Layer 2 and Layer 3.
Troubleshooting by layer: cannot ping across networks but can ping locally = Layer 3 routing issue. Can ping but cannot connect to a service = Layer 4 or above. Physical link not up = Layer 1. MAC table problem = Layer 2.
PDU names to memorize: Segment or Datagram (Layer 4), Packet (Layer 3), Frame (Layer 2), Bits (Layer 1). Upper layers are just called Data.