Google Systems Development Engineer — Networking Interview Preparation

Interview Focus Areas:

  • Network Hardware: components, functions, how they interact

  • Protocols: TCP/IP, HTTP, DNS, routing protocols

  • Network Troubleshooting: packet loss, latency, connectivity problems

  • Packet Analysis: Wireshark/tcpdump to identify packet loss and detect proxies (including transparent proxies)

  • Proxy Usage: caching, filtering, security


Table of Contents

  1. OSI Model & Fundamentals

  2. TCP/IP Deep Dive

  3. DNS

  4. HTTP / HTTPS / TLS

  5. Routing & Switching

  6. Network Hardware

  7. Subnetting & IP Addressing

  8. Network Troubleshooting Methodology

  9. Packet Analysis (tcpdump & Wireshark)

  10. Proxies & Load Balancers

  11. Firewalls & iptables

  12. Security & Encryption

  13. Cloud Networking & CDN

  14. BGP & OSPF

  15. VLANs & Spanning Tree


1. OSI Model & Fundamentals

Q1: Walk me through all seven layers of the OSI model and give a concrete example of a protocol or device at each layer.

Answer: The OSI (Open Systems Interconnection) model is a conceptual framework that standardizes network communication into seven distinct layers, each with a well-defined responsibility.

Why interviewers care: The OSI model is the common language for debugging. When you say "Layer 3 issue," everyone knows you mean IP routing. When you say "Layer 4," they know TCP/UDP ports. Understanding which layer a failure is at dramatically narrows troubleshooting scope.


Q2: What is the difference between the OSI model and the TCP/IP model?

Answer: The TCP/IP model (also called the Internet model or DoD model) is the practical framework that actually governs the modern Internet, while OSI is a theoretical reference model.

TCP/IP has 4 layers:

  1. Network Access / Link Layer — Combines OSI Layers 1 and 2 (Physical + Data Link). Handles hardware addressing and physical transmission.

  2. Internet Layer — Corresponds to OSI Layer 3. IP, ICMP, ARP.

  3. Transport Layer — Corresponds to OSI Layer 4. TCP and UDP.

  4. Application Layer — Combines OSI Layers 5, 6, and 7. HTTP, DNS, SSH, SMTP, etc.

Key differences:

Interview tip: Google engineers will reference OSI layer numbers constantly in design discussions ("this is a Layer 4 load balancer vs Layer 7"), so know both models cold.


Q3: What is encapsulation and de-encapsulation in networking?

Answer: Encapsulation is the process by which each layer of the network stack adds its own header (and sometimes trailer) to the data passed down from the layer above, wrapping it before transmission. De-encapsulation is the reverse process on the receiving end.

Encapsulation flow (sender):

  1. Application data (e.g., HTTP request body) → Application Layer

  2. Transport layer adds TCP/UDP header (source/dest port, sequence number) → creates a Segment

  3. Network layer adds IP header (source/dest IP, TTL, protocol) → creates a Packet

  4. Data Link layer adds Ethernet header (src/dst MAC) + Ethernet trailer (FCS/CRC) → creates a Frame

  5. Physical layer converts to bits and transmits on the wire

De-encapsulation flow (receiver): Each layer strips its corresponding header, processes it, and passes the payload up to the next layer.

PDU names by layer:

Why it matters for troubleshooting: When you capture packets with tcpdump, you see all these layers stacked. Understanding encapsulation tells you exactly what headers to look at when diagnosing problems at specific layers.


Q4: What is the difference between a hub, a switch, and a router?

Answer: These three devices operate at different OSI layers and serve fundamentally different purposes.

Hub (Layer 1 — Physical):

Switch (Layer 2 — Data Link):

Router (Layer 3 — Network):

Summary table:

FeatureHubSwitchRouter
OSI Layer123
AddressingNoneMACIP
Collision Domains1Per portPer interface
Broadcast Domains11 (default)Per interface
Intelligent forwardingNoYesYes

Q5: What is a broadcast domain vs. a collision domain?

Answer: Collision domain: A network segment where two devices can simultaneously transmit and cause a collision. In half-duplex Ethernet, all devices on a shared medium (hub) are in the same collision domain. Each switch port is its own collision domain. With full-duplex, collisions are theoretically eliminated.

Broadcast domain: The set of all devices that receive a Layer 2 broadcast (destination MAC = FF:FF:FF:FF:FF:FF) sent by any single device. Switches forward broadcasts to all ports in the same VLAN, so by default an entire switch is one broadcast domain. Routers do NOT forward broadcasts — they terminate them. Each router interface (or VLAN with inter-VLAN routing) is a separate broadcast domain.

Example: A company with 200 workstations on a single flat switch has one broadcast domain. Every ARP request, DHCP discover, and NetBIOS name announcement hits all 200 machines. Segmenting with VLANs or routers reduces broadcast noise and improves performance.

Why Google cares: At scale, broadcast domain size directly affects network performance. Large broadcast domains create excessive ARP traffic, STP complexity, and security exposure.


Q6: What is ARP and how does it work? What are ARP cache poisoning attacks?

Answer: ARP (Address Resolution Protocol) maps a known IP address to an unknown MAC address within a local network segment. It operates at the boundary of Layer 2 and Layer 3.

ARP workflow:

  1. Host A wants to send a packet to 192.168.1.5 but only knows the IP.

  2. Host A checks its ARP cache (arp -n or ip neigh show) for a cached mapping.

  3. If not found, Host A broadcasts an ARP Request: "Who has 192.168.1.5? Tell 192.168.1.1."

  4. The device with that IP (Host B) responds with a unicast ARP Reply: "192.168.1.5 is at AA:BB:CC:DD:EE:FF."

  5. Host A caches this mapping and sends its frame to that MAC.

ARP cache inspection:

ARP Poisoning (ARP Spoofing): An attacker sends gratuitous ARP replies claiming that their MAC address corresponds to the IP of a legitimate host (e.g., the default gateway). Victims update their ARP cache with the attacker's MAC, directing all traffic through the attacker's machine — a classic Man-in-the-Middle (MITM) attack.

Defenses:


