00-master-cn-index.md

🌐 Computer Networks — Master Interview & Revision Guide

Targeted for: Juspay Elimination Round, Hackathon Part B System Discussion & Backend Engineering Interviews.
Core Focus: High-scale payment systems, network security, protocol internals, handshake mechanisms, idempotency, and client identification.


šŸ“‘ Complete CN Module Index

#DocumentCore Topics CoveredJuspay High-Yield Relevance
0101-dns-deep-dive.mdRecursive vs Iterative resolution, Root/TLD/Authoritative hierarchy, Record types (A, AAAA, CNAME, MX, NS, TXT, SOA, PTR), Caching & TTL, DNSSEC⭐⭐⭐ Asked directly in Part B final phase
0202-tcp-vs-udp-transport-layer.md3-Way Handshake, 4-Way Termination, TIME_WAIT vs CLOSE_WAIT leaks, Sliding Window (Flow Control), Congestion Control (Slow Start, AIMD, Fast Retransmit), UDP vs QUIC⭐⭐⭐ Critical for transport reliability & low-latency payments
0303-http-https-evolution.mdMethods (GET, POST, PUT, PATCH, DELETE, OPTIONS), Status codes (200, 201, 301, 400, 401, 403, 404, 409, 429, 500, 502, 503, 504), HTTP/1.1 vs HTTP/2 vs HTTP/3 (QUIC)⭐⭐⭐ REST API semantics & microservice communication
0404-ssl-tls-and-certificates.mdTLS 1.2 vs 1.3 Handshake, Symmetric vs Asymmetric crypto, Certificate Authorities (CA), Local OS Trust Store validation, Digital Signatures, mTLS in Banking⭐⭐⭐⭐ Direct Juspay Part B interview question
0505-ip-addressing-and-routing.mdIPv4 Classes, Subnetting & CIDR calculations, IPv6, NAT / NAPT (PAT) translation tables, Public vs Private IP ranges (RFC 1918)⭐⭐⭐ Essential for networking & infrastructure routing
0606-idempotency-in-payments.mdWhy payments demand idempotency, Double-debit prevention, Idempotency Keys (UUIDv4), Redis + DB locking state machines, In-flight concurrency & 409/429 handling⭐⭐⭐⭐⭐ CORE JUSPAY QUESTION (Payment Gateway LLD)
0707-session-management-and-identification.mdClient differentiation: 2 tabs on 1 laptop vs 2 laptops on 1 WiFi (NAT) vs 2 laptops on different networks; Cookies, JWT, SessionStorage, Security (CSRF, XSS, SameSite)⭐⭐⭐⭐ Direct Juspay Part B interview question
0808-osi-and-tcp-ip-models.mdAll 7 OSI Layers, PDUs, Encapsulation/Decapsulation, OSI vs TCP/IP mapping, Hub vs Switch vs Router, L4 vs L7 Load Balancers, MAC vs IP⭐⭐⭐⭐ Foundational Networking & Systems Architecture
0909-vpn-tunneling-cryptography-and-encoding.mdVPN Internals (TUN/TAP, Encapsulation, WireGuard/IPsec), Symmetric vs Asymmetric Crypto, Encoding vs Encryption vs Hashing vs Tokenization, RBI Payment Card Tokenization, JWT Deep Dive, npm for frontend⭐⭐⭐⭐⭐ Direct Juspay Systems & Security Interview questions
1010-web-security-attacks-and-defenses.mdSOP & CORS Deep Dive (Preflight OPTIONS, Headers), XSS (Stored, Reflected, DOM), CSRF (Synchronizer tokens, SameSite), SSRF (AWS IMDS exploit), Clickjacking, Payment Replay attacks⭐⭐⭐⭐⭐ Critical Web & Payment Gateway Security Gauntlet
1111-rest-api-architecture-and-design.mdRoy Fielding's 6 Constraints, Richardson Maturity Model (L0-L3), HTTP Semantics (RFC 9110), Idempotency Filters & Lock, OCC (ETags), Keyset Pagination, Distributed Rate Limiting, Versioning & Webhooks⭐⭐⭐⭐⭐ CORE JUSPAY QUESTION (REST API Architecture & Design)

