Watching the Layers
Lesson 23 of 32 in Coddy's The OSI Model course.
You can watch the layers cooperate with one command. When curl fetches a URL, it resolves the name (DNS), opens a TCP connection to the port (layer 4), and only then speaks HTTP (layer 7). With -v you literally see each stage narrated.
The layer 7 result is the status code: the server's three-digit answer. 200 means success. curl can print just that code with -o /dev/null -w "%{http_code}\n", throwing the page body away.
Time to run a whole stack, top to bottom, on your own machine.
Challenge
MediumRun a full protocol stack locally:
- Start a server on port 9220 in the background and wait for it
- Fetch
http://127.0.0.1:9220/withcurl -s, discarding the body, and print only the HTTP status code
Expected output:
200Try it yourself
All lessons in The OSI Model
6The Upper Layers
Session and PresentationThe Application LayerWatching the LayersRecap - Top of the StackPractice on your own: Terminal playground