OSI & TCP/IP models
Networking is built in layers, each doing one job and talking only to the layers next to it. The OSI model has 7 layers (a teaching model); the TCP/IP model has 4 (what the internet actually uses).
| Layer (top to bottom) | Job | Example |
|---|---|---|
| Application | What the user's app speaks | HTTP, DNS |
| Transport | Reliable/fast delivery between apps | TCP, UDP |
| Network | Routing across networks | IP |
| Link | Delivery on the local wire/wifi | Ethernet, MAC |
TCP vs UDP
Both are transport-layer protocols, but they make opposite trade-offs.
| TCP | UDP | |
|---|---|---|
| Reliable? | Yes, confirms delivery, retransmits | No guarantees |
| Ordered? | Yes, in-order | No |
| Speed | Slower (overhead) | Faster (lean) |
| Use for | Web, email, file transfer | Video calls, games, live streams |
TCP starts with a three-way handshake (SYN → SYN-ACK → ACK) to set up a reliable connection before any data flows.
HTTP, HTTPS & status codes
HTTP is the application-layer protocol browsers use to request web resources. HTTPS is HTTP wrapped in TLS encryption, so no one in the middle can read or tamper with it.
- 2xx success (200 OK).
- 3xx redirect (301 moved permanently).
- 4xx client error (404 not found, 401 unauthorized).
- 5xx server error (500 internal server error).
Common methods: GET (read), POST (create), PUT (update/replace), DELETE (remove).
DNS: names to addresses
DNS (Domain Name System) is the internet's phone book: it translates a human name like github.com into the IP address machines actually use to connect.
A lookup may pass through several DNS servers (resolver → root → TLD → authoritative), and results are cached along the way so repeat visits are fast.
What happens when you visit a URL
The classic interview question. Here is the chain, left to right:
In words: the browser resolves the domain to an IP via DNS, opens a TCP connection (plus a TLS handshake for HTTPS), sends an HTTP request, the server returns HTML, and the browser renders it, fetching CSS, JS, and images as needed. You can watch this live with curl -v in the Networking Toolkit.
Final quiz
Ten questions across models, TCP/UDP, HTTP, DNS, and the URL walkthrough. Aim for 7+.
What to do next
Read each section, then take its quiz. The final quiz scores you out of 10. Want to see these concepts run on your own machine? Pair this with the hands-on Networking Toolkit. It is also the deep dive for the CS Fundamentals Networks section. Stuck? Tap ✦ Ask AI.