⚔ 10-Minute Rapid Pre-Interview Cheat Sheet

1. DNS Record Quick Matrix

  • A: Maps hostname $\rightarrow$ IPv4 address (api.juspay.in $\rightarrow$ 13.235.12.45).
  • AAAA: Maps hostname $\rightarrow$ IPv6 address (api.juspay.in $\rightarrow$ 2404:6800:...).
  • CNAME: Alias mapping canonical name to canonical name (pay.merchant.com $\rightarrow$ secure.juspay.in). Cannot be on root zone (@).
  • MX: Mail exchange server with priority weighting (10 mail.juspay.in).
  • NS: Nameserver authority delegating DNS zone (ns1.awsdns.com).
  • TXT: Arbitrary text — domain verification, SPF (anti-spam), DKIM, SSL domain validation.

2. TCP Handshake & State Essentials

HANDSHAKE: [Client] --- SYN (seq=x) ---> [Server] [Client] <-- SYN-ACK (seq=y, ack=x+1) -- [Server] [Client] --- ACK (ack=y+1) ---> [Server] (Can send data!) TERMINATION: [Client] --- FIN ---> [Server] [Client] <-- ACK --- [Server] (Server enters CLOSE_WAIT) [Client] <-- FIN --- [Server] [Client] --- ACK ---> [Server] (Client enters TIME_WAIT: 2 * MSL)
  • Why TIME_WAIT (2MSL = ~60-120s)?
    1. Ensure final ACK reaches server (if lost, server retransmits FIN).
    2. Prevent old delayed duplicate packets from colliding with a new incarnation of the same socket (IP:Port).

3. How Computer Validates an SSL/TLS Certificate Locally

1. Server sends Leaf Certificate Chain (Leaf -> Intermediate -> Root CA). 2. Client inspects OS / Browser Root Trust Store to locate the Root CA Public Key. 3. Client verifies Digital Signature: - Decrypts issuer's signature using issuer's Public Key -> gets Hash(Cert). - Computes SHA-256 Hash of received certificate body independently. - If computed_hash == decrypted_hash -> Certificate is authentic and untampered! 4. Checks: Expiration dates (NotBefore / NotAfter), Domain Name match (SAN/CN), Revocation status (OCSP / CRL).

4. Idempotency in Payment Gateways

  • Definition: $f(f(x)) = f(x)$. Executing the same operation multiple times produces the exact same side-effect as executing it once.
  • Why Vital: Prevent double charging a customer when a bank timeout or mobile network retry occurs.
  • Implementation:
    1. Client sends header Idempotency-Key: <unique-uuid>.
    2. Backend acquires a distributed lock (Redis) or uses DB unique constraint UNIQUE(idempotency_key).
    3. If key exists:
      • If state == COMPLETED: Return cached response immediately.
      • If state == PROCESSING: Return 409 Conflict or poll/wait.
    4. If new: Create record in state PENDING $\rightarrow$ Execute payment with Bank/UPI $\rightarrow$ Update to SUCCESS $\rightarrow$ Cache response $\rightarrow$ Release lock.

5. Client Differentiation Scenarios

ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¬ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā” │ Scenario │ How the Server Differentiates │ ā”œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¼ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¤ │ Two Tabs on Same Laptop │ Same Public IP, Same Client Port (if sharing HTTP/2 conn), Same Cookie │ │ │ -> Differentiated by: Unique Tab ID, sessionStorage, or custom header. │ ā”œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¼ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¤ │ Two Laptops on Same WiFi (NAT) │ Same Public IP (seen by server). Differentiated by: Unique NAT Source │ │ │ Ports (Transport Layer) and Distinct Session Cookies / JWTs (App Layer).│ ā”œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¼ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¤ │ Two Laptops on Different Networks │ Differentiated at Layer 3: Distinct Public IP Addresses + Unique Auth. │ ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”“ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜

šŸŽÆ How to Use These Notes

  • Read each markdown file sequentially for conceptual mastery.
  • Study the "Verbatim Interview Scripts" to learn how to structure your spoken answers under pressure.
  • Review the "Juspay & Real-World Payment Context" callouts to stand out with production-grade architectural awareness.