Q7: Explain the difference between half-duplex and full-duplex Ethernet. When would you encounter each?

Answer: Half-duplex: A device can either transmit OR receive at any given moment, but not both simultaneously. Uses CSMA/CD (Carrier Sense Multiple Access with Collision Detection) to manage access to the shared medium. When two devices transmit simultaneously, a collision occurs; both back off for a random period (exponential backoff) and retry. Hubs force half-duplex. Maximum theoretical efficiency is about 50-60% of link capacity.

Full-duplex: A device can transmit and receive simultaneously using separate wire pairs (or different frequencies). No collisions are possible by design. Requires a point-to-point link (switch port to NIC). Modern switched Ethernet (100Mbps and above) negotiates full-duplex by default. Doubles theoretical throughput compared to half-duplex.

When you see half-duplex today:

Detection commands:


2. TCP/IP Deep Dive

Q8: Describe the TCP three-way handshake in detail. What do SYN, SYN-ACK, and ACK packets contain?

Answer: TCP is a connection-oriented protocol. Before any data is exchanged, both endpoints must synchronize their Initial Sequence Numbers (ISNs) through a three-way handshake.

Step 1 — SYN (Client → Server):

Step 2 — SYN-ACK (Server → Client):

Step 3 — ACK (Client → Server):

Why the three-way? Two-way would only synchronize one direction. Three-way ensures both sides have confirmed that both directions of communication work and that both ISNs are acknowledged.

SYN flood attack: Attackers send floods of SYN packets without completing the handshake, exhausting the server's half-open connection table (SYN backlog). Mitigated by SYN cookies, which allow the server to encode connection state in the ISN rather than storing it.

tcpdump to see handshake:


Q9: Explain TCP's four-way connection teardown. What is TIME_WAIT and why does it exist?

Answer: TCP teardown is asymmetric — each side closes independently, which is why it requires four steps (two FINs and two ACKs) rather than the three of the handshake.

Four-way teardown:

  1. FIN (Active closer → Passive): Active side finishes sending, sends FIN. Moves to FIN_WAIT_1.

  2. ACK (Passive → Active closer): Passive side ACKs the FIN, moves to CLOSE_WAIT. Active moves to FIN_WAIT_2. The passive side may continue sending data at this point (half-close).

  3. FIN (Passive → Active closer): Passive side finishes sending, sends its own FIN. Moves to LAST_ACK.

  4. ACK (Active closer → Passive): Active closer ACKs the final FIN. Moves to TIME_WAIT for 2×MSL (Maximum Segment Lifetime). Passive side receives ACK and moves to CLOSED.

TIME_WAIT (2×MSL, typically 60–120 seconds):

TIME_WAIT exhaustion: High-traffic servers (especially those initiating many short connections) can exhaust ephemeral ports because too many sockets are in TIME_WAIT. Solutions:

Check TIME_WAIT count:


Q10: What is TCP's sliding window mechanism? How does flow control differ from congestion control?

Answer: Sliding Window (Flow Control): TCP uses a sliding window to control how much data the sender can have "in flight" (sent but not yet acknowledged) at any time. The receiver advertises its receive window size (rwnd) in every ACK — the amount of buffer space it currently has available. The sender must not have more unacknowledged bytes in flight than the receiver's advertised window. As the receiver processes data and frees buffer space, it advertises a larger window, allowing the sender to transmit more.

The window "slides" forward as data is acknowledged. The sender maintains:

Flow Control (receiver-driven): Prevents the sender from overwhelming the receiver's buffer. Controlled by the receiver's rwnd advertisement.

Congestion Control (network-driven): Prevents the sender from overwhelming intermediate network links and routers. TCP infers network congestion from:

TCP congestion control phases:

  1. Slow Start: cwnd (congestion window) starts at ~1-10 MSS, doubles every RTT until it reaches ssthresh or detects congestion.

  2. Congestion Avoidance: After reaching ssthresh, increase cwnd by 1 MSS per RTT (additive increase).

  3. Fast Retransmit: On 3 duplicate ACKs (indicating a lost segment), retransmit without waiting for timeout. Set ssthresh = cwnd/2, cwnd = ssthresh (TCP Reno) or cwnd = ssthresh + 3 (cubic variant).

  4. Fast Recovery: After fast retransmit, continue sending new segments using duplicate ACKs as a clock.

Effective send rate: min(cwnd, rwnd) — the smaller of what the network can handle and what the receiver can absorb.

Relevant tunables:


Q11: What is TCP SACK (Selective Acknowledgment)? Why is it important?

Answer: Without SACK, TCP uses cumulative acknowledgments. If segment 5 in a sequence of 10 is lost, the receiver can only acknowledge up to segment 4. Even if segments 6–10 arrived fine, the sender must retransmit segment 5 and potentially all subsequent segments (Go-Back-N behavior in naive implementations). This wastes bandwidth.

SACK (RFC 2018): The receiver includes SACK blocks in ACK packets, explicitly telling the sender which non-contiguous ranges of data have been received. The sender can then retransmit only the missing segments (selective retransmit).

Example: Segments 1–4, 6–10 received; 5 is missing. Without SACK: sender retransmits from 5 onward. With SACK: receiver sends ACK=5 with SACK block {6–10}. Sender retransmits only segment 5.

Benefits:

Negotiation: Both sides must advertise SACK support in their SYN/SYN-ACK options (SACK permitted option). Check with:


Q12: What is Nagle's algorithm? When would you disable it and why?

Answer: Nagle's algorithm (RFC 896) addresses the "small packet problem" — without it, an application writing one byte at a time would generate one tiny TCP segment per byte, each carrying 40+ bytes of TCP/IP header overhead (extremely inefficient).

Nagle's rule: A TCP sender can have at most one outstanding unacknowledged small segment. New small data can only be sent if:

This coalesces small writes into fewer, larger segments, dramatically reducing the number of packets on the wire.

When to disable Nagle (TCP_NODELAY):

Code example:

Related: TCP_CORK (Linux) — opposite of TCP_NODELAY. Holds back data even more aggressively, waiting to fill a full MSS. Useful for bulk data transfer scenarios where you want to batch writes.


