The Transport Layer (OSI Layer 4)
Lesson 1 gave you the transport layer’s identity. This lesson pins down its exact duties inside the OSI model, where its header sits during encapsulation, and the canonical port numbers and ranges from the IANA registry that the exam expects you to recall precisely.
Position: between application and network
The OSI transport layer sits in the middle of the stack — layer 4 of 7 — directly between the application layers (5–7, which provide the data) and the network layer (3, which forwards it). It is the bridge between “what the user’s program wants” and “what the network can carry”. When engineers debug, they draw a line here: everything above L4 is called upper layers (application-focused), and everything at or below L4 handles delivery details.
Because it sits in this position, the transport layer provides the first host-to-host (end-to-end) service in the model. Each host runs its transport layer; intermediate routers do not. That is what makes the transport header invisible to the network itself and read only by the two endpoints.
End-to-end delivery
Moves data between two applications, identified by source and destination port numbers. TCP and UDP.
Reliability
Receives acknowledgements and retransmits segments that time out. TCP only.
Flow control
Uses the advertised window so the sender cannot overwhelm the receiver. TCP only.
Error detection
A checksum over the header and data; corrupt segments are discarded. TCP and UDP.
The four duties of Layer 4
Exam answers about “what does the transport layer do?” must cover these four jobs. Select one to see who provides it.
| Duty | What it does | Who provides it |
|---|---|---|
| End-to-end delivery | Moves data between two applications on two hosts, identified by port numbers (source + destination). | TCP and UDP |
| Reliability | Receives acknowledgements (ACKs); retransmits segments that timeout or are negative-ACKed. | TCP only |
| Flow control | Prevents the sender from overwhelming the receiver by using windows: the receiver advertises how much data it can accept; the sender may send only that much. | TCP only (window); UDP does none |
| Error detection | Calculates a checksum over the header and data; the receiver discards or flags corrupt segments. | TCP and UDP (both carry a checksum field) |
Encapsulation order (L4 → L3)
During encapsulation the transport layer is the first to add a header to the raw application data:
- Application produces data.
- Transport adds its header (TCP or UDP) — the result is a segment (TCP) or datagram (UDP).
- Network adds its IP header around that — the result is a packet.
- Data link adds its Ethernet header and FCS trailer — the result is a frame.
So the transport header always ends up inside the IP header. De-encapsulation is the reverse order: the receiver’s IP layer strips the IP header, then hands the segment to TCP, which strips its header and delivers the data to the application named by the destination port. The L4 header fields (source port, destination port, sequence number, etc.) are read by TCP/UDP in the host’s operating system — never by the routers in between.
Port ranges (IANA, canonical)
The IANA registry (RFC 6335) divides the 16-bit port space into three ranges. These numbers are non-negotiable on the exam.
| Range | Numbers | Who uses it |
|---|---|---|
| Well-known | 0–1023 | System and server services (HTTP 80, HTTPS 443, SSH 22, DNS 53). |
| Registered | 1024–49151 | User applications and vendor services that have registered a port (many games, database servers, web services on >1023). |
| Dynamic / private | 49152–65535 | Ephemeral (temporary) client source ports; not assigned to any service. |
Every range boundary is a shared rule, not a security boundary: listening on a well-known port does not make a service more “official” — the ranges are conventions managed by IANA so that when two programs meet, they can agree on the port without asking each other first.
The well-known port table
Memorise these IANA service values exactly. The “Protocol” column is what the exam checks: it says whether the service uses TCP, UDP, or both. Select a service to see its port and transport.
| Service | Port | Protocol | Note |
|---|---|---|---|
| FTP data | 20 | TCP | Active FTP opens a second, data connection to port 20. |
| FTP control | 21 | TCP | Commands and replies; the “control” connection. |
| SSH | 22 | TCP | Secure shell; encrypted remote access. |
| Telnet | 23 | TCP | Unencrypted remote access (never use on the Internet). |
| SMTP | 25 | TCP | Email sending / mail transfer. |
| DNS | 53 | Both TCP & UDP | UDP for queries; TCP for zone transfers and large replies. |
| TFTP | 69 | UDP | “Trivial” file transfer — no reliability built in. |
| HTTP | 80 | TCP | Plain web traffic. |
| POP3 | 110 | TCP | Email retrieval (downloads mail to the client). |
| IMAP4 | 143 | TCP | Email retrieval (mail stays on the server). |
| HTTPS | 443 | TCP | Encrypted web traffic (TLS). |
| DHCP client | 68 | UDP | Client’s side of DHCP address assignment. |
| DHCP server | 67 | UDP | Server’s side of DHCP; answers broadcasts from 67. |
| SNMP | 161 | UDP | Network management polling and traps. |
| NTP | 123 | UDP | Network Time Protocol — time synchronisation. |
- DNS is both TCP and UDP — the honest answer is “both”, not just UDP.
- DHCP has two ports: server 67, client 68 (both UDP).
- FTP is two connections: command on 21, data on 20.
- SNMP is 161 UDP; remote syslog messaging’s legacy port is 514 — do not blur them.
- TFTP (69) is UDP, FTP (20/21) is TCP — the similarity in name is the whole trick.
- HTTPS is 443 TCP; HTTP is 80 TCP. Do not swap them.
Servers fix their ports; clients go ephemeral
For a client to reach a server, the client must know the server’s port in advance — so the server binds to a well-known port and listens there for the lifetime of the service. The client, by contrast, picks a temporary ephemeral source port for each connection and releases it when the conversation ends. Modern operating systems take ephemeral ports from the dynamic/private range (49152–65535); some older systems and textbooks also allow the registered range down to 1024. What never changes is the principle: the destination port selects the service; the source port identifies the conversation.
Trace it: when the server replies, it swaps the pair — the reply uses destination port 49152 (host A’s socket) and source port 80. That is how the server’s reply finds the exact browser tab that asked. Two clients on host A to the same server differ only in source port, so even they remain distinct conversations.
Key terms
| Term | Meaning |
|---|---|
| Well-known port | Port 0–1023, reserved for standard server services. |
| Registered port | Port 1024–49151, for user applications and vendor services. |
| Dynamic / private port | Port 49152–65535, used for ephemeral client source ports. |
| Ephemeral port | A short-lived source port a client picks for one conversation. |
| 4-tuple / socket pair | Source IP, source port, destination IP, destination port — uniquely identifies a conversation. |
| ACK / retransmit | TCP’s reliability mechanism: the receiver acknowledges data; unacknowledged data is resent. |
| Window | The amount of data a receiver advertises it is ready to accept; the basis of flow control. |
Review
Check what you have learned with these review questions.
Sources & references
- Cotton, M., Eggert, L., Touch, J., Westerlund, M. & Cheshire, S. RFC 6335: IANA Procedures for the Management of the Service Name and Transport Protocol Port Number Registry (2011), Sections 8.1–8.3 (port ranges). rfc-editor.org/rfc/rfc6335.
- IANA. Service Name and Transport Protocol Port Number Registry. iana.org.
- Postel, J. RFC 793: Transmission Control Protocol (1981), Section 1.3 (the four TCP header ports are among the fields defined). rfc-editor.org/rfc/rfc793.
- Braden, R. RFC 1122: Requirements for Internet Hosts — Communication Layers (1989). rfc-editor.org/rfc/rfc1122.
- Cisco. CCNA (200-301) Exam Topics, Network Fundamentals (transport and application-layer well-known ports). cisco.com.
Target exams: CCNA 200-301 v1.1 · CyberOps Associate 200-201. Last content verification: 2026-10-11.