ByteByte CityCity
All lessons
OSI Model

Ping Works, Names Don't: DNS and the Application Layer | OSI Layer 7

8:07 Watch on YouTube

Tuesday morning: "the internet is down" is on every desk in the building. Except it isn't. Ping an address on the far side of the world and it answers in twelve milliseconds. Type a name and nothing. Every layer below is doing its job; the one thing the building can't do is ask for what it wants. In this episode Professor Flows explains the Application layer using the three places a request begins in Byte City: the storefront, the mail room and the Yellow Pages.

You'll learn

Chapters

  1. 0:00Tuesday morning: "the internet is down"
  2. 0:38Where a request begins: the storefront
  3. 0:55The storefront: slips and receipts (HTTP)
  4. 1:44The mail room: no curbside mailboxes
  5. 2:00Sending is a push, reading is a pull (SMTP, IMAP, POP3)
  6. 2:51The Yellow Pages: where every conversation begins
  7. 3:03The lookup: a name in, a number out (DNS)
  8. 3:58The staff entrance (SSH) and the leasing office (DHCP)
  9. 4:45The real names, and the honest footnote
  10. 6:11The real thing: ping works, the name doesn't
  11. 6:39The service that answers the door is stopped
  12. 7:08Exam corner
  13. 7:21Recap: the whole building, and next time

The written lesson

The problem: "the internet is down"

Tuesday morning. "The internet is down." That's the ticket, and it's on every desk in the building.

Except it isn't. Ping 8.8.8.8, an address out on the internet, and it answers in twelve milliseconds. The road works and the gate works: Layers 1, 2 and 3 are fine.

Now type a name, www.bytecity.tech, and nothing. The browser says the server's IP address could not be found. The address works. The name doesn't.

The building can move data. It just can't ask for what it wants. That is Layer 7 of the OSI model: the Application layer.

The storefront: slips and receipts

Diagram titled The storefront - HTTP: YOUR BROWSER holds a RECEIPT 200 OK and the goods across THE COUNTER from THE WEB SERVER, under a DOOR 80 sign. Banner: 200 - OKAY, HERE IT IS
HTTP is a slip across the counter and a receipt back. 200 means here it is.

Every lesson so far has been about getting the data there. This one is about what the data is for, and in Byte City most requests begin at the storefront.

That is door 443, or door 80 without the lock. Behind it is a shop. You hand a slip across the counter: "Get me the catalogue page." The shopkeeper fetches it and hands it back with a receipt: "200, okay, here it is." Ask for something that isn't on the shelves and you still get a receipt: "404, not found."

Those slips and receipts are the rules of the storefront. The real name is HTTP: the slip is the request, the receipt is the response, and its number is the status code.

Your browser is the customer; HTTP is how the customer and the shop talk. Put the lock from the Layer 6 lesson on the door and it's HTTPS: the same slips, inside the wrap.

The mail room: a push to send, a pull to read

Diagram titled The mail room - SMTP, IMAP, POP3. THE MAIL-SERVER HOUSE has pigeon-holes, one with a letter; doors 25 and 587 are the mail dock, 143 and 110 the reading doors. A PULL arrow runs to a phone and a laptop. Banner: THAT'S IMAP
IMAP reads the letter where it sits, so every device sees the same mail.

The second place a request begins is the mail room. Byte City has one rule about mail: no house has a mailbox at the curb. Every letter goes through a numbered door, and the only pigeon-holes in the city are inside the mail-server house.

Sending is a push. Your letter goes to the mail dock: door 25 between mail houses, and the side door, 587, when your own mail app hands one in. It ends up sorted into the pigeon-hole of whoever it's addressed to. Those are the rules of sending, and the real name is SMTP.

Reading is a pull, and there are two styles.

  • Walk in and read your letters in the pigeon-hole, from your phone, then from your laptop, and they're still there. That's IMAP, and it's why your mail looks the same on every device.
  • Take the letters home and leave the pigeon-hole empty. That's POP3: older, simpler, and in practice one device at a time.

Sending and reading are different conversations, through different doors, which is why mail can go out perfectly well while nothing comes in.

The Yellow Pages: a name in, a number out

