Unit 1 of 8 · about 3 hours · explain
Network layers, addressing, routing and DNS
Every later diagnosis in this section starts by asking which layer broke. Layers do not exist on the wire; they are a debugging vocabulary, and DNS plus routing are the two lookups every connection performs first.
You'll be able to
- Use the OSI 7-layer and TCP/IP 4-layer models to place a failure at the right layer, and state where each model misleads.
- Trace a DNS lookup from stub resolver through root, TLD and authoritative server, and apply the TTL expiry rule.
- Read a host routing-table entry and predict the next hop with longest-prefix match.
Covers
Read
In this order, only the parts listed
0 of 4 done
- The OSI 7-layer modelAlgoMaster Networks - pcap and concurrent server labs
The Seven Layers at a Glance; Encapsulation Across the Stack; Using OSI to Diagnose a Failure; Where the Model Has Limits
- The TCP/IP 4-layer modelAlgoMaster Networks - pcap and concurrent server labs
The Four Layers; Mapping TCP/IP to OSI; A Complete Request in TCP/IP Terms; Boundaries in Modern Protocols
- Layering, IP and routing in Beej's Network ConceptsBeej's Guide to Network Concepts - TCP and UDP path
Chapter 4, The Layered Network Model (Sections 4.3 and 4.4); Chapter 18, IP Routing (Sections 18.2 to 18.5)
- DNS hierarchy and debuggingAlgoMaster Networks - pcap and concurrent server labs
Domains and Zones Are Different; Following the Chain of Authority; Practical Implications for Engineers; then Debugging DNS with dig and nslookup: The Basic dig Command, Walk the Delegation with
+trace, Diagnose Cache and TTL BehaviorUse https://algomaster.io/learn/computer-networks/debugging-dns for the dig sections; skip DNSSEC detail.
Focus on
- OSI layers are an explanatory model. The wire carries frames, packets and segments; nothing is tagged with a layer number.
- DNS resolution is a chain of referrals with per-record TTLs. A cached answer is valid while now is earlier than stored time plus TTL; reading it does not refresh it.
- Routing is longest-prefix match on the destination, per packet, per hop. The default route is only the shortest prefix that matches.
- Sending adds transport, internet and link headers around application data in that order; receiving strips them in reverse.
Common mistakes · 3
- Treating OSI as seven things a packet passes through in code. Implementations merge and skip layers; TLS, for example, sits between transport use and the application.
- Reading a DNS TTL as a freshness guarantee. It bounds staleness; an authoritative change still waits out the TTL at every cache.
- Inferring network meaning from dotted quads or old class letters. Only the prefix length defines the network part.
Try it yourself
Closed-book, before checking anything
dig +short example.com twice and compare the answer sets. Then closed-book, write the cold-lookup chain (stub to recursive to root to TLD to authoritative) and evaluate the TTL rule on store(api.example, 192.0.2.10, TTL 10, t=100): resolve at hits, at misses.Quiz yourself
Answer first, then mark it. Missed ones go to Review.
0 got · 0 missed
1.A record stored at with TTL 10 is resolved at . Hit or miss, and why?Answer
Miss. It is valid only while , and resolving does not refresh the expiry.
2.Entries cover
10.0.0.0/8and10.1.2.0/24. Which carries a packet for10.1.2.9?Answer10.1.2.0/24. Longest-prefix match wins; the /24 is more specific than the /8.3.Why can two applications on one host share one IP address without conflict?Answer
The transport port number separates them. The IP address names the host; the port names the socket endpoint.
4.A capture shows HTTP inside TLS inside TCP inside IPv4 inside Ethernet. Which layering claim does this support?Answer
Encapsulation order only. It shows headers wrapped around data; it does not prove a seven-layer implementation.
Practice
- AlgoMaster: Implement a DNS TTL Cache
storeandresolvewith TTL expiry (), case-insensitive names, cachedNXDOMAINDo not refresh expiry on
resolve; the 109-hit 110-miss boundary in Reproduce is the first case to pass.
You're done when
You place a refused connection, an NXDOMAIN and a wrong route at the right layer on the first guess, and your TTL cache passes the 109-hit 110-miss boundary.
Only when you can do this without notes.
Leads to
Notes
Resources · 2 for this unit, 7 more in the section
- Beej's Guide to Network Concepts - TCP and UDP pathBrian Hall · required
Read the OS and sockets, protocol layering, IP, UDP and TCP chapters alongside packet captures from your own client and server. Use it to explain transport behavior rather than memorize layer names.
- AlgoMaster Networks - pcap and concurrent server labsAlgoMaster · required
Use Reading a Packet Capture: A Real Bug and Building a Concurrent TCP Echo Server after the Beej implementation. Reproduce one packet-level observation and one admission, deadline or shutdown behavior in your independently written service.
Also in this section
- Beej's Guide to Network Programming - sockets to multiplexingBrian Hall · primary
Read What is a socket?, IP addresses and data structures, Client-server background, System calls or bust, Client-server examples, Slightly advanced techniques and sendall. Build the simple TCP pair first, then replace delimiter assumptions with a bounded length-prefixed protocol.
- MIT 6.5840 - RPC, threads and fault vocabularyMIT PDOS · support
Read the introductory RPC and threads material plus the lab guidance. Use it to enumerate timeout ambiguity and duplicate effects. Stop before Raft and the full lab sequence.
- Replicated Log and Stream Processor - protocol sliceRoadmap-Final · support
Use only the protocol requirements, deterministic network fault matrix and delivery-contract questions. Build the single-node framed service now; keep replication and consensus for the later project.
- Designing Data-Intensive Applications, 2nd edition - Chapter 5O'Reilly · required
Read Formats for Encoding Data (printed pp. 163 to 177) for schema merits and compatibility, and Dataflow Through Services: REST and RPC (printed pp. 180 to 186) for service dataflow, version coexistence and the idempotence pointer.
- gRPC Deadlines guidegRPC Authors · reference
Read Overview, Deadlines on the Client and Deadline Propagation for absolute deadlines, remaining-time forwarding and clock-skew shielding.
- gRPC Status CodesgRPC Authors · reference
Read the full status list, including
DEADLINE_EXCEEDED,UNAVAILABLEand the codes never generated by the library, for the error taxonomy. - W3C Trace ContextW3C · reference
Read Section 3.2 for the
traceparentformat and Sections 3.4 to 3.5 for the legaltraceparentandtracestatemutations when forwarding.