← Back to Computer Networks

Computer Networks — Quick Summary

Quick revision: every topic, key terms, and mnemonics for Computer Networks.


This is a quick revision doc covering all 42 topics in computer-networks. Open the linked notes if you want depth.

Networking Fundamentals

OSI Model (7 Layers)

What it is. A 7-layer conceptual model that describes how two computers talk on a network. Teaching tool, not a real implementation.

Why it matters. Lets us reason about each layer in isolation — “is this a Layer 2 (switch) or Layer 7 (API) issue?”

Key terms.

Remember. Bottom-up: Please Do Not Throw Sausage Pizza Away (Physical, Data Link, Network, Transport, Session, Presentation, Application). Top-down: All People Seem To Need Data Processing. Pair each layer with a protocol and a device example (router=L3, switch=L2). TLS sits at L6 conceptually but bridges L5/L6/L7.

7. Application — HTTP, DNS, SSH
6. Presentation — TLS, encoding
5. Session — sockets, RPC
4. Transport — TCP, UDP, ports
3. Network — IP, ICMP, routers
2. Data Link — Ethernet, MAC, switches
1. Physical — cables, voltages

TCP/IP Model

What it is. The 4-layer model that the real internet runs on. OSI is the textbook, TCP/IP is reality.

Key terms.

Remember. TCP/IP folded session + presentation into application. TLS doesn’t fit cleanly anywhere — that’s a known weakness. If asked “which model does the internet use?” answer TCP/IP.

How Data Travels (Encapsulation & Frames)

What it is. Each layer wraps data in its own header going down, unwraps coming up. The Russian doll model.

Key terms.

Remember. PDU mnemonic top-down: Data → Segments → Packets → Frames → Bits. Each header answers a different question: Ethernet=which device on this LAN, IP=which machine on the internet, TCP/UDP=which app on that machine, HTTP=what does the app want. TCP segmentation is normal; IP fragmentation is generally avoided.

IP Addressing (IPv4 & IPv6)

What it is. Unique identifier for a device on a network. IPv4 = 32 bits (~4.3 billion), IPv6 = 128 bits (~340 undecillion).

Key terms.

Remember. IPv4 exhaustion is why IPv6 exists. The three private ranges + 127.0.0.1 = localhost = ::1 are common interview answers.

Subnetting & CIDR

What it is. Splitting an IP block into smaller networks. CIDR notation = “how many bits are network.”

Key terms.

Remember. /24 = 254 hosts, /30 = 2 hosts (point-to-point). Reflex: /24 → 255.255.255.0. /31 is special (RFC 3021) — 2 usable hosts on point-to-point.

MAC Addresses & ARP

What it is. MAC = 48-bit hardware address baked into a NIC. ARP maps IP → MAC on the local LAN.

Key terms.

Remember. IP stays the same end-to-end; MAC changes every hop. Talking to a host on a different subnet? Destination MAC = the gateway’s MAC, not the final host’s. ARP has no auth → ARP spoofing is the classic LAN MITM.

Ports & Sockets

What it is. Port = 16-bit (0–65535) number identifying a process. Socket = IP + port.

Key terms.

Remember. Common ports: 22 SSH, 25 SMTP, 53 DNS, 80 HTTP, 443 HTTPS, 587/465 SMTPS, 993 IMAPS, 3306 MySQL, 5432 Postgres, 6379 Redis, 27017 Mongo. The 5-tuple is how a server handles thousands of clients on the same port — each connection has a unique combo.

Transport Layer

TCP vs UDP

What it is. Two transport protocols. TCP = reliable phone call. UDP = postcard.

Key terms.

Remember. TCP for HTTP/SSH/email/DBs (every byte matters). UDP for DNS/VoIP/games/streaming (speed > completeness). “Real-time” or “low latency” → UDP. “File”, “in order” → TCP. Modern HTTPS often runs on UDP via QUIC.

TCP 3-Way Handshake

What it is. Three-message setup before data flows: SYN, SYN-ACK, ACK.

Key terms.

Remember. Three messages because both sides need to confirm they can hear each other. Costs 1 RTT before any data flows — that’s why TLS 1.3 0-RTT and QUIC matter. The handshake itself doesn’t carry app data.

TCP Connection Termination (4-Way)

What it is. Closing takes four messages because TCP is full-duplex — each direction closed independently.

Key terms.

Remember. Open = 3 messages, close = 4 messages. TIME_WAIT exists for two reasons: (1) handle a lost final ACK, (2) prevent old packets from showing up in a new connection with the same 5-tuple. Busy proxies tune tcp_tw_reuse=1 to recycle.

Reliable Delivery & Sequence Numbers

What it is. TCP’s reliability comes from sequence numbers + ACKs + retransmits.

Key terms.

Remember. Every reliability feature is built on numbered bytes + cumulative ACKs + retransmits. App never sees out-of-order data — TCP buffers and reorders. Head-of-line blocking is why real-time apps avoid TCP.