Diagram titled The Yellow Pages - DNS. YOUR BROWSER holds the answer 203.0.113.10 from THE YELLOW PAGES OFFICE at door 53, and a TCP truck sets off toward THE STOREFRONT, door 443. Banner: NOW THE TRUCK CAN LEAVE
The lookup comes first. Only once the name is a number can the truck leave for door 443.

Here is where every conversation actually begins. People know names. Trucks need street numbers. Before your browser can go near the storefront, it has to turn a name into a number.

So it asks the Yellow Pages, with the bullhorn from the Layer 4 lesson aimed at the office's door 53, because this is one small question and one small answer. "www.bytecity.tech?" The office shouts back: "203.0.113.10." Now the truck can leave.

If the office doesn't have a listing, it asks the people who publish that name, on your behalf, and keeps a copy for next time. Your own machine keeps a copy too, for a while.

The real name is DNS. This is the lookup that failed on Tuesday morning: the road was fine, the storefront was open, and nobody could find the number. DNS gets a complete lesson of its own.

Two more doors: SSH and DHCP

The leasing office kiosk, with a paint pot, a brush and a lawn sign painted 192.168.1.20 on its counter, and blank signs beside it. Chips along the top end with LEASING OFFICE. Caption: THE LEASING OFFICE IS WHO REPAINTS IT
DHCP is the leasing office: it lends a house its lawn-sign number for a while.

Door 22 is the staff entrance. That's SSH: a technician letting themselves in to work on the house from across town. It's a wrapped, locked conversation, like the storefront's lock, but for the people who run the building rather than shop in it.

Then the leasing office. In the Layer 3 lesson the lawn sign was the address, and it can be repainted. The leasing office is who repaints it: a house moves onto a street, asks for a number, and gets one on loan for a while. That's DHCP. It's Layer 7 too, a conversation with rules like all the others, and it gets its own lesson.

The real names, and the honest footnote

Card titled FILED UNDER LAYER 7 FOR THE EXAM - WITH THEIR DOOR NUMBERS: HTTP 80, HTTPS 443, SMTP 25 / 587, IMAP 143 / 993, POP3 110 / 995, DNS 53, SSH 22, DHCP 67 / 68, above the house's 443/80, 25 and 22 doors
The Layer 7 protocols the exam expects, each with its door number.
In Byte CityReal nameDoors
The storefront: a slip in, a receipt backHTTP / HTTPS80 / 443
The mail dock: sendingSMTP25, and 587 from your mail app
The pigeon-holes: readingIMAP and POP3143 / 993 and 110 / 995
The Yellow Pages office: a name in, an address outDNS53
The staff entranceSSH22
The leasing officeDHCP67 / 68

For the exam, those six and their door numbers are the core of Layer 7. Know which building each one lives in.

Now the honest footnote. Layer 7 is not your application. Your browser is not Layer 7. Your mail app is not Layer 7. They are the customers. Layer 7 is the set of rules the customer and the shop agree to speak: the slips, the receipts, the pigeon-holes.

The four-floor building from the OSI Model lesson, the TCP/IP model, simply calls its top floor Application, and it holds the packing room and the delivery window as well. Same rules. Fewer floors.

The real thing: the Yellow Pages were closed

Windows PowerShell on the server NS1. Get-Service DNS shows the DNS Server service Stopped; after Start-Service DNS it shows Running. Caption: THE SERVICE THAT ANSWERS THE DOOR IS STOPPED
The office wasn't giving wrong answers. It was closed.

Back to Tuesday morning. ping 8.8.8.8 replies. ping www.bytecity.tech "could not find host." So ask the Yellow Pages directly. nslookup www.bytecity.tech says "DNS request timed out." Not a wrong answer: no answer. The office isn't picking up.

ipconfig /all shows this machine is pointed at the right DNS server, 192.168.1.53. So walk over to the office itself. There, Get-Service DNS shows the DNS Server service Stopped. Run Start-Service DNS and it's Running.

Back on the desk, nslookup answers: www.bytecity.tech, address 203.0.113.10. Name in, number out. The page loads. The internet was never down. The Yellow Pages were closed.

