Sub topic 2
The OSI and TCP/IP Models in Brief
This chapter assumes you know what a network is, can use the Windows command prompt, and can read simple binary numbers. It does not repeat the network types chapter. It covers the two layered models that CompTIA A+ Core 1 uses to organize networking, and it shows how to use them to place a fault in a specific layer.
Why Layered Models Exist
Networking is too large to design as one block. A layered model splits the job into stacked tasks. Each layer does one job and talks only to the layer directly above and below it. This gives you three practical benefits:
- A vendor can change one layer (for example, swap copper for fiber) without rewriting the others.
- Devices from different makers work together because each layer follows a standard.
- A technician can narrow a fault to one layer instead of guessing.
Two models matter for the exam. The OSI model (Open Systems Interconnection) has seven layers and is a teaching and troubleshooting reference. The TCP/IP model has four layers (some books show five) and describes the protocols the internet actually runs.
The Seven OSI Layers
Layers are numbered from the bottom up. The unit of data at each layer has a name, called a protocol data unit (PDU).
| Layer | Name | Job | PDU | Typical examples |
|---|---|---|---|---|
| 7 | Application | Network services that programs use | Data | HTTP, SMTP, DNS, FTP |
| 6 | Presentation | Format, encryption, compression | Data | TLS encryption, character encoding |
| 5 | Session | Open, manage and close conversations | Data | RPC, NetBIOS sessions |
| 4 | Transport | End-to-end delivery, ports, reliability | Segment (TCP) or datagram (UDP) | TCP, UDP |
| 3 | Network | Logical addressing and routing | Packet | IP, ICMP, routers |
| 2 | Data Link | Local delivery using MAC addresses | Frame | Ethernet, switches, Wi-Fi |
| 1 | Physical | Signals on a medium | Bits | Cables, connectors, hubs, radio |
A common memory phrase for layers 7 to 1 is "All People Seem To Need Data Processing". For 1 to 7 it is "Please Do Not Throw Sausage Pizza Away".
What Each Layer Means in Practice
- Physical (1): Voltage on copper, light in fiber, or radio waves. A cut cable, a bad connector or a dead port is a layer 1 fault.
- Data Link (2): Moves frames between devices on the same local network, using MAC addresses (hardware addresses burned into network adapters). Switches work here.
- Network (3): Moves packets between networks using IP addresses. Routers work here.
pinguses ICMP at this layer. - Transport (4): Delivers data to the right program on the destination, using port numbers. TCP and UDP live here, and the next chapter compares them.
- Session, Presentation, Application (5 to 7): Starting conversations, formatting or encrypting data, and providing the service the user sees. The TCP/IP model merges these three.
The TCP/IP Model
The TCP/IP model groups the same work into fewer layers.
| TCP/IP layer | OSI layers covered | Examples |
|---|---|---|
| Application | 5, 6, 7 | HTTP, HTTPS, DNS, DHCP, SMTP |
| Transport | 4 | TCP, UDP |
| Internet | 3 | IP, ICMP |
| Network Access (also called Link) | 1, 2 | Ethernet, Wi-Fi, MAC addresses |
Names vary between sources. Some call the bottom layer "Link" or split it into Data Link and Physical. The exam focuses on the OSI numbers, so learn the mapping above.
Encapsulation: How Data Moves Through the Layers
When a program sends data, each layer wraps the data from the layer above with its own header. This is encapsulation. The receiver unwraps the layers in reverse order, which is de-encapsulation.
Take a browser requesting a web page:
- Application: The browser creates an HTTP request.
- Transport: TCP adds a header with the source port (a random high number) and destination port 80 or 443. The result is a segment.
- Internet: IP adds the source and destination IP addresses. The result is a packet.
- Network Access: Ethernet adds source and destination MAC addresses and a trailer used for error checking. The result is a frame.
- Physical: The frame is sent as bits.
One detail trips people up. As a packet crosses a router, the IP addresses stay the same, but the MAC addresses change at every hop. Each local network needs frames addressed to the next device on that network only. (Network address translation, covered in the SOHO router chapter, is the exception that rewrites IP addresses.)
Where Devices Sit in the Model
Knowing a device's layer predicts what information it reads.
| Device | Layer | Decides based on |
|---|---|---|
| Hub, cable, repeater | 1 | Nothing. It repeats bits. |
| Switch | 2 | Destination MAC address |
| Router | 3 | Destination IP address |
| Firewall | 3 to 7 (varies) | IP, port, or application content |
| Access point | 1 and 2 | Radio signal and MAC addresses |
A multilayer switch adds layer 3 routing to a switch. A hub is an older device that copies every signal to every port. Hubs are rarely seen now, but they still appear in exam questions as a layer 1 device.
Using the Model to Troubleshoot
A reliable method is to start at layer 1 and work up, or to split the problem in half. The tools from the final chapter map onto layers like this:
| Symptom | Likely layer | First check |
|---|---|---|
| No link light, cable unplugged | 1 | Cable, connector, port, adapter enabled |
| Link light on, but address is 169.254.x.x | 2 to 3 | DHCP server reachable, `ipconfig /renew` |
| Cannot ping the default gateway | 2 or 3 | IP settings, subnet mask, switch port |
| Can ping an IP address but not a name | 7 (DNS) | `nslookup`, DNS server setting |
| Name resolves, ping works, but web page fails | 4 to 7 | Port blocked, service down, proxy |
The symptom "ping by IP works, ping by name fails" is a classic exam scenario. It proves layers 1 to 3 work, so the fault sits in name resolution.
ping 127.0.0.1
ping 192.168.1.1
ping example.comRead these three commands as a layer test. The first checks the local TCP/IP software. The second checks the path to the gateway, which covers layers 1 to 3 on your own network. The third adds DNS and internet reachability.
Common Mistakes
- Treating a router as a layer 2 device. Routers forward by IP address, which is layer 3. Switches forward by MAC address, which is layer 2.
- Saying IP addresses change at every hop. MAC addresses change at every hop. IP addresses stay the same unless NAT rewrites them.
- Mixing up the TCP/IP and OSI numbering. The TCP/IP model has no "layer 7". Use the layer names when you discuss TCP/IP, and numbers when you discuss OSI.
- Placing TLS or encryption at only one spot. Exam material usually places it at presentation (layer 6), though in real stacks TLS runs on top of TCP. Follow the OSI convention on the exam.
Summary of Key Points
- OSI has seven layers, and TCP/IP has four. Both describe the same work.
- Each layer wraps data in its own header on the way down. The units are data, segment, packet, frame and bits.
- Switches use MAC addresses (layer 2). Routers use IP addresses (layer 3). TCP and UDP use ports (layer 4).
- Troubleshoot by starting at the physical layer and moving up, or by testing the middle and splitting the problem.
Exercise
A technician can ping the default gateway by IP address and can ping 8.8.8.8, but ping example.com fails with a name-resolution error. Which OSI layer is the most likely location of the fault, and which command would you run next?
Show answer
The fault is most likely at the application layer (layer 7), in DNS, because layers 1 to 3 clearly work. Run nslookup example.com to test the configured DNS server, and check the DNS server entries shown by ipconfig /all.
Exercise
A frame travels from a laptop through a home router to a web server on the internet. Which addresses stay the same across the router, and which change?
Show answer
The source and destination IP addresses stay the same (apart from NAT on the home router rewriting the source address). The MAC addresses change, because each local network segment uses frames addressed to the next device on that segment.
Exercise
Match each item to its OSI layer number: a switch, a router, TCP, a fiber-optic cable.
Show answer
Switch: 2 (Data Link). Router: 3 (Network). TCP: 4 (Transport). Fiber-optic cable: 1 (Physical).