DNS TTL Killed a Migration — Computer Networks Interview
A 24-hour DNS TTL caused 30% traffic failure during a migration.
- OSI model isn't theory — it's a fault-isolation map for debugging network problems.
- TCP guarantees delivery (at a cost); UDP trades reliability for speed — choose based on data criticality.
- DNS resolution walks a cached hierarchy: browser → OS → resolver → root → TLD → authoritative.
- HTTPS = HTTP + TLS; the extra handshake adds ~2 RTT but protects data in transit.
- Subnetting with CIDR is how cloud providers isolate networks and control traffic flow.
Imagine the internet is a global postal system. Your computer is a house with an address (IP address), the postal routes are the network cables and Wi-Fi signals, and the rules about how letters get packed, addressed, and delivered are the protocols. When you visit google.com, you're essentially writing a letter, dropping it in a mailbox, watching it get sorted through multiple post offices (routers), and getting a reply back — all in milliseconds. Computer networking is the science of making that postal system fast, reliable, and secure.
Every backend engineer, DevOps engineer, and full-stack developer eventually sits across from an interviewer who asks 'What happens when you type a URL into a browser?' That question alone can make or break a senior-level interview. Networking isn't just a theoretical subject — it's the invisible infrastructure that your APIs, databases, and microservices live on. Understanding it deeply separates candidates who just write code from engineers who understand systems.
The OSI Model — Why 7 Layers Actually Matter in Practice
The OSI (Open Systems Interconnection) model is a framework that breaks network communication into 7 distinct layers. Most people memorize the names ('Please Do Not Throw Sausage Pizza Away') and stop there. That's a mistake. Understanding what each layer is responsible for helps you debug real problems.
[Image of the 7 layers of the OSI model]
When your HTTP request fails, is it a DNS issue (Layer 7/5), a TCP connection problem (Layer 4), or a routing issue (Layer 3)? Knowing the layers lets you mentally narrow down where the fault is, just like a doctor using anatomy to diagnose illness.
In practice, you rarely work below Layer 4 (Transport) unless you're writing embedded systems or kernel code. But you absolutely need to understand Layers 3, 4, and 7 — IP addressing, TCP/UDP, and application protocols — because they appear in every production debugging scenario, from a failing API call to a slow database connection.
Here's the critical insight: layers are about separation of concerns. Each layer only talks to the layer directly above and below it. That's why you can swap out Wi-Fi for Ethernet (Layer 1/2 change) without rewriting your HTTP code (Layer 7). The abstraction is intentional and powerful.
TCP vs UDP — Choosing the Right Delivery Guarantee
TCP (Transmission Control Protocol) and UDP (User Datagram Protocol) are the two workhorses of the Transport layer, and choosing between them is one of the most consequential decisions in system design.
TCP is like sending a package with signature confirmation. Before any data moves, there's a 3-way handshake (SYN, SYN-ACK, ACK). Every packet is numbered, acknowledged, and retransmitted if lost. Order is guaranteed. This reliability costs time — that handshake adds latency, and the acknowledgment mechanism adds overhead.
UDP is like dropping a flyer through every door in the neighbourhood. You send it and forget it. No handshake, no acknowledgment, no guarantee of delivery or order. But it's blazingly fast, which is exactly what you need for real-time applications.
In modern systems, QUIC (used by HTTP/3) is effectively UDP with reliability built on top of it — proof that the TCP/UDP choice isn't always binary.
DNS Deep Dive — What Actually Happens When You Type a URL
DNS (Domain Name System) is the internet's phonebook. You know the name (google.com), and DNS finds the phone number (IP address). But the process behind that lookup is more fascinating than most people realise — and it's a classic interview question.
When your browser needs to resolve 'api.github.com', it doesn't just ask one server. It walks a hierarchy. First, it checks its local cache. If that's empty, it asks your OS's resolver. If that misses, it queries your ISP's recursive resolver. That resolver then walks the DNS tree: it asks a Root Name Server for the authoritative server for '.com', then asks that server for 'github.com', then finally asks GitHub's authoritative DNS server for 'api.github.com'. The answer comes back and gets cached at every step.
HTTP vs HTTPS, Status Codes, and Subnetting — The Interview Essentials
These three topics appear in virtually every networking interview, so let's cover them with precision.
HTTP vs HTTPS: HTTP sends everything in plaintext. HTTPS wraps HTTP inside TLS (Transport Layer Security). The TLS handshake happens after the TCP handshake. After that, all data is encrypted.
HTTP Status Codes: These are a language. 2xx means success. 3xx means redirect. 4xx means the client made an error. 5xx means the server failed.
Subnetting: An IP address like 192.168.1.100/24 means the first 24 bits identify the network and the last 8 bits identify the host. /24 gives you 256 addresses (254 usable).
Production Network Debugging: Tools Every Engineer Should Know
Knowing theory is one thing. Being able to diagnose a real outage under pressure is what separates senior engineers. Here are the tools that matter in production:
dig — The DNS Swiss Army knife. dig +trace shows you the full resolution path. dig -x does reverse lookup.
curl — Every engineer's first tool for HTTP debugging. Verbose mode (-v) shows the entire handshake. -k bypasses certificate validation (for testing only!).
tcpdump — Raw packet capture. Filter by host, port, or protocol. -A prints ASCII payload. Critical for diagnosing retransmissions and dropped packets.
traceroute/mtr — Shows the path packets take and where latency spikes. mtr combines ping and traceroute in real-time.
netstat/ss — Check open ports, connection states, and socket buffers. ss -tuln lists all listening TCP/UDP ports. ss -s shows overall statistics.
In an interview, being able to describe a real debugging session (e.g., 'I used tcpdump to spot TCP retransmissions, then mtr to find a congested router') is worth more than reciting the OSI layers.
- L1/L2: Physical link up? Check cables, carrier detect, interface stats.
- L3: IP connectivity? Ping the target (but remember ICMP may be blocked).
- L4: Port reachable? Telnet or curl against the port.
- L7: Application responding? Check HTTP status, response body, latency.
- If all layers pass locally but fail in production, the issue is likely configuration (firewall, DNS, load balancer rules).
The DNS TTL That Killed a Migration
- Always lower TTL to 60–300 seconds at least 24 hours before any IP change.
- Monitor DNS propagation with tools like dig +trace or whatsmydns.net.
- Keep the old server running until traffic drops to zero — not just until you flip the record.
Key takeaways
Common mistakes to avoid
5 patternsThinking a 'ping' failure always means the server is down
Confusing the 3-way handshake (TCP) with the SSL handshake (TLS/HTTPS)
Not knowing the difference between a Recursive and Iterative DNS query
Ignoring the 'Ephemeral Port' range when debugging why a server can't make new outgoing connections
netstat -n | wc -l and tune ip_local_port_range if needed.Assuming HTTP 503 means the server is overloaded
Interview Questions on This Topic
What is the difference between an IP address and a MAC address, and at which OSI layers do they operate?
Frequently Asked Questions
That's Computer Networks. Mark it forged?
4 min read · try the examples if you haven't