Q13: Explain TCP keepalives. How are they different from application-level heartbeats?

Answer: TCP Keepalives: TCP has an optional keepalive mechanism (SO_KEEPALIVE socket option). After a connection has been idle for tcp_keepalive_time (default: 7200 seconds = 2 hours on Linux), the kernel sends a keepalive probe — a TCP segment with no data and ACK set, with seq number one less than the next expected byte. If the peer acknowledges it, the idle timer resets. If no response after tcp_keepalive_probes retries spaced tcp_keepalive_intvl apart, the connection is declared dead and an error is returned to the application.

Linux defaults:

Problems with TCP keepalives:

Application-level heartbeats:

Best practice: Use both — TCP keepalives to clean up OS-level dead connections, application heartbeats for health monitoring.


Q14: What is the difference between TCP and UDP? Give scenarios where you'd choose each.

Answer: TCP (Transmission Control Protocol):

UDP (User Datagram Protocol):

Choose TCP when:

Choose UDP when:

Interesting cases:


Q15: What is MTU? What happens when a packet exceeds the path MTU? Explain PMTUD.

Answer: MTU (Maximum Transmission Unit): The largest IP packet that can be sent without fragmentation over a given link. Standard Ethernet MTU is 1500 bytes. This includes the IP header (20 bytes minimum) and TCP header (20 bytes minimum), leaving 1460 bytes for TCP payload (MSS = MTU - IP header - TCP header).

When a packet exceeds MTU: If an IP packet is larger than the MTU of an outgoing link:

Problems with fragmentation:

Path MTU Discovery (PMTUD): The mechanism for discovering the minimum MTU along an entire path from source to destination.

  1. Source sends packets with DF=1 set at the MTU of its local interface (1500).

  2. If a router along the path has a smaller MTU link, it drops the packet and sends ICMP "Fragmentation Needed" with the smaller MTU.

  3. Source reduces its packet size and retries.

  4. Process repeats until packets reach destination without ICMP errors.

PMTUD Black Holes: If ICMP is blocked by firewalls between source and destination, PMTUD breaks. The source keeps sending large packets that silently get dropped. Symptom: connection establishes fine (small SYN packets) but hangs when sending bulk data.

Diagnosis and fix:


Q16: What are TCP sequence numbers used for? How are they initialized and how do they wrap around?

Answer: Purpose of sequence numbers:

  1. Ordered delivery: Allow the receiver to reorder out-of-order segments

  2. Duplicate detection: Identify and discard duplicate segments

  3. Reliable delivery: Track which data has been acknowledged

  4. Security: Prevent TCP injection attacks (an attacker would need to guess the ISN)

Structure: TCP uses a 32-bit sequence number, providing a range of 0 to 4,294,967,295 (4 billion). The sequence number refers to the byte offset of the first byte in the segment's data, not the segment number.

Initialization (ISN — Initial Sequence Number): ISNs should be random (RFC 6528) to prevent TCP injection attacks. Early implementations used a clock-based ISN that incremented by 128,000 every second and 64,000 for each new connection. Modern implementations use cryptographic randomness (ISN = MD5(srcIP, srcPort, dstIP, dstPort, secret) + timestamp).

Wrap-around: After reaching 2^32 - 1, the sequence number wraps back to 0. This is handled transparently by the TCP stack. At 1 Gbps, you would exhaust 32-bit sequence numbers in about 34 seconds. The PAWS (Protection Against Wrapped Segments) extension uses TCP timestamps to disambiguate segments with the same sequence number from different "generations" of the counter, critical for high-speed links.


3. DNS

Q17: Explain the full DNS resolution process for a domain name from scratch (no cache).

Answer: DNS (Domain Name System) is a hierarchical, distributed database that maps domain names to IP addresses. A full resolution involves multiple recursive queries.

Full resolution for www.example.com:

  1. Local cache check: The OS resolver checks its local DNS cache (populated from previous queries, TTL-honored). On Linux: /etc/hosts is checked first, then /etc/resolv.conf determines the recursive resolver to use.

  2. Stub resolver → Recursive resolver: The client's stub resolver (OS) sends a recursive query to the configured recursive resolver (e.g., 8.8.8.8 for Google DNS, or the corporate DNS server). The stub resolver asks: "Resolve www.example.com for me completely."

  3. Recursive resolver → Root nameservers: The recursive resolver checks its own cache. If no cache hit, it queries one of the 13 root nameserver clusters (A–M.root-servers.net). The query: "Who is authoritative for .com?" The root nameserver responds with the TLD nameservers for .com (e.g., a.gtld-servers.net).

  4. Recursive resolver → TLD nameservers: The resolver queries the .com TLD nameserver: "Who is authoritative for example.com?" The TLD nameserver responds with the authoritative nameservers for example.com (e.g., ns1.example.com, ns2.example.com).

  5. Recursive resolver → Authoritative nameserver: The resolver queries ns1.example.com: "What is the A record for www.example.com?" The authoritative server responds with the IP address and TTL.

  6. Response returned to client: The recursive resolver caches the result (respecting TTL) and returns the IP to the client stub resolver, which caches it and returns it to the application.

Record types returned:

Commands:


Q18: What is the difference between authoritative and recursive DNS servers?

Answer: Authoritative DNS server:

Recursive DNS resolver (recursive resolver / DNS recursor):

Forwarder: A DNS server that forwards all queries it can't answer from cache to another DNS server (usually the ISP's recursive resolver). Common in corporate environments where internal DNS servers forward external queries upstream.

Split-horizon DNS: A configuration where different answers are returned based on the query source. Internal clients receive internal IPs; external clients receive public IPs. Implemented using DNS views in BIND.


Q19: What are common DNS record types and when is each used?

Answer:

