What's changed: Initial version
1.2The OSI and TCP/IP models and TCP/UDP
Covers the correspondence between the layered OSI reference model and the practical TCP/IP model, encapsulation that wraps upper-layer data in lower-layer headers along with each layer's PDU, and TCP (reliable, three-way handshake) versus UDP (low-latency, connectionless) framed as the judgment of "which fits this application."
The layer model is not something to memorize—it is a map for fault isolation. Even for "the web is slow," the culprit layer differs (a bad cable at L1, a switch MAC-table issue at L2, a routing error at L3, port blocking at L4, DNS failure at L7), and so does the remedy. This section nails the layer correspondence and encapsulation, then builds the ability to judge whether to use TCP or UDP from an application's requirements.
1.2.1OSI-to-TCP/IP correspondence
- The OSI reference model divides communication into seven layers, bottom to top: physical (L1) / data link (L2) / network (L3) / transport (L4) / session (L5) / presentation (L6) / application (L7). Each layer uses only the service below and provides one above, so swapping a lower layer does not affect upper layers (layer independence)—which is exactly why faults can be isolated across layers.
- The TCP/IP model has four practical layers: network access (roughly L1+L2) / internet (roughly L3) / transport (roughly L4) / application (roughly L5-L7). The key difference is collapsing OSI's top three layers into one. Catalog terms like "L2 switch" and "L3 switch" translate through this correspondence.
1.2.2Encapsulation and PDUs
- Encapsulation is the process by which, on the sending side, each layer adds its header (L2 also a trailer) and passes it down; the receiving side does the reverse, decapsulation, stripping headers layer by layer. Each layer's data unit is the PDU, named differently: data (L7) -> segment (L4/TCP) / datagram (UDP) -> packet (L3) -> frame (L2) -> bits (L1).
- The wording of a fault report is a hint: "frame FCS errors" points to L2/L1, "packets not arriving" to L3, "only a specific port fails" to L4, and "name will not resolve" to L7. Being able to instantly judge which layer/PDU a symptom belongs to speeds up isolation.
1.2.3Choosing between TCP and UDP
- TCP is connection-oriented. It establishes a connection with a three-way handshake (SYN -> SYN/ACK -> ACK) and guarantees reliability through ordering, retransmission, flow control, and congestion control. Use it where loss is unacceptable—web (HTTP/HTTPS), email, file transfer. Its overhead is higher.
- UDP is connectionless. Without a handshake or retransmission, it offers low latency and low overhead. It suits cases where immediacy matters more than occasional loss—DNS queries, voice/video (VoIP, streaming), and DHCP. If reliability is needed, the application compensates.
Most-tested: OSI 7 layers <-> TCP/IP 4 layers (top three collapsed into one); PDU names data/segment/packet/frame; TCP = reliable via three-way handshake, UDP = connectionless and low-latency. Also know port numbers: HTTP 80, HTTPS 443, DNS 53, DHCP 67/68, SSH 22, Telnet 23, SNMP 161, Syslog 514.
Suppose you are assigned to design communication for a new internal VoIP system and are investigating call-quality complaints. A developer initially proposes "send everything over TCP because loss is scary," but this mistakes the requirement. VoIP lives on real-time behavior: when a single packet is lost, discarding it and prioritizing the next sounds more natural than retransmitting stale audio to arrive late. To guarantee ordering and retransmission, TCP waits for the lost segment and buffers subsequent ones, and this retransmission delay (head-of-line blocking) worsens audio dropouts and latency. Therefore the audio media itself should be sent over UDP (atop RTP), tolerating some loss—the sound judgment. Within the same system, however, fetching the contact roster from a server or transferring a config file cannot tolerate even a single lost byte, so TCP is appropriate there. In other words, the correct design is not "TCP or UDP for the whole app" but choosing per traffic type—UDP for immediacy-critical media, TCP for integrity-critical control/data. In troubleshooting too, when VoIP breaks up, the first suspects are jitter/packet loss along the path (L3 quality) or whether a firewall is blocking UDP's specific ports (e.g., the RTP range, an L4 issue)—not blindly switching to TCP.
| Aspect | TCP | UDP |
|---|---|---|
| Connection | Connection-oriented (three-way handshake) | Connectionless |
| Reliability | Ordering, retransmission, flow/congestion control | No retransmission (loss tolerated) |
| Overhead/latency | Higher | Lower (low latency) |
| Good for | Web, email, file transfer | DNS, VoIP/streaming, DHCP |
Trap: "If reliability is needed, TCP is always optimal" is wrong—for real-time voice/video, retransmission delay (head-of-line blocking) actually degrades quality, so loss-tolerant UDP is appropriate. Also wrong: "if ping succeeds, the app is fine"—ping only verifies L3 reachability and cannot detect L4 port blocking or an L7 application fault.
1.2.4Section summary
- The OSI 7 layers collapse L5-L7 into the application layer in the TCP/IP 4 layers; layer independence underpins fault isolation
- Encapsulation adds a header at each layer while passing down; PDUs differ by layer: data/segment/packet/frame/bits
- TCP favors reliability (web, file transfer), UDP favors low latency (DNS, VoIP, DHCP); choose per traffic type
Sign in to track progress — Log in.
Quick check
(just a quick review)Q1. A new VoIP system draws complaints about choppy calls. A developer proposes "make all traffic, including audio, TCP to prevent loss." Which transport-protocol choice for the audio media is most appropriate?
Q2. A server responds to ping normally, but only HTTPS (TCP 443) access times out. What is the most appropriate next check to investigate the cause?
Q3. A network operator finds a log entry stating "frequent FCS errors on frames." Which layer is the described problem most likely occurring at?

