Sub topic 3
Putting the TCP/IP and OSI Models Side by Side
Assume you know what clients, servers, IP addresses, and ports are. The OSI model is a seven-layer reference model. The TCP/IP model is a practical four-layer model used to describe real networks.
Comparing the layers
| OSI layer | TCP/IP layer | Examples |
|---|---|---|
| Application, presentation, session | Application | HTTP, DNS, TLS |
| Transport | Transport | TCP, UDP |
| Network | Internet | IPv4, IPv6, ICMP |
| Data link, physical | Link | Ethernet, Wi-Fi, ARP |
The mapping is approximate. OSI separates concerns more finely. TCP/IP combines concerns that are often implemented together.
Names for data at each layer
As data moves down the stack, each layer adds its own header. The common protocol data unit names are:
- A segment contains TCP data and a TCP header.
- A datagram commonly means UDP data with a UDP header.
- A packet contains an IP header and the transport-layer data.
- A frame contains a link-layer header and usually an IP packet.
“Packet” is also used informally for any network data unit, so context matters.
Where the mapping blurs
Some protocols do not fit one OSI layer cleanly:
- ARP maps an IP address to a MAC address. It operates between link and internet-layer responsibilities.
- ICMP travels inside IP packets but carries network-control messages rather than application data.
- TLS protects application data. Its encryption and session functions resemble OSI presentation and session layers, but modern systems usually treat TLS as part of the application stack.
- A five-layer hybrid model separates the physical layer from the data-link layer. It is useful for teaching actual signals and cables, while keeping the other TCP/IP layers.
Seeing layers in a packet capture
This command displays Ethernet, IP, and TCP details for five HTTP-port packets:
sudo tcpdump -nn -e -v -c 5 'tcp port 80'In the output, identify the outer MAC addresses as link-layer fields, IP addresses as internet-layer fields, and ports and flags as transport-layer fields. The application payload appears above those headers when captured.
Using layers to narrow down faults
Start at the lowest layer that could explain the symptom:
- No link light or Wi-Fi association suggests a physical or link problem.
- A missing MAC address or failed ARP lookup suggests a local-link problem.
- An unreachable destination suggests IP addressing or routing trouble.
- A reachable host with a closed port suggests a transport or server-listening problem.
- A successful connection with incorrect content suggests an application or TLS problem.
Exercise
A host answers ping, but a TCP connection to port 443 fails. Which layers should you check next?
Show answer
Check the transport layer for filtering or a non-listening port, then check the application layer for the service and TLS configuration.