RecordPurposeExample
AMaps hostname to IPv4 addresswww.example.com. 300 IN A 93.184.216.34
AAAAMaps hostname to IPv6 addresswww.example.com. 300 IN AAAA 2606:2800:220:1:248:1893:25c8:1946
CNAMEAlias from one name to anotherblog.example.com. CNAME www.example.com.
MXMail exchanger for the domainexample.com. MX 10 mail.example.com.
NSAuthoritative nameserver for zoneexample.com. NS ns1.example.com.
SOAStart of Authority; zone metadataSerial, refresh, retry, expire, minimum TTL
PTRReverse DNS (IP → hostname)34.216.184.93.in-addr.arpa. PTR www.example.com.
TXTArbitrary text; used for SPF, DKIM, domain verificationexample.com. TXT "v=spf1 include:_spf.google.com ~all"
SRVService location (host + port)_http._tcp.example.com. SRV 10 5 80 www.example.com.
CAACertificate Authority Authorizationexample.com. CAA 0 issue "letsencrypt.org"
DNSKEYPublic key for DNSSECZone signing key
DSDelegation Signer for DNSSEC chain of trustHash of child zone's DNSKEY

CNAME restrictions: A CNAME cannot coexist with other record types for the same name. This is why you can't use a CNAME for a zone apex (root domain). CDNs work around this with ALIAS/ANAME records (proprietary record type that resolves at the DNS server itself).

MX priority: Lower number = higher priority. If primary MX (priority 10) is down, mail servers will try priority 20, etc.


Q20: What is DNS TTL and what are the trade-offs of high vs. low TTL values?

Answer: TTL (Time To Live) in DNS specifies (in seconds) how long a resolver or client may cache a DNS record before it must re-query the authoritative server.

High TTL (e.g., 86400 = 24 hours):

Low TTL (e.g., 60 seconds):

Best practice for planned changes (migrations, maintenance):

  1. Lower TTL to 60–300 seconds several days before the planned change (this must be done in advance so the low TTL itself propagates)

  2. Make the DNS change

  3. Wait one old-TTL duration to ensure all caches have expired

  4. After rollout is confirmed, restore TTL to normal (e.g., 3600 or 86400)

Checking TTL:

Negative TTL (NXDOMAIN caching): Controlled by the SOA record's minimum field. How long to cache "this domain does not exist" responses.


Q21: What is DNSSEC and why is it important?

Answer: DNSSEC (DNS Security Extensions) adds cryptographic signatures to DNS responses, allowing resolvers to verify that the DNS data they received is authentic and has not been tampered with. It defends against DNS cache poisoning (Kaminsky attack) and man-in-the-middle attacks.

How DNSSEC works:

  1. Zone administrators sign their zone records using a private key (Zone Signing Key, ZSK)

  2. The signed records are published as RRSIG records alongside each RR set

  3. The public key is published in a DNSKEY record in the zone

  4. A hash of the child zone's DNSKEY is published as a DS record in the parent zone

  5. This creates a chain of trust from the root zone (. trust anchor) down to individual zones

Chain of trust: root → TLD (e.g., .com) → SLD (e.g., example.com). Each level signs a DS record for the next level down.

What DNSSEC does NOT provide:

Modern alternatives for DNS privacy:

Check DNSSEC:


Q22: What is DNS-based load balancing? What are its limitations?

Answer: DNS-based load balancing distributes traffic by returning different IP addresses in response to DNS queries.

Mechanisms:

Limitations:

  1. TTL caching: Clients cache DNS responses. If a server fails, you can't instantly redirect all clients — cached records persist until TTL expires. With 5-minute TTL, 5 minutes of downtime possible.

  2. Client-side caching bypass: Some applications (especially Java) cache DNS results forever (ignoring TTL). Fix: set networkaddress.cache.ttl in JVM.

  3. Sticky sessions: DNS provides no session affinity. The same client may resolve to different IPs over time.

  4. No connection-level awareness: DNS doesn't know how many active connections each server has. Round-robin sends equal query volume, not equal traffic load.

  5. Client IP visibility: The resolver that queries for the client may not be near the client (recursive resolvers like 8.8.8.8 are globally distributed, so GeoDNS works), but accuracy depends on EDNS Client Subnet (ECS) extension.

  6. Not suitable for fine-grained traffic splitting: For A/B testing or canary deployments, DNS-based splitting is coarse (TTL granularity).


4. HTTP / HTTPS / TLS

Q23: What happens when you type https://www.google.com in a browser? (Full end-to-end explanation)

Answer: This is one of the most common interview questions. A complete answer covers every layer.

  1. URL parsing: Browser parses the URL: scheme=https, host=www.google.com, port=443 (default for HTTPS), path=/ .

  2. DNS resolution: Browser checks its DNS cache (short TTL in browsers, often 60 seconds). If no cache hit, queries the OS DNS resolver, which queries the recursive resolver. www.google.com resolves to one or more IP addresses (e.g., 142.250.x.x).

  3. TCP connection (Layer 4): Browser establishes a TCP connection to the resolved IP on port 443. Three-way handshake (SYN → SYN-ACK → ACK). Modern browsers use TCP Fast Open to save one RTT if the client and server previously communicated.

  4. TLS handshake (Layer 6/7):

    • ClientHello: Browser sends supported TLS versions, cipher suites, random value, SNI (Server Name Indication — the hostname, allows virtual hosting on HTTPS), supported extensions.

    • ServerHello: Server selects TLS version and cipher suite, sends server random value, session ID.

    • Server Certificate: Server sends its X.509 certificate chain.

    • Certificate validation: Browser verifies: certificate is signed by a trusted CA, not expired, hostname matches (CN or SAN), not revoked (OCSP/CRL check).

    • Key exchange: (Varies by TLS version)

      • TLS 1.2: Client generates pre-master secret, encrypts with server's public key (RSA) or uses ephemeral Diffie-Hellman. Session keys derived from pre-master secret + random values.

      • TLS 1.3: Ephemeral ECDHE only (perfect forward secrecy mandatory). Fewer round trips (1-RTT vs 2-RTT).

    • ChangeCipherSpec + Finished: Both sides send Finished messages to verify key derivation.

  5. HTTP/2 (or HTTP/3) negotiation: During TLS, ALPN (Application-Layer Protocol Negotiation) extension selects HTTP/2 or HTTP/3. Most modern connections to Google use HTTP/2 or HTTP/3.

  6. HTTP request: Browser sends an HTTP GET request: headers include Host, User-Agent, Accept, Accept-Encoding (gzip, br), Cookie, etc.

  7. Server processing: Google's load balancer receives the request, routes to a backend, backend generates a response.

  8. HTTP response: Server returns 200 OK with HTML content, compressed (gzip/brotli), possibly with HTTP/2 server push.

  9. Browser rendering: Browser parses HTML, discovers sub-resources (CSS, JS, images), makes additional DNS+TCP+TLS connections or reuses existing connections (HTTP/2 multiplexing allows multiple streams over one connection).

  10. Connection management: HTTP/1.1: Keep-Alive reuses TCP connection. HTTP/2: multiplexes many requests over one TCP connection. Connection eventually closes (timeout or FIN).