Flow Control & Sliding Window

What it is. Receiver tells sender how much it can buffer. Sender never exceeds that window.

Key terms.

Remember. Flow control = protect the receiver. Congestion control = protect the network. Sender uses min(rwnd, cwnd). A 0-window stall looks like a dead connection but the socket is still ESTABLISHED.

Congestion Control (Slow Start, AIMD)

What it is. TCP probes how fast the network can go and backs off on loss.

Key terms.

Remember. The four phases: Slow Start, Congestion Avoidance, Fast Retransmit, Fast Recovery. AIMD = Additive Increase, Multiplicative Decrease. Sketch the sawtooth: ramp up exponentially, then linear-up + halve-on-loss forever. TCP can crawl on lossy links because every loss halves cwnd.

Network Layer & Routing

IP Routing & Routers

What it is. Routers forward IP packets between networks using a routing table.

Key terms.

Remember. Longest prefix match + default gateway are the two phrases interviewers love. IP src/dst stay constant end-to-end, MAC changes every hop. “I can ping local but not internet” = gateway misconfigured.

What it is. Routers learn paths from each other. Two main families plus BGP.

Key terms.

Remember. RIP = distance vector = Bellman-Ford = small networks. OSPF = link state = Dijkstra = enterprise IGP. BGP = path vector = the internet’s glue. BGP misconfigs cause famous outages (Facebook 2021, Pakistan/YouTube 2008).

NAT (Network Address Translation)

What it is. Many private IPs share one public IP by rewriting source IP+port.

Key terms.

Remember. NAT exists for IPv4 exhaustion. Side effect: breaks end-to-end connectivity, hard for P2P apps (need STUN/TURN). NAT is not a firewall even though it acts firewall-ish.

ICMP, ping & traceroute

What it is. ICMP is the network’s signalling protocol. ping uses Echo Request/Reply; traceroute abuses TTL.

Key terms.

Remember. ping = ICMP echo round-trip. traceroute = clever TTL abuse — send TTL=1, 2, 3… and read the Time Exceeded replies. * * * hops usually mean ICMP is silently rate-limited, not that the path is broken.

VPN Basics

What it is. Encrypted tunnel between two points. Wraps inner packet inside outer encrypted packet.

Key terms.

Remember. Three sentences: tunneling + encryption + routing. Modern default = WireGuard. VPN doesn’t make you anonymous — it shifts trust from ISP to provider.

Application Layer Protocols

HTTP Basics (Methods, Status Codes, Headers)

What it is. The language browsers and servers speak. Client requests, server responds.

Key terms.

Remember. Status code mnemonic: 1 = hold on, 2 = here you go, 3 = look elsewhere, 4 = your fault, 5 = my fault. Memorize categories + famous codes (200, 301, 304, 400, 401, 403, 404, 429, 500, 502, 503, 504). Idempotency = the interview hook for safe retries.

Cheatsheet — HTTP Status Codes

RangeMeaningExamples
1xxInformational100 Continue, 101 Switching Protocols
2xxSuccess200 OK, 201 Created, 204 No Content
3xxRedirection301 Moved, 302 Found, 304 Not Modified
4xxClient error400 Bad Request, 401, 403, 404, 429 Too Many
5xxServer error500, 502 Bad Gateway, 503, 504 Gateway Timeout

HTTP/1.0 vs 1.1 vs 2 vs 3 (QUIC)

What it is. HTTP evolved to fix bottlenecks at each level.

Key terms.

Remember. Head-of-line blocking moved up the stack and finally got solved. 1.1 → request-level. 2 → TCP-level. 3 → QUIC fixes it.

DNS Deep Dive (Recursive vs Iterative, Records)

What it is. Phonebook of the internet. Names → IPs.

Key terms.

Remember. Browser → resolver hop is recursive. Resolver → root → TLD → authoritative is iterative. DNS change “propagation delay” = old caches still alive.

DHCP

What it is. Auto-assigns IP + gateway + DNS to devices joining a network.

Key terms.

Remember. Just DORA + ports 67/68. Broadcast because client has no IP yet. DHCP also hands out subnet mask, default gateway, DNS servers, NTP.

SMTP, IMAP & POP3

What it is. Three email protocols. SMTP sends, IMAP/POP3 receive.

Key terms.

Remember. SMTP = send, IMAP = sync, POP3 = download+delete. Use IMAP if multi-device. Memorize secure ports: 587, 993, 995.

FTP & SFTP

What it is. File transfer. FTP plaintext, SFTP runs over SSH.

Key terms.

Remember. Plain FTP is plaintext — never use it. Pick SFTP — single connection, encrypted, no active/passive mess.

SSH

What it is. Encrypted remote shell + tunneling Swiss army knife. Port 22.

Key terms.

ssh-keygen -t ed25519 -C "manish@laptop"
ssh-copy-id manish@server.example.com
ssh -L 5432:localhost:5432 manish@server   # tunnel DB