The tip: if the address works and the name doesn't, stop looking at the road. It's the Yellow Pages. Nine times out of ten, that one question saves you an hour.

For the Network+ exam: a user can ping 8.8.8.8 but can't reach a website by name. Which layer and service first? Layer 7, DNS. The ping clears the cable and the gateway, and the user never got as far as port 443.

The whole building

Layer 7 is the storefront, the mail room and the Yellow Pages, and it's the rules, never the app. That completes the building's seven floors: the road, the crate, the mail bag, the truck, the window, the packing room and the storefront. Next they go together: one click, followed all the way down, across the city and all the way back up.

Quick answers

Why can I ping an IP address but not a website name?

The network works, but the name can't be turned into an address: a DNS problem. Test with `nslookup` and check the DNS server shown by `ipconfig /all`.

What does the application layer do in the OSI model?

It holds the rules programs use to ask and answer: HTTP, SMTP, IMAP, POP3, DNS, SSH and DHCP. The browser itself is not the layer; it speaks those rules.

What is the difference between IMAP and POP3?

IMAP keeps mail on the server, so every device sees the same mailbox. POP3 downloads it and usually removes it from the server, which ties it to one device.

What do HTTP status codes 200 and 404 mean?

200 OK means the server found what was asked for and sent it. 404 Not Found means the server answered, but that page doesn't exist there.

What port does DNS use?

Port 53. Ordinary lookups use UDP, because they are one small question and one small answer.

Key terms

Application layer
—
Layer 7: the rules for making and answering requests, not the program itself.
HTTP / HTTPS
—
a request, a response and a status code such as 200 or 404; HTTPS is HTTP inside TLS. Ports 80 and 443.
SMTP
—
sending mail. Port 25 between servers, 587 from your mail app.
IMAP / POP3
—
reading mail: on the server (143 / 993), or taken home (110 / 995).
DNS
—
a name in, an IP address out. Port 53.
SSH
—
encrypted remote administration. Port 22.
DHCP
—
lends a host its IP address for a while. Ports 67 and 68.
Next: What Happens When You Click a Link: All 7 OSI Layers in One Trip

Quick quiz

Five questions on this lesson. Pick an answer to see why.

  1. 1. A user can send email normally, but no new messages arrive in her inbox. How can one direction work while the other fails?
  2. 2. A user reads email on a phone and a laptop and wants both to show the same messages, kept on the server. Which protocol fits?
  3. 3. Which transport protocol and port does a client normally use for an ordinary DNS lookup?
  4. 4. A colleague says, "The web browser works at Layer 7." Which statement is more accurate?
  5. 5. A user asks a working web server for a page that does not exist. Which HTTP status code comes back on the response?

Keep learning

Previous

Thumbnail for "Your Connection Is Not Private": TLS and Encoding | OSI Layer 68:11
OSI Model

"Your Connection Is Not Private": TLS and Encoding | OSI Layer 6

The packing room: the label printer, the vacuum sealer and the lock on door 443.

8:11 Watch

Next

Thumbnail for What Happens When You Click a Link: All 7 OSI Layers in One Trip8:28
OSI Model

What Happens When You Click a Link: All 7 OSI Layers in One Trip

One click, seven floors down, across the city, and back. Every layer in one trip.

8:28 Watch

Related

Thumbnail for Ping Works, Page Won't Load: Ports, TCP and UDP | OSI Layer 49:32
OSI Model

Ping Works, Page Won't Load: Ports, TCP and UDP | OSI Layer 4

Numbered doors, the truck that calls ahead and the bullhorn that doesn't.

9:32 Watch

Related

Thumbnail for The OSI Model Explained: 7 Layers in One City9:50
OSI Model

The OSI Model Explained: 7 Layers in One City

A city, seven floors, and why the model lost as a design and won as a language.

9:50 Watch

Exam objectives: CompTIA Network+ N10-009: 1.1 (OSI model, Layer 7), 1.4 (common ports and protocols), 1.6 (DNS, DHCP), 5.3 (name resolution troubleshooting), 5.5 (ping, nslookup, ipconfig).

Byte City is not affiliated with or endorsed by CompTIA.