Q24: Explain the TLS handshake in detail for both TLS 1.2 and TLS 1.3. What improved in 1.3?

Answer: TLS 1.2 Handshake (2 RTTs for full handshake):

Round Trip 1:

Round Trip 2:

After round trip 2: Connection established. Session resumption (via session ID or session ticket) can reduce this to 1 RTT.

TLS 1.3 Handshake (1 RTT, 0-RTT possible for resumption):

Round Trip 1:

After Round Trip 1: Server can already send application data. Client sends {Finished} and then application data.

TLS 1.3 improvements over 1.2:

  1. 1-RTT vs 2-RTT: Faster connection establishment

  2. 0-RTT session resumption: Client can send application data in the first flight using a Pre-Shared Key from a previous session (with replay attack risks — must be idempotent requests)

  3. Mandatory perfect forward secrecy: Only ECDHE and DHE key exchanges allowed. RSA key exchange removed. Even if the server's private key is later compromised, past sessions can't be decrypted.

  4. Reduced cipher suites: Removed weak/broken algorithms (RC4, 3DES, MD5, SHA-1, export-grade ciphers, RSA without forward secrecy). Only 5 cipher suites: AES-128-GCM, AES-256-GCM, ChaCha20-Poly1305, AES-128-CCM, AES-128-CCM-8.

  5. Encrypted handshake: Certificate and most handshake messages are encrypted (server's cert is private from passive observers)

  6. Removed session renegotiation and compression (both were attack vectors)

Debug TLS:


Q25: What is SNI (Server Name Indication) and why is it needed?

Answer: SNI (Server Name Indication) is a TLS extension (RFC 6066) that allows a client to specify which hostname it is connecting to at the beginning of the TLS handshake, before any certificates are presented.

Problem it solves: A single server/load balancer may host many websites, each with its own TLS certificate (virtual hosting). Before SNI, the server had to pick which certificate to send without knowing which domain the client wanted, because the Host header (which identifies the virtual host in HTTP) is inside the encrypted connection — but the server needs to present the right certificate before encryption is established. Classic chicken-and-egg problem.

How it works: The client includes the target hostname in the server_name extension of the ClientHello message, which is sent before any encryption. The server reads this, selects the appropriate certificate, and proceeds with the TLS handshake.

Privacy implication: SNI is sent in cleartext in TLS 1.2 and 1.3. Anyone on the network path (ISPs, firewalls) can see which hostname you're connecting to even if the content is encrypted. This is used for:

ESNI / ECH (Encrypted Client Hello): A newer extension (RFC draft) that encrypts the SNI. The client fetches a public key from DNS (via HTTPS record type) and encrypts the ClientHello using it. Still being deployed.

Relevant for proxy detection: A transparent TLS-intercepting proxy will receive the SNI, terminate the TLS connection from the client, make its own TLS connection to the server, and re-encrypt traffic. The client will see a different certificate (usually from the proxy's CA) unless the proxy's CA is trusted by the client. This is the basis for corporate SSL inspection.


Q26: Describe HTTP/1.0 vs HTTP/1.1 vs HTTP/2 vs HTTP/3. What are the key improvements in each?

Answer: HTTP/1.0:

HTTP/1.1:

HTTP/2 (RFC 7540):

HTTP/3 (RFC 9114):


Q27: What is HTTP status code semantics? Walk through the major classes and give examples of each.

Answer: HTTP status codes are three-digit numbers. The first digit indicates the class:

1xx — Informational:

2xx — Success:

3xx — Redirection:

4xx — Client Error:

5xx — Server Error:


Q28: Explain CORS (Cross-Origin Resource Sharing). Why does it exist and how does it work?

Answer: Same-Origin Policy (SOP): Browsers enforce a security boundary: JavaScript running on https://a.com cannot make XMLHttpRequest/fetch calls to https://b.com and read the response. This prevents malicious scripts from stealing data from other sites where the user is authenticated (CSRF-style attacks).

CORS: A mechanism that allows servers to explicitly grant permission to cross-origin requests. It works through HTTP headers.

Simple requests (GET/HEAD/POST with specific content types):

Preflight requests (non-simple: custom headers, PUT/DELETE/PATCH, JSON body):

  1. Browser sends OPTIONS preflight with headers:

    • Origin: https://a.com

    • Access-Control-Request-Method: DELETE

    • Access-Control-Request-Headers: X-Custom-Header, Content-Type

  2. Server responds:

    • Access-Control-Allow-Origin: https://a.com

    • Access-Control-Allow-Methods: GET, POST, DELETE

    • Access-Control-Allow-Headers: X-Custom-Header, Content-Type

    • Access-Control-Max-Age: 86400 (cache preflight for 24 hours)

  3. Browser sends the actual request if preflight succeeds

Credentials (cookies):

CORS misconfiguration risks:


5. Routing & Switching

Q29: How does a router make a forwarding decision? Explain the routing table lookup process.

Answer: When a router receives an IP packet, it must determine where to forward it. The process is:

  1. Extract destination IP from the packet header.

  2. Longest Prefix Match (LPM): Look up the routing table for the most specific matching route. The route with the longest subnet mask (highest prefix length) that matches the destination IP wins. For example, if the routing table has both 10.0.0.0/8 and 10.1.0.0/16, a packet destined for 10.1.1.1 will match 10.1.0.0/16 (more specific).

  3. Administrative Distance (AD): If multiple routing protocols advertise the same prefix, the one with the lowest AD wins. AD values: Connected (0), Static (1), EIGRP (90), OSPF (110), RIP (120), eBGP (20), iBGP (200).

  4. Metric: Within the same routing protocol, the route with the lowest metric is preferred. OSPF uses cost (based on bandwidth), RIP uses hop count, EIGRP uses composite metric.

  5. Next hop resolution: The winning route specifies a next-hop IP address. The router looks up the next-hop IP in the ARP table (or Neighbor table for IPv6) to find the MAC address for the Layer 2 frame.

  6. Frame construction: Router decrements TTL by 1 (drops packet and sends ICMP Time Exceeded if TTL reaches 0), recalculates IP header checksum, constructs new Ethernet frame with its own src MAC and next-hop dst MAC, and transmits on the appropriate interface.

View routing table:

Special routes:


Q30: Explain OSPF. How does it discover neighbors, build its topology database, and calculate routes?

Answer: OSPF (Open Shortest Path First) is a link-state interior gateway protocol (IGP) that uses Dijkstra's Shortest Path First (SPF) algorithm. Unlike distance-vector protocols (RIP), OSPF routers have a complete map of the network topology within their area.

Neighbor Discovery and Adjacency Formation:

  1. Routers send Hello packets (multicast to 224.0.0.5) out OSPF-enabled interfaces every Hello interval (10 seconds on broadcast, 30 on non-broadcast).

  2. Hello packets contain: Router ID, Area ID, Hello/Dead intervals, Authentication, DR/BDR info, neighbor list.

  3. Two routers become neighbors when they see each other's Router ID in the received Hello's neighbor list.

  4. Not all neighbors become adjacent (full database synchronization). On multi-access networks (Ethernet), routers elect a Designated Router (DR) and Backup DR (BDR) to reduce the number of adjacencies. All routers form full adjacency with only the DR/BDR.

Database Synchronization:

  1. Adjacent routers exchange DBD (Database Description) packets — summaries of their LSDB (Link-State Database).

  2. Routers identify missing LSAs and request them with LSR (Link State Request) packets.

  3. Missing LSAs are sent in LSU (Link State Update) packets.

  4. Acknowledged with LSAck packets.

  5. When fully synchronized, adjacency state = Full.

SPF Calculation: Each router runs Dijkstra's algorithm on its complete LSDB to compute the shortest path tree to every destination, placing the best routes into the routing table.

LSA Types:

OSPF Areas:

Metric: Cost = reference bandwidth / interface bandwidth. Default reference: 100 Mbps. A 100 Mbps link has cost 1; a 10 Mbps link has cost 10.


Q31: What is BGP and how is it different from OSPF? Why does the Internet use BGP instead of OSPF?

Answer: BGP (Border Gateway Protocol) is the routing protocol of the Internet — the "glue" that holds the Internet together. It is a path-vector exterior gateway protocol (EGP) used to exchange routing information between Autonomous Systems (ASes).

Key differences from OSPF:

FeatureOSPFBGP
TypeLink-state IGPPath-vector EGP
ScaleHundreds of routers (single AS)Hundreds of thousands of prefixes (global Internet)
MetricCost (bandwidth-based)AS Path attributes (policy-driven)
ConvergenceFast (seconds)Slow (minutes in worst case)
TransportIP (protocol 89)TCP port 179
PeeringAutomatic (Hello multicast)Manual (must configure neighbors)
Use caseWithin an organization's ASBetween ISPs, ASes

Why BGP for the Internet:

  1. Policy-based routing: BGP allows operators to express complex business policies (prefer certain providers, avoid certain ASes, implement traffic engineering). OSPF only minimizes a simple metric.

  2. Scale: The global Internet routing table has ~900,000+ IPv4 prefixes. OSPF would require every router to store and compute SPF on all of these — computationally and memory infeasible. BGP routers store the table but don't run SPF.

  3. Autonomy: Each AS sets its own routing policies independently. OSPF within an AS is fine, but cross-AS routing needs AS-level autonomy.

  4. Aggregation: BGP naturally supports route aggregation and summarization at AS boundaries.

iBGP vs eBGP:

BGP Attributes (for path selection):

  1. Weight (Cisco proprietary, local significance)

  2. Local Preference (preferred exit from AS, higher = better)

  3. Locally Originated (prefer routes originated locally)

  4. AS Path length (shorter = better)

  5. Origin (IGP > EGP > Incomplete)

  6. MED (Multi-Exit Discriminator, lower = better, suggests preferred entry point into AS)

  7. eBGP over iBGP

  8. IGP metric to next hop


Q32: What is a VLAN and how does VLAN tagging (802.1Q) work?

Answer: VLAN (Virtual Local Area Network): A logical segmentation of a physical network. Devices in the same VLAN communicate as if they're on the same switch, regardless of physical location. Devices in different VLANs cannot communicate at Layer 2 without a router (or Layer 3 switch).

Benefits:

802.1Q VLAN Tagging: Without tagging, frames don't carry VLAN information. When a frame needs to traverse a trunk link (carrying multiple VLANs between switches), 802.1Q inserts a 4-byte tag into the Ethernet frame header:

802.1Q tag structure (4 bytes):

Access vs Trunk ports:

Native VLAN: On a trunk port, frames in the native VLAN are sent untagged (for compatibility with devices that don't understand 802.1Q). Default native VLAN is VLAN 1. Security best practice: change native VLAN to an unused VLAN to prevent VLAN hopping attacks.

Linux VLAN configuration:


Q33: What is Spanning Tree Protocol (STP) and why is it needed?

Answer: The Problem: Ethernet networks need redundant links for high availability. But redundant switch links create Layer 2 loops. Without loop prevention, a broadcast frame would circulate forever (broadcast storm), consuming all bandwidth and crashing the network within seconds. There are no TTLs in Layer 2 frames.

STP (IEEE 802.1D): Spanning Tree Protocol prevents loops by logically blocking redundant paths while keeping them available as backups. STP creates a loop-free tree topology.

STP Operation:

  1. Root Bridge Election: The switch with the lowest Bridge ID (BID = priority + MAC address) becomes the Root Bridge. All ports on the Root Bridge are in Designated (forwarding) state.

  2. Root Port Selection: Every non-root switch elects one Root Port — the port with the lowest-cost path to the Root Bridge (cost is based on link bandwidth).

  3. Designated Port Selection: For each network segment, one switch's port becomes the Designated Port (forwarding). The other switch's port becomes Non-Designated (Blocked).

  4. Port States: Blocking → Listening (15s) → Learning (15s) → Forwarding. Total convergence: ~30–50 seconds.

STP Port Roles:

STP Variants:

STP Security Issues:


Q34: What is NAT and how does it work? What are the different types?

Answer: NAT (Network Address Translation) modifies IP address (and sometimes port) information in packet headers as they pass through a router. Primarily used to allow multiple devices on a private network to share a single public IP address.

How NAT works (NAPT/PAT — the most common form):

  1. Internal host (192.168.1.10:54321) sends packet to 8.8.8.8:53.

  2. NAT router replaces source IP:port with its public IP:unique port (e.g., 203.0.113.1:45678) and records this mapping in the NAT table.

  3. Packet arrives at destination as from 203.0.113.1:45678.

  4. Response comes back to 203.0.113.1:45678.

  5. NAT router looks up 45678 in NAT table, translates destination back to 192.168.1.10:54321, and forwards internally.

NAT Types:

SNAT (Source NAT): Modifies the source address. Used for outbound traffic from private network to Internet. Also called Masquerade (when the public IP is dynamic).

DNAT (Destination NAT): Modifies the destination address. Used for inbound traffic — port forwarding. "Forward all TCP connections to port 80 on my public IP to 192.168.1.100:80."

Static NAT (1:1 NAT): One private IP maps to one specific public IP. Used for servers that need a stable public IP.

Full Cone NAT: Any external host can send packets to the translated address/port. (Most permissive)

Restricted Cone NAT: External host can only send if the internal host has previously sent a packet to that external host's IP.

Port Restricted Cone NAT: Must have sent to the exact IP:port combination.

Symmetric NAT: Different external mappings are created for each destination. Makes P2P applications and VoIP difficult (ICE/STUN/TURN required).

NAT Drawbacks:

Linux NAT with iptables:


6. Network Hardware

Q35: What is the difference between a managed and unmanaged switch? What features does a managed switch provide?

Answer: Unmanaged switch:

Managed switch:

Layer 3 switch (multilayer switch): Has additional routing capabilities. Can route between VLANs at wire speed in hardware (ASIC-based), much faster than routing through an external router. Replaces the need for a "Router-on-a-Stick" architecture.


Q36: What is a NIC (Network Interface Card) and what are its key features?

Answer: A NIC is the hardware component that connects a computer to a network. It operates at Layer 1 and Layer 2.

Core functions:

Performance features relevant to Google-scale:

Check NIC offload settings:

Ring buffers: NIC has TX and RX ring buffers. If the ring buffer fills up (CPU too slow to drain packets), packets are dropped at the NIC level before they even reach the kernel. Increase with ethtool -G eth0 rx 4096.


Q37: What is a firewall and how does it differ from a router? Describe stateless vs. stateful firewalls.

Answer: A router makes forwarding decisions based on destination IP address to route packets between networks. A firewall makes permit/deny decisions based on security policy — it's a policy enforcement point, not a routing device (though modern "next-gen" firewalls do both).

Stateless (packet filter) firewall:

Stateful (connection tracking) firewall:

Next-Generation Firewall (NGFW):

Linux iptables example (stateful):


Q38: What is a load balancer? Describe Layer 4 vs Layer 7 load balancing.

Answer: A load balancer distributes incoming network traffic across multiple backend servers to improve performance, availability, and scalability.

Layer 4 Load Balancer (Transport Layer):

Layer 7 Load Balancer (Application Layer):

Load balancing algorithms:

  1. Round Robin: Requests distributed sequentially. Simple, works well for uniform requests.

  2. Weighted Round Robin: Servers get proportional share based on weight. Useful for heterogeneous backends.

  3. Least Connections: Send to the server with fewest active connections. Better for long-lived connections.

  4. Weighted Least Connections: Combines connection count and server weight.

  5. IP Hash: Hash source IP to consistently route the same client to the same server (basic session persistence). Breaks if server pool changes.

  6. Consistent Hashing: Uses a hash ring — adding/removing servers only remaps a small fraction of traffic (used by CDNs and distributed caches).

  7. Random: Random selection with two choices, pick the less loaded one (Power of Two Choices) — near-optimal in practice.

  8. EWMA (Exponentially Weighted Moving Average): Route to server with lowest recent response time (used by Envoy).


Q39: What is a proxy server? Explain forward proxy vs. reverse proxy.

Answer: A proxy is an intermediary that acts on behalf of another party in a network communication.

Forward Proxy:

Reverse Proxy:

Transparent Proxy:


7. Subnetting & IP Addressing

Q40: Explain CIDR notation and how to calculate the network address, broadcast address, and host range for a subnet.

Answer: CIDR (Classless Inter-Domain Routing) notation expresses an IP address and its subnet mask together. Format: IP/prefix_length. Example: 192.168.1.0/24.

The prefix length indicates how many bits (from the left) are the network portion. The remaining bits are the host portion.

Example: 192.168.10.50/26

  1. Prefix length = 26, so network bits = 26, host bits = 32 - 26 = 6.

  2. Subnet mask: 26 bits set to 1: 11111111.11111111.11111111.11000000 = 255.255.255.192

  3. Network address: AND the IP with the subnet mask:

    • 192.168.10.50 = 11000000.10101000.00001010.00110010

    • 255.255.255.192 = 11111111.11111111.11111111.11000000

    • AND = 11000000.10101000.00001010.00000000 = 192.168.10.0

  4. Broadcast address: Set all host bits to 1: 192.168.10.00111111 = 192.168.10.63

  5. Host range: Network + 1 to Broadcast - 1: 192.168.10.1 – 192.168.10.62

  6. Number of hosts: 2^6 - 2 = 64 - 2 = 62 usable host addresses

Common prefix lengths:

CIDRMaskHostsUsage
/8255.0.0.016MLarge orgs, Class A
/16255.255.0.065534Medium orgs
/24255.255.255.0254Common LAN
/25255.255.255.128126Half-split /24
/26255.255.255.19262 
/28255.255.255.24014Small subnets
/30255.255.255.2522Point-to-point links
/31255.255.255.2542 (RFC 3021)P2P, no broadcast
/32255.255.255.2551Host route, loopback

Quick calculation:


Q41: What are private IP address ranges? Why do they exist?

Answer: RFC 1918 defines three blocks of IPv4 addresses reserved for private use. These addresses are not routed on the public Internet:

RangeCIDRSize
10.0.0.0 – 10.255.255.25510.0.0.0/816,777,216 addresses
172.16.0.0 – 172.31.255.255172.16.0.0/121,048,576 addresses
192.168.0.0 – 192.168.255.255192.168.0.0/1665,536 addresses

Why they exist:

  1. IPv4 exhaustion: IPv4 provides only ~4.3 billion addresses, insufficient for every device. Private ranges allow organizations to use any addressing internally, with NAT mapping to one or a few public IPs.

  2. Security by default: Private addresses are not routable from the Internet, providing implicit separation between internal and external networks.

  3. Cost: Organizations don't need to purchase public IP address space for every device.

Other special ranges:

IPv6 equivalents:


Q42: You have the network 10.0.0.0/24 and need to divide it into 4 equal subnets. What are they?

Answer: To divide a /24 into 4 equal subnets, we need 2 additional bits (2² = 4). New prefix: /24 + 2 = /26.

Each /26 has 2^6 = 64 addresses, 62 usable hosts.

SubnetNetworkRangeBroadcast
Subnet 110.0.0.0/2610.0.0.1 – 10.0.0.6210.0.0.63
Subnet 210.0.0.64/2610.0.0.65 – 10.0.0.12610.0.0.127
Subnet 310.0.0.128/2610.0.0.129 – 10.0.0.19010.0.0.191
Subnet 410.0.0.192/2610.0.0.193 – 10.0.0.25410.0.0.255

Mental model: Each subnet starts at a multiple of 64: 0, 64, 128, 192.

For any subnetting problem:


8. Network Troubleshooting Methodology

Q43: You are told "the network is slow." Walk me through your troubleshooting methodology.

Answer: This is a broad, open-ended problem. Good troubleshooting is systematic, top-down or bottom-up, and eliminates possibilities efficiently.

Step 1: Clarify and scope

Step 2: Isolate the layer

Layer 1 — Physical:

Layer 2 — Data Link:

Layer 3 — Network:

Layer 4 — Transport:

Layer 7 — Application:

Step 3: Check system resources

Step 4: Packet capture

Step 5: Compare against baseline If you have monitoring (Prometheus, Grafana, Google's Monarch), compare current metrics against historical baseline. Changes often coincide with network events.


Q44: How do you diagnose packet loss? What tools do you use and what do you look for?

Answer: Packet loss causes TCP retransmissions, increased latency, and reduced throughput. Here's a systematic approach:

Step 1: Confirm and quantify packet loss

Step 2: Locate where loss is occurring (per-hop)

Step 3: Distinguish loss types

NIC/driver level drops:

Kernel queue drops (softirq, ring buffer):

Traffic shaping / QoS drops:

Step 4: Capture and analyze with tcpdump/Wireshark

Step 5: Identify the cause

tcpdump signs of loss:


Q45: How do you investigate high network latency? Distinguish between different causes.

Answer: Latency has many possible root causes at different layers. Systematic investigation:

Establish baseline RTT:

Propagation delay (unavoidable physics): Speed of light in fiber ≈ 200,000 km/s. NYC to London (~5500 km) ≈ 27ms one-way minimum. If measured latency < theoretical minimum, something is wrong (proxy caching? Anycast?). If much higher, look for sub-optimal routing.

Queuing delay (congestion): Symptoms: latency varies with time of day, high throughput correlates with high latency, TCP throughput well below link capacity.

DNS lookup delay:

TCP connection setup delay:

TLS handshake overhead:

Application processing time (TTFB):

Head-of-line blocking (HTTP/1.1): Each TCP connection can only process one request at a time. Slow upstream resource blocks all resources queued behind it. Solution: HTTP/2 multiplexing or multiple parallel connections.

Bandwidth delay product:


Q46: How do you use traceroute and interpret its output? What can cause misleading results?

Answer: Traceroute discovers the path packets take through the network by sending probes with incrementally increasing TTL values. When a router decrements TTL to 0, it drops the packet and sends an ICMP Time Exceeded back to the source. By recording which router sent the ICMP reply, traceroute builds a path map.

Mechanism:

  1. Send probe with TTL=1 → first router drops it, sends ICMP TTL Exceeded → record router 1's IP and RTT

  2. Send probe with TTL=2 → second router sends ICMP → record router 2

  3. Continue until destination reached (ICMP Port Unreachable for UDP probes, or ICMP Echo Reply for ICMP probes)

Linux traceroute variants:

Sample output interpretation:

Asterisks (* * *):

Misleading results:

  1. ICMP rate limiting: Routers often rate-limit ICMP TTL Exceeded responses. Probes may time out even when data flows fine.

  2. Asymmetric routing: Forward and return paths may be different. Traceroute shows the return path of ICMP replies, which may differ from the data path.

  3. MPLS networks: Traffic travels inside MPLS tunnels; intermediate LSRs are invisible (may see two hops with large RTT jump).

  4. Anycast: The final hop might be a different physical host depending on load, so RTT to destination may be inconsistent.

  5. Per-flow load balancing (ECMP): Each traceroute probe may take a different path if ECMP hashes differently. Paris-traceroute fixes this by keeping the 5-tuple constant.


Q47: What is ss and how does it compare to netstat? Show common use cases.

Answer: ss (socket statistics) is the modern replacement for netstat. It uses the kernel's netlink socket interface rather than reading /proc/net/tcp (which requires parsing text files), making it significantly faster, especially on systems with many connections.

Common ss invocations:

ss -tin internals explained:

netstat equivalents: