Can Print, But No Websites? The Network Layer Explained | OSI Layer 3
The mail bag, the road atlas and the gate at the end of the street.
A user can ping the web server — every reply comes back — but the web page will not load. The data is reaching the right building; it just can't get in. In this episode Professor Flows explains the Transport layer using Byte City: numbered garage doors are ports, the cube truck is TCP, the bullhorn is UDP, and every conversation has a temporary return door.
A user can ping the web server. Every reply comes back, every time. But the web page will not load.
Ping working means the mail bag reaches the house, so Layers 1, 2 and 3 are all fine. The data is arriving at the right building. It just can't get in. So the question is whether the door is open on the far end. That is Layer 4 of the OSI model: the Transport layer.

Layer 3 gets the bag to the right house. But a house isn't one thing. The same server can run a website, a mail service and a remote login, all at once, all behind one lawn sign.
So every house in Byte City has numbered doors. The storefront is the web, and it answers to two numbers: 443 is the secure entrance, HTTPS, which is nearly every website today, and 80 is the older, unlocked one. Door 25 is the mail dock. Door 22 is the staff entrance, for remote administration. The lawn sign gets you to the building. The door number gets you to the right service inside it.
Those door numbers are ports. There are 65,536 of them, in three ranges:

Here is the half people forget. When your computer knocks on door 443, the server needs to know which door to answer at.
So before it sends anything, your computer opens a temporary door of its own, with a high random number. Say, 51514. Every piece it sends is tagged with both: to door 443, from door 51514. The reply comes straight back to that door.
Open a second browser tab and your computer opens a second temporary door. Same house, same server, two separate conversations, and the replies never get mixed up, because each has its own return door.
The return door is an ephemeral port. An address plus a door number is a socket. One conversation is simply a pair of them: 192.168.1.10:51514 and 10.0.5.20:443.

Layer 4 gives you two ways to travel, and they could not be more different. The first is the cube truck. That is TCP, and the truck never just turns up.
Before a single piece of data moves, the driver calls ahead. "I'd like to deliver to door 443. Are you there?" The house answers: "I'm here. Are you ready?" The driver confirms: "Ready."
Three messages. Their real names are SYN, SYN-ACK and ACK, and together they are the three-way handshake. SYN is short for synchronise: each side tells the other where its numbering starts, so the count of pieces that follows means the same thing at both ends.
Only after the third message is there a connection. If that door is shut, the handshake fails on the very first message, and nothing is ever sent. That is exactly what is happening to our user.

Once the connection is open, TCP does three things the road never promised.
Each piece, with its TCP tag, is a segment.

The second choice is the bullhorn. That is UDP. You walk up to the right door, shout the message once, and leave. No call ahead. No numbering. No signature. No second attempt. If it wasn't heard, it's gone.
That sounds like a worse deal, until you think about a phone call. If one tiny slice of a voice goes missing, the worst thing you can do is stop everything and deliver it again, two seconds late. You would rather have a tiny gap and keep talking. For anything live, late is worse than lost.
The bullhorn also suits quick questions. A DNS lookup is one small question and one small answer. Setting up a connection first would take longer than the conversation.
And the bullhorn is still aimed at one door. It is not a broadcast.
| TCP: the cube truck | UDP: the bullhorn | |
|---|---|---|
| Before sending | Calls ahead: the three-way handshake | Nothing. It shouts once at the door |
| Reliability | Every piece numbered, signed for, and sent again if lost | None. If it wasn't heard, it's gone |
| Described as | Connection-oriented, reliable | Connectionless, best effort |
| Each piece is called | A segment | A datagram |
| Rides it | Web pages, email, file transfers, remote login, video you can rewind | Voice and video calls, live streams and games, DNS lookups (UDP 53, TCP for big answers), DHCP (UDP 67 and 68) |
The door numbers go on a tag tied directly to the data: the segment. The segment goes into the mail bag, which adds the lawn-sign numbers. The mail bag goes into the crate, which adds the brass plaques. Then the road carries it as bits. Door, address, plaque: Layer 4, 3, 2.

ping 10.0.5.20 answers, so the house is reachable. The reply says TTL=62: it started at 64 and crossed two routers.
Now test the door, not the house. On Windows, Test-NetConnection 10.0.5.20 -Port 443 tries the handshake for you. PingSucceeded: True. TcpTestSucceeded: False. The building is there. The door is shut.
So look from the inside. On the server, netstat -an lists every door that is open and listening. 22 and 25 are there. 443 and 80 are both missing: the web service had stopped. Start it, and both storefront doors appear as LISTENING. A moment later there is a new line marked ESTABLISHED: her address, her return door 51514, talking to door 443.
Two causes produce this exact symptom: a service that isn't running, or a firewall blocking the port. A stopped service slams the door: a reset comes straight back. A firewall that drops silently leaves you waiting for a timeout.
For the Network+ exam, the handshake order is SYN, SYN-ACK, ACK: the client asks, the server answers and asks back, the client confirms.
TCP sets up a connection, numbers the data, waits for acknowledgements and resends what is lost. UDP sends each message once, with no connection and no resend, which suits live voice, video and quick lookups.
A number from 0 to 65535 that identifies one service on a host. The IP address gets data to the right machine; the port gets it to the right program.
Three messages that open a TCP connection: SYN, SYN-ACK, ACK. Each side tells the other where its numbering starts before any data is sent.
A temporary, high-numbered port your computer opens for one conversation so the reply has somewhere to come back to. The exam range is 49152 to 65535.
Ping only proves the machine is reachable. The page also needs port 443 or 80 to be open. Either the web service is not running or a firewall is blocking the port.
Five questions on this lesson. Pick an answer to see why.
Previous
The mail bag, the road atlas and the gate at the end of the street.
Next
The delivery window, and the phone call that hangs up at thirty-two seconds.
Related
A city, seven floors, and why the model lost as a design and won as a language.
Related
The storefront, the mail room and the Yellow Pages, where every conversation begins.
Exam objectives: CompTIA Network+ N10-009: 1.1 (OSI model), 1.4 (ports and protocols: TCP and UDP, connection-oriented vs connectionless), 5.5 (netstat, ping, Test-NetConnection).
Byte City is not affiliated with or endorsed by CompTIA.