Remember. Three security layers: transport (DH key exchange), authentication (host key + user key), channels (multiplexed sessions). Port forwarding is SSH’s superpower.

Web & Real-Time Communication

REST API Networking

What it is. REST = stateless HTTP-style API. Idempotency and caching are the network angle.

Key terms.

Remember. Retry only idempotent methods automatically. Make POST idempotent at the app layer with an idempotency key.

WebSockets

What it is. Full-duplex persistent channel over a single TCP connection.

Key terms.

Remember. “HTTP is a letter, WebSocket is a phone line.” Mention 101 Switching Protocols for credit. Scale needs sticky connections + pub/sub (Redis/NATS).

Server-Sent Events (SSE)

What it is. One-way server → client streaming over plain HTTP.

Key terms.

Remember. SSE is “a long-lived HTTP response with text/event-stream.” Use SSE when only the server pushes; WebSockets when both directions talk. Disable proxy buffering (X-Accel-Buffering: no).

Long Polling vs Short Polling

What it is. HTTP-only ways to fake real-time.

Key terms.

Remember. Short = simple but wasteful. Long = near-real-time but needs an async server. Always use a cursor + backoff on errors.

gRPC & HTTP/2 Streams

What it is. Protobuf RPC over HTTP/2 streams.

Key terms.

Remember. gRPC for backend-to-backend (schema, perf, streaming). REST/GraphQL for client-to-backend (browser-friendly, cacheable). Protobuf field numbers are forever — never renumber.

CORS Deep Dive

What it is. Browser mechanism that controls cross-origin reads from JavaScript.

Key terms.

Remember. CORS protects users, not servers. Server processed the request normally — browser blocked the response. Authorization triggers preflight. * + credentials = forbidden.

Network Security

SSL/TLS Handshake

What it is. How client and server agree on a shared key before encrypted data flows.

Key terms.

Remember. Asymmetric crypto (slow) only to agree on the symmetric key. After that, all data uses symmetric (fast). TLS 1.3 cut it from 2-RTT to 1-RTT (or 0-RTT for repeat visits).

Symmetric vs Asymmetric Encryption

What it is. Two crypto flavors. TLS uses both — hybrid.

Key terms.

Remember. Symmetric is ~1000x faster. Asymmetric solves the key-distribution problem. TLS = use asymmetric to safely deliver a symmetric key, then symmetric for the rest.

Certificates & PKI

What it is. A cert proves “this public key belongs to bank.com.” PKI is the trust system.

Key terms.

Remember. Always use SANs, never just CN. Auto-renew or you’ll outage. ACME + certbot + cert-manager are the modern toolchain.

Common Attacks (DDoS, MITM, Spoofing, Replay)

What it is. Classic network attacks every backend dev should know.

Key terms.

Remember. For each attack: what it does, what layer it hits, one defense. “Use HTTPS” is not the answer to everything.

Firewalls (Stateful vs Stateless)

What it is. Decides which packets pass. Three flavors.

Key terms.

Remember. Real prod stack uses all three layers. SYN floods exhaust the conntrack table — fix with SYN cookies, not by going stateless.

HTTP Security Headers (HSTS, CSP, etc.)

What it is. Response headers that harden a web app.

Key terms.

Remember. HSTS → SSL stripping. CSP → XSS. X-Frame-Options → clickjacking. Roll out CSP in report-only mode first. Use always in nginx so headers stick on errors too.

Performance, Scaling & Debugging

Latency vs Bandwidth vs Throughput

What it is. Three terms that get mixed up.

Key terms.

Remember. Highway analogy: bandwidth = lanes, latency = drive time, throughput = cars/min that arrive. For most user-facing workloads, lower latency wins. Bandwidth helps bulk transfers. Long fat pipe problem: 1 Gbps + 200 ms RTT + 64 KB window → ~2.5 Mbps actual.

CDN & Edge Networks

What it is. Globally distributed reverse proxies that cache content near users.

Key terms.

Remember. Anycast is the magic. Cache hit ratio target: 95%+ for static. Use hashed filenames (app.a8f3.js) over purge APIs.

Load Balancing (L4 vs L7)

What it is. Spreads traffic across servers. Two types based on layer.

Key terms.

Remember. L4 fast but blind. L7 smart but slower. AWS: ALB = L7, NLB = L4. Real stacks layer them: NLB → ALB → backends.

Forward vs Reverse Proxy

What it is. Both proxy traffic. Different sides hide.

Key terms.

Remember. “Proxy to access blocked sites” = forward. “Nginx in front of my app” = reverse. Forward serves the client; reverse serves the server.

Network Debugging Toolkit

What it is. CLI tools for “why can’t I reach this server?” investigations.

Key terms.

Remember. Debug top-down: DevTools/curl → DNS (dig) → ping/mtr → ss/lsof on the server → tcpdump if needed. curl -w timing tells you whether DNS, TCP, TLS, or the server is slow.