Computer Networks Interview Questions and Answers

Computer networks interview questions and computer networks basic interview questions for 2026: OSI, TCP/IP, DNS, HTTP/TLS, routing, NAT, and troubleshooting with elaborate answers.

Published

Updated

Tech reviewed byDeepak Prasad

Computer Networks Interview Questions and Answers

Computer networks interview questions and computer networks basic interview questions appear in software engineering, backend, full-stack, DevOps, SRE, and campus placement loops—not only dedicated network engineer roles. Interviewers expect you to explain what happens when you type a URL, compare TCP vs UDP with real use cases, walk through DNS resolution, describe TLS at a high level, and debug connectivity with layered reasoning instead of guessing.

Below are 45 questions with elaborate answers; technical sections include a strong answer sample you can say aloud. Pair with operating system interview questions for sockets, processes, and kernel networking stack context, Selenium interview questions for browser automation over HTTP/TLS, Kubernetes interview questions for cluster networking and Services, full stack developer interviews for end-to-end feature delivery, front end developer interviews for HTTP, CORS, and browser behavior, and SQL technical interview questions when system design ties app tiers to data stores.

NOTE
Prep target: Whiteboard the URL-to-page flow (DNS → TCP → TLS → HTTP), explain the TCP three-way handshake, and rehearse one troubleshooting story using ping, traceroute, and checking DNS—not jumping straight to "the server is down."

Tested on: Ubuntu 25.04 (Plucky Puffin); kernel 6.14.0-37-generic; ping, ip route, and getent hosts verified locally.


Interview context and how to prepare

What do computer networks interviews actually test?

Computer networks interviews test whether you understand how data moves across layers—from physical links to application protocols—and can reason about failures systematically.

Layer What interviewers probe
Models OSI vs TCP/IP, which layer owns what
Addressing IP, MAC, ports, subnets
Transport TCP vs UDP, handshake, reliability
Application HTTP/HTTPS, DNS, email basics
Infrastructure NAT, load balancing, routing concepts
Security TLS, firewalls, HTTPS
Troubleshooting Layered isolation, tools
Role Emphasis
Junior / campus OSI, TCP/UDP, IP basics, URL flow
Backend / full stack HTTP, DNS, TLS, REST latency
DevOps / SRE Load balancers, DNS TTL, BGP awareness
Network engineer VLANs, OSPF/BGP depth, hardware

Most networking screens start with what happens when you type a URL, TCP vs UDP, and DNS—then follow with layered debugging.

Computer networks basic interview questions vs advanced — what changes?

Basic questions (campus and screening):

  • What is a computer network?
  • LAN vs WAN
  • OSI seven layers (names + one-line role)
  • TCP vs UDP table
  • What is DNS? What is HTTP vs HTTPS?

Advanced questions (product companies, SRE):

  • TCP congestion control (slow start, cwnd)
  • TLS 1.3 handshake RTT
  • HTTP/2 multiplexing vs HTTP/3 QUIC
  • Anycast, CDN edge caching
  • L4 vs L7 load balancing trade-offs
  • Intermittent packet loss diagnosis

Start with basic fluency; senior loops add scenario depth and trade-off language.

What is a typical computer networks interview loop?
Round Duration Focus
Screening 30 min Fundamentals, coursework, projects
Theory depth 45 min OSI, TCP, DNS, HTTP
Scenario 45 min "Type google.com" walkthrough
Troubleshooting 30–45 min "Site unreachable" layered debug
System design (senior) 45–60 min CDN, API gateway, multi-region

TakeUForward and Bosscoder-style lists emphasize explaining with diagrams aloud.

What is a realistic 3–5 week networking prep plan?
Week Focus Output
1 OSI/TCP-IP, IP/MAC, ports Draw models from memory
2 TCP/UDP, handshake, sockets link to OS Explain reliability vs latency
3 DNS, HTTP, HTTPS, TLS 1.3 URL flow whiteboard
4 NAT, DHCP, routing, load balancing Small AWS/GCP VPC mental model
5 Mock + tools ping, traceroute, dig, curl -v

Run curl -v https://example.com and label each line with the layer it represents.

Do software engineers need networking depth?

Yes—every distributed system depends on networks:

Software concern Networking tie-in
API latency RTT, TLS handshakes, keep-alive
Timeouts TCP retransmits, packet loss
Microservices Service discovery, load balancers
Browsers CORS, cookies, HTTP/2
Cloud deploy VPC, security groups, NAT
Observability DNS failures look like app outages

You do not need CCIE depth for most backend roles—you need clear layered explanations and debug vocabulary.


OSI and TCP/IP models

What is a computer network?

A computer network connects devices so they can exchange data using shared protocols and addressing.

Type Scope Example
LAN Building/campus Office Wi-Fi, lab Ethernet
MAN City Metro fiber ring
WAN Geographic Internet, branch VPN
PAN Personal Bluetooth

Networks use layered protocols so applications do not manage raw bits on cables—the stack abstracts complexity.

A strong answer is:

A network is addressed devices plus agreed protocols—I distinguish LAN vs WAN and explain that layers let HTTP run without apps handling Ethernet frames.

Explain the OSI model — seven layers?
Layer Name PDU Examples
7 Application Data HTTP, DNS, SMTP
6 Presentation Data TLS, compression, encoding
5 Session Data Session management
4 Transport Segment TCP, UDP
3 Network Packet IP, ICMP, routing
2 Data Link Frame Ethernet, MAC, switches
1 Physical Bits Cables, radio, hubs

Mnemonic: "All People Seem To Need Data Processing" (top-down) or reverse for bottom-up.

Interviews use OSI for precise vocabulary ("that's a layer 4 issue") even though TCP/IP is what runs on the internet.

A strong answer is:

OSI is a teaching model—I name the layer for each protocol: HTTP at application, TCP at transport, IP at network, Ethernet at data link.

TCP/IP model vs OSI — four layers?
TCP/IP layer Maps from OSI Protocols
Application App + Presentation + Session HTTP, DNS, TLS (often shown here)
Transport Transport TCP, UDP
Internet Network IPv4, IPv6, ICMP
Network Access Data Link + Physical Ethernet, Wi-Fi, ARP

TCP/IP is the practical internet stack; fewer layers, same concepts.

A strong answer is:

TCP/IP is the real internet model—four layers with TLS and HTTP grouped at application; I use OSI names when debugging layer by layer.

Encapsulation and decapsulation?

Encapsulation is the process of wrapping application data with protocol headers (and sometimes trailers) as it moves down the stack toward the wire. Decapsulation strips those headers up the stack at the receiver so each layer sees only its own PDU (Protocol Data Unit).

Example sending an HTTP GET:

Step Layer What is added
1 Application HTTP request line + headers
2 Transport (TCP) Source/dest ports, seq/ack, flags
3 Network (IP) Source/dest IP addresses, TTL
4 Link (Ethernet) Source/dest MAC, EtherType

On receive, the NIC delivers a frame → IP extracts packet → TCP reassembles segment → HTTP parses message.

MTU (Maximum Transmission Unit) caps payload size per link—Ethernet is often 1500 bytes. Larger IP packets fragment at routers; fragmentation hurts performance and complicates firewalls, so TCP uses MSS negotiation during handshake to avoid fragmentation on the path.

Interviewers want layered reasoning: "Where does TLS sit?" (between TCP and HTTP), "What does a switch read?" (Ethernet header, not HTTP body).

A strong answer is:

I describe encapsulation as headers added per layer down the stack—HTTP inside TCP inside IP inside Ethernet—and decapsulation as peeling headers up; I mention MTU and why fragmentation matters on real paths.

What is a port number?

Ports (0–65535) identify applications/services on a host; IP identifies the host.

Range Use
0–1023 Well-known (HTTP 80, HTTPS 443, DNS 53)
1024–49151 Registered
49152–65535 Ephemeral (client side of connections)

Socket = IP + port + protocol (e.g. 10.0.0.5:443 TCP).

Multiplexing lets many connections share one IP—web server handles thousands of (client_ip, ephemeral_port) pairs.

A strong answer is:

IP finds the machine; ports find the service—ephemeral ports on clients, well-known ports on servers like 443 for HTTPS.


IP addressing, MAC, and local delivery

IPv4 vs IPv6 — basics?

IPv4 — 32-bit dotted decimal (192.168.1.10). IPv6 — 128-bit hex (2001:db8::1).

Topic IPv4 IPv6
Address space ~4 billion Virtually unlimited
NAT reliance Common Designed for end-to-end
Config DHCP common SLAAC + DHCPv6

Private IPv4 ranges (RFC 1918): 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16—not routed on public internet.

A strong answer is:

IPv4 plus NAT dominates today; IPv6 removes NAT pressure—I know private ranges and that loopback is 127.0.0.1 for local tests like ping.

Subnet mask and CIDR?

Subnetting splits networks into smaller broadcast domains.

Notation Meaning
192.168.1.0/24 256 addresses, 254 hosts
Mask 255.255.255.0 Same as /24

Gateway (default route) — router IP to reach other subnets; on this host:

bash
ip route show default

Typical output includes default via 192.168.0.1 dev eth0—traffic to non-local IPs goes there.

A strong answer is:

CIDR defines network size—I explain /24 as 254 usable hosts and point default route at the gateway for off-subnet traffic.

MAC address vs IP address? ARP?
MAC IP
Layer Data link (L2) Network (L3)
Scope Local segment End-to-end (routed)
Format 48-bit hardware ID Logical address

ARP (Address Resolution Protocol) maps IP → MAC on the local LAN: "Who has 192.168.1.1?"

Remote IPs go to default gateway's MAC; routers forward by IP across hops.

A strong answer is:

IP routes globally; MAC delivers on the local Ethernet—ARP binds them on the LAN before frames leave the subnet.

What is DHCP?

Dynamic Host Configuration Protocol assigns IP configuration automatically:

Parameter Example
IP address 192.168.0.42
Subnet mask /24
Default gateway 192.168.0.1
DNS servers 8.8.8.8
Lease time Hours to days

DORA process: Discover, Offer, Request, Acknowledge.

Without DHCP, static config or IPv6 SLAAC may apply.

A strong answer is:

DHCP hands out IP, gateway, and DNS—when a laptop "just works" on Wi-Fi, DORA negotiated the lease.

ICMP and ping — what do they test?

ICMP (Internet Control Message Protocol) carries control messages at network layer—errors, echo request/reply.

ping sends ICMP Echo Request; success means reachability and round-trip time to an IP—not that a TCP service works.

On Ubuntu 25.04, loopback test:

text
PING 127.0.0.1 (127.0.0.1) 56(84) bytes of data.
64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.478 ms
64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.066 ms
--- 127.0.0.1 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss

Ping failure may mean host down, firewall blocking ICMP, or routing issue—does not diagnose port 443 closed.

A strong answer is:

Ping tests IP reachability via ICMP—a successful ping does not prove HTTPS works; failed ping suggests routing, firewall, or host down at L3.


Transport layer — TCP and UDP

TCP vs UDP — compare?
TCP UDP
Connection Connection-oriented Connectionless
Reliability Acknowledgments, retransmit Best effort
Ordering In-order delivery No guarantee
Overhead Higher (headers, state) Lower 8-byte header
Use cases HTTP, SSH, databases DNS, VoIP, gaming, QUIC base

Choose TCP when correctness matters; UDP when latency beats perfect delivery.

A strong answer is:

TCP for reliable byte streams—HTTP and APIs; UDP for low-latency DNS and media where app handles loss; I justify choice with reliability vs latency.

TCP three-way handshake?

Establishes connection before data:

Step Direction Flags
1 Client → Server SYN (seq=x)
2 Server → Client SYN-ACK (seq=y, ack=x+1)
3 Client → Server ACK (ack=y+1)

Why three steps: both sides agree on initial sequence numbers; prevents stale duplicate SYN from opening wrong connection.

SYN flood attacks exploit half-open connections—mitigated by SYN cookies, rate limits.

A strong answer is:

SYN, SYN-ACK, ACK synchronizes sequence numbers—I mention it before HTTP on port 443 and tie half-open states to SYN flood awareness.

TCP connection termination — four-way handshake?

Graceful close:

  1. FIN from side A
  2. ACK from side B
  3. FIN from side B
  4. ACK from side A

Either side can initiate. TIME_WAIT on closing side waits 2×MSL to handle late duplicates—many sockets in TIME_WAIT on busy servers.

RST aborts connection abruptly.

A strong answer is:

FIN/ACK exchange closes cleanly; TIME_WAIT prevents stray packets—I distinguish graceful close from RST reset on error.

How does TCP ensure reliability?

Mechanisms:

Mechanism Role
Sequence numbers Order bytes, detect gaps
Acknowledgments Confirm received data
Retransmission Resend unacked segments
Checksum Detect corruption
Flow control Receive window prevents overflow
Congestion control Slow start, congestion avoidance (cwnd)

Head-of-line blocking — lost TCP segment delays later data on same connection; HTTP/3 QUIC avoids this at transport level.

A strong answer is:

Sequence numbers plus ACKs and retransmit deliver reliable streams—congestion control shares bandwidth fairly; HoL blocking is why HTTP/3 moved to QUIC.

Why is UDP used for DNS and streaming?

UDP fits workloads where speed and simplicity beat TCP's reliability guarantees.

DNS (port 53):

  • Queries are tiny (often < 512 bytes); one question, one answer.
  • A TCP handshake adds RTT before the first byte—wasteful for a 50 ms lookup.
  • If UDP response is lost, the resolver retries with exponential backoff—application-level reliability is enough.
  • TCP is still used for zone transfers (AXFR) where large, reliable transfers matter.

Live streaming and gaming:

  • A lost video frame from two seconds ago is useless—retransmitting it increases buffer bloat and latency.
  • Codecs and jitter buffers conceal occasional loss; players prefer smooth motion over perfect pixels.
  • VoIP uses small UDP packets with FEC (forward error correction) instead of TCP retransmits.

QUIC (HTTP/3 base):

  • Runs over UDP but implements selective reliability, 0-RTT resumption, and stream multiplexing without TCP head-of-line blocking.
  • Encryption (TLS 1.3) is integrated from the first packet.
Workload Why UDP
DNS lookup Low latency, small payload, app retries
Real-time media Stale retransmits worse than drop
Gaming state Fresh position beats old correction
QUIC/HTTP/3 Custom reliability on modern paths

A strong answer is:

DNS uses UDP because queries are small and a TCP handshake wastes RTT—resolvers retry on loss; streaming and gaming prefer dropping stale frames over TCP retransmits that add delay; QUIC rebuilds reliability on UDP for HTTP/3 without head-of-line blocking.


Application layer — HTTP, HTTPS, and TLS

HTTP request-response cycle?

HTTP (Hypertext Transfer Protocol) — application protocol, typically over TCP port 80.

text
GET /index.html HTTP/1.1
Host: example.com
User-Agent: curl/8.x
Accept: */*

HTTP/1.1 200 OK
Content-Type: text/html
Content-Length: 1256

<body>
Method Idempotent Typical use
GET Yes Read
POST No Create, actions
PUT Yes Replace
PATCH No Partial update
DELETE Yes Remove

Stateless — each request independent; cookies/sessions add state at application layer.

A strong answer is:

HTTP is request-response over TCP—methods express intent, Host header required in HTTP/1.1, stateless at protocol level with cookies for sessions.

HTTP vs HTTPS — TLS role?
HTTP HTTPS
Port 80 Port 443
Plaintext TLS encryption
No server auth by default Certificate validates server

TLS provides:

  • Confidentiality — encrypted payload
  • Integrity — tamper detection
  • Authentication — certificate chain to trusted CA

TLS sits between TCP and HTTP (presentation/session in OSI terms).

A strong answer is:

HTTPS is HTTP inside TLS—I explain encryption, cert trust, and that browsers warn on invalid certificates before sending sensitive data.

TLS 1.3 handshake — simplified?

Modern TLS 1.3 reduces round trips:

  1. Client Hello — supported ciphers, key share
  2. Server Hello — cert, chosen cipher, key share
  3. Encrypted handshake — verify cert, derive session keys
  4. Application data — HTTP inside encrypted channel

1-RTT full handshake common; 0-RTT resumption for returning clients (replay caveats).

Older TLS 1.2 needed more round trips—know 1.3 is current default in 2026.

A strong answer is:

TLS 1.3 negotiates keys in about one RTT—I describe cert validation and that session resumption cuts latency for repeat visitors.

HTTP/1.1 vs HTTP/2 vs HTTP/3?
Version Transport Key improvement
HTTP/1.1 TCP Keep-alive, pipelining (limited)
HTTP/2 TCP Multiplexed streams, HPACK header compression
HTTP/3 QUIC (UDP) No TCP HoL blocking, faster handoff

HTTP/2 still suffers TCP-level head-of-line blocking if one packet lost.

HTTP/3 uses QUIC — encryption built-in, connection migration when IP changes (mobile Wi-Fi → LTE).

A strong answer is:

HTTP/2 multiplexes on one TCP connection; HTTP/3 uses QUIC on UDP to fix TCP HoL blocking and improve mobile handoffs—I mention which CDN/browser support implies in prod.

Common HTTP status codes for interviews?
Code Meaning When
200 OK Success
301/302 Redirect Moved permanently/temporarily
400 Bad Request Client malformed
401 Unauthorized Auth required
403 Forbidden Auth ok, not allowed
404 Not Found Resource missing
429 Too Many Requests Rate limit
500 Internal Server Error Server bug
502/503/504 Gateway/Unavailable/Timeout Proxy or upstream failure

502 often means load balancer could not reach healthy backend—networking and app debug intersect.

A strong answer is:

I map codes to layer—404 is routing/resource, 502 is often LB-to-backend connectivity, 503 overload or maintenance.


DNS, NAT, and naming

How does DNS resolution work?

Turning example.com → IP address:

  1. Browser cache — recent lookups
  2. OS resolver cache
  3. Recursive resolver (ISP, 8.8.8.8, 1.1.1.1)
  4. Root nameserver — points to TLD
  5. TLD nameserver (.com)
  6. Authoritative nameserver — final A/AAAA record
bash
getent hosts google.com

Example resolved address: 142.250.183.142 — proves resolver path works on host.

Record types: A (IPv4), AAAA (IPv6), CNAME (alias), MX (mail), TXT (verification).

A strong answer is:

DNS walks cache then recursive resolver to authoritative server—I name record types and know TTL controls cache freshness on changes.

DNS caching and TTL?

TTL (Time To Live) — seconds resolvers cache answers.

Long TTL Short TTL
Less DNS traffic Faster failover / migration
Stale if IP changes More resolver load

DNS propagation delays cutover during migrations—plan lower TTL before changing records.

Negative caching stores NXDOMAIN temporarily.

A strong answer is:

TTL balances performance and agility—I lower TTL before migrations and explain why users still hit old IPs until caches expire.

What is NAT (Network Address Translation)?

NAT maps private IPs to public IP(s) on router/firewall—conserves IPv4, hides internal topology.

Type Behavior
SNAT Outbound — many internal hosts share one public IP
DNAT Inbound — port forward to internal server

Breaks end-to-end transparency—some protocols (SIP, FTP) need ALG helpers.

Kubernetes kube-proxy and cloud NAT gateways use same idea at scale—see Kubernetes networking.

A strong answer is:

NAT lets private RFC1918 hosts reach the internet via one public IP—I note inbound DNAT for port forwarding and that NAT complicates peer-to-peer without STUN/TURN.

What is a CDN and why use one?

Content Delivery Network — edge servers cache static assets geographically close to users.

Benefits:

  • Lower latency (RTT to edge)
  • Reduced origin load
  • DDoS absorption at edge
  • TLS termination at edge

Cache invalidation and cache keys (URL, headers, cookies) affect hit rate.

A strong answer is:

CDN moves bytes closer to users—I explain DNS directing to nearest PoP and cache TTL vs dynamic API bypass.

CORS — networking meets browsers?

Cross-Origin Resource Sharing — browser security policy blocking JS from reading cross-origin responses unless server allows.

Server sends:

text
Access-Control-Allow-Origin: https://app.example.com

Preflight OPTIONS request for non-simple methods/headers.

Not a server firewall—browser enforcement of same-origin policy. Ties to front end interviews.

A strong answer is:

CORS is browser-side—API must emit Allow-Origin headers; preflight OPTIONS happens before POST with custom headers from another origin.


Routing, switching, and load balancing

Router vs switch?

Both move traffic, but at different layers with different forwarding tables.

Device OSI layer Forwarding key Typical scope
Hub (legacy) L1 Electrical repeat—broadcasts to all ports Deprecated
Switch L2 Destination MAC address Single LAN / VLAN
Router L3 Destination IP address Between subnets / WAN

Switch behavior:

  • Learns MAC → port mappings from source addresses in incoming frames.
  • Forwards unicast only to the port where that MAC was seen—reduces collision domains vs hubs.
  • Still one broadcast domain per VLAN (ARP, DHCP broadcasts reach all ports in the VLAN).

Router behavior:

  • Maintains a routing table (static or dynamic via OSPF/BGP).
  • Decrements TTL; drops or forwards based on longest-prefix match.
  • Connects 192.168.1.0/24 to 10.0.0.0/8—hosts on different subnets need a default gateway (usually a router interface).

VLANs segment a physical switch into logical LANs. Inter-VLAN routing requires an L3 device—a router or L3 switch with SVIs (Switch Virtual Interfaces).

Interview scenario: "Two departments on one switch but isolated?" → VLANs + ACLs or separate VLANs routed through a firewall.

A strong answer is:

Switches forward frames by MAC inside a LAN; routers forward packets by IP between subnets—I use VLANs to segment broadcast domains on one switch and route between VLANs on an L3 device when departments must stay isolated.

Static vs dynamic routing?
Static Dynamic (OSPF, BGP)
Admin configures routes Protocols exchange routes
Small networks Internet core, enterprises
No convergence logic Adapts to link failures

Default route (0.0.0.0/0) — send unknown destinations to gateway.

BGP — inter-domain internet routing between autonomous systems—cloud anycast uses BGP announcements.

A strong answer is:

Static routes for simple sites; BGP runs the internet at scale—I know default route sends traffic to the ISP gateway.

Layer 4 vs Layer 7 load balancing?
L4 (transport) L7 (application)
TCP/UDP, IP, port HTTP paths, headers, cookies
Fast, protocol-agnostic Content-based routing
Examples: HAProxy TCP mode NGINX, ALB path rules
No URL awareness SSL termination, sticky sessions

Health checks — TCP connect vs HTTP GET /health.

Sticky sessions — same client to same backend via cookie or IP hash.

A strong answer is:

L4 balances connections fast; L7 routes on URL and headers—I pick L7 when canary or API versioning needs path rules.

Firewall and security groups?

Firewalls filter traffic by rules:

Match Example
IP / CIDR Allow 10.0.0.0/8
Port Allow TCP 443
Protocol Deny all except TCP

Stateful firewall tracks connections—return traffic allowed automatically.

Cloud security groups are host-level firewalls; NACLs subnet-level (AWS terminology)—defense in depth.

A strong answer is:

Deny by default, allow least privilege—I distinguish stateful rules (established return traffic) from stateless ACLs.

VPN — site-to-site vs remote access?

VPN encrypts traffic over untrusted networks.

Type Use
Remote access Laptop to corporate network
Site-to-site Branch office to HQ

Protocols: IPsec, WireGuard, OpenVPN.

TLS VPN (HTTPS) is different—browser to web app, not full network tunnel.

A strong answer is:

VPN extends private network over internet encrypted—I contrast full-tunnel remote access with TLS to a single web app.


Troubleshooting and scenarios

traceroute / mtr — what do they show?

Traceroute discovers path hops to destination using TTL expiration (ICMP or UDP probes).

Shows where latency jumps or packets stop—routing loop, firewall drop, or provider issue.

Pair with ping for reachability; curl -v for application layer.

Layered toolkit:

Tool Layer
ping ICMP / L3
traceroute L3 path
dig / nslookup DNS / app
curl -v HTTP/TLS / app
ss / netstat Local sockets

A strong answer is:

Traceroute locates which hop fails or adds latency—I never stop at ping alone for "site slow" reports.

Scenario: What happens when you type a URL and press Enter?

End-to-end narrative interviewers love:

  1. Parse URL — scheme, host, path, port default 443 for HTTPS
  2. DNS lookup — A/AAAA record for host
  3. TCP connect — SYN/SYN-ACK/ACK to server IP:443
  4. TLS handshake — cert verify, session keys
  5. HTTP request — GET path, Host header, HTTP/2 maybe multiplexed
  6. Server process — web server → app → database if needed
  7. Response — status, headers, body
  8. Browser — parse HTML, fetch assets (more DNS+TCP+TLS), render

Mention caching at DNS, CDN, and browser HTTP cache.

A strong answer is:

I walk DNS → TCP → TLS → HTTP → server logic → response, naming layers and where caching short-circuits repeat visits.

Scenario: Website unreachable — debug approach?

Structured flow (state assumptions):

  1. User scope — one user or everyone? DNS change recent?
  2. DNSdig example.com returns expected IP?
  3. Networkping / traceroute to IP (ICMP may be blocked)
  4. TCP portcurl -v or nc -zv host 443
  5. TLS — cert expired? wrong hostname?
  6. HTTP — 502/503 from LB? app logs?
  7. Recent changes — deploy, firewall, TTL

Avoid jumping to "database down" before proving reachability to load balancer.

A strong answer is:

I isolate layer by layer—DNS, then TCP 443, then TLS, then HTTP status—correlating with whether failure is global or regional.

Scenario: Intermittent packet loss — symptoms?

Intermittent loss is harder than total outage—connections work but degrade unpredictably.

Symptoms by protocol:

Protocol What users see Under the hood
TCP (HTTP, APIs) Slow pages, timeouts on large transfers Retransmits, RTO backoff, cwnd shrink
UDP (VoIP, gaming) Audio gaps, rubber-banding, frozen video App drops packets; no automatic retry
ICMP (ping) Request timeout or seq gaps Direct loss measurement

Diagnostic flow:

  1. Baseline: ping -c 20 host — watch for loss % and jitter (RTT variance).
  2. Path: traceroute / mtr — loss at one hop vs end-to-end (last-hop loss often means congestion at destination).
  3. Layer isolation: Compare Wi-Fi vs wired; swap cable; test from another VLAN.
  4. Capture: tcpdump or Wireshark—retransmits ([TCP Retransmission]), duplicate ACKs, high RTT spikes.
  5. Offload: Disable NIC LRO/GRO temporarily if checksum errors appear—rare but real on some drivers.

Common causes:

  • Wi-Fi contention, roaming, or weak signal
  • Duplex mismatch or failing cable (CRC errors on switch port counters)
  • ISP peering congestion or bufferbloat on home router
  • Oversubscribed VM host or microbursts in cloud

Mitigation: Fix physical/link layer first; apply QoS for voice; tune TCP only after ruling out L1/L2; for real-time UDP use jitter buffers and FEC.

A strong answer is:

Intermittent loss shows as TCP slowdowns and jittery RTT on ping—I isolate Wi-Fi vs wired, use mtr to see which hop drops packets, capture retransmits if needed, and fix the physical or congestion layer before tuning TCP.

WebSockets vs HTTP — when use?

HTTP/1.1 is request-response: the client opens a connection, sends a request, server replies, connection may close. For live updates, naive approaches fail:

Pattern Problem
Short polling Constant requests—wastes bandwidth and CPU
Long polling Server holds request open—many hanging connections
HTTP/2 server push Limited browser support for app-level push patterns

WebSocket handshake:

  1. Client sends HTTP Upgrade: websocket request.
  2. Server responds 101 Switching Protocols.
  3. Same TCP connection becomes a full-duplex, persistent binary/text channel—low framing overhead per message.

When to use WebSockets:

  • Chat, collaborative editing, live dashboards
  • Gaming or trading feeds needing bidirectional low latency
  • Thousands of concurrent push clients after one upgrade

When HTTP is enough:

  • REST CRUD, file upload/download, cacheable GETs
  • Stateless APIs behind CDNs
  • SSE (Server-Sent Events) for one-way server push over HTTP—simpler reconnection, works through many proxies, ideal for news feeds and log streams

Operational notes: WebSockets need sticky sessions or shared pub/sub (Redis) behind load balancers; idle timeouts and heartbeats prevent ghost connections.

A strong answer is:

HTTP fits request-response REST; WebSockets after a 101 upgrade give full-duplex push for chat and live dashboards—I pick SSE when only the server needs to push and proxies matter; I mention load-balancer stickiness for WebSocket farms.


Security, advanced topics, and final prep

DDoS — high-level mitigation?

Distributed Denial of Service — flood traffic exhausts bandwidth or server resources.

Mitigations:

Layer Technique
Edge CDN scrubbing, rate limits
Network BGP blackholing, Anycast absorption
App CAPTCHA, auth, request throttling

Distinguish volumetric (bits) vs application-layer (expensive HTTP requests).

A strong answer is:

DDoS defense layers edge absorption, filtering, and app rate limits—I do not rely on a single firewall rule alone.

QUIC and why it matters in 2026?

QUIC — transport on UDP combining:

  • TLS 1.3 integrated (fewer round trips)
  • Stream multiplexing without TCP HoL blocking
  • Connection migration by connection ID
  • Used by HTTP/3

Adoption growing on major browsers and CDNs—mention in senior full-stack loops.

A strong answer is:

QUIC is UDP-based transport with built-in TLS and smarter multiplexing—HTTP/3 adopts it to cut latency especially on lossy mobile networks.

Using OSI layers in interview answers?

Map symptoms to layers:

Symptom Likely layer
Link down LED L1 physical
ARP failures L2
No route to host L3
Connection refused L4 port closed
Connection timeout L4 firewall or routing
TLS cert error L6/7
HTTP 404 L7 app routing

Shows disciplined, layer-by-layer reasoning interviewers expect when traffic fails.

A strong answer is:

I state the layer first—timeout vs refused vs cert error narrows blame before touching application code.

What should you rehearse before computer networks interviews?

Checklist:

  • OSI and TCP/IP — layer names and protocol mapping
  • TCP vs UDP with examples
  • Three-way handshake and four-way close
  • DNS resolution chain and TTL
  • URL to page full narrative
  • HTTP vs HTTPS and TLS 1.3 at high level
  • HTTP/2 vs HTTP/3 / QUIC awareness
  • NAT, DHCP, ARP basics
  • L4 vs L7 load balancing
  • ping, traceroute, dig, curl -v toolkit
  • One unreachable site debug story
  • Operating system interviews for sockets and processes
  • Kubernetes interviews for Service/Ingress networking
  • Front end interviews for CORS and browser cache

A strong answer is:

I whiteboard URL flow weekly, run curl -v on a real site, and practice layered troubleshooting aloud until OSI becomes a habit not a mnemonic.


Pattern cheat sheet (quick reference)

Topic Key point
OSI 7 layers — know Application, Transport, Network, Data Link
TCP/IP 4 layers — practical internet stack
TCP Reliable, ordered, 3-way handshake
UDP Fast, unreliable — DNS, QUIC base
Port 443 HTTPS (TLS)
DNS Hierarchical, cached by TTL
NAT Private IP → public IP
HTTP/2 Multiplex on TCP
HTTP/3 QUIC on UDP
ping ICMP reachability (L3)
curl -v HTTP + TLS debug
502 Often LB ↔ backend issue

References

Computer networks interview prep

On-site prep


Summary

Networking interviews test whether you can walk through DNS → TCP → TLS → HTTP, compare TCP vs UDP with real services, and debug layer by layer. Whiteboard the URL flow and compare your answers to each section. Pair with operating system, Kubernetes, and front end prep when traffic crosses the stack.

Deepak Prasad

R&D Engineer

Founder of GoLinuxCloud with more than 15 years of expertise in Linux, Python, Go, Laravel, DevOps, Kubernetes, Git, Shell scripting, OpenShift, AWS, Networking, and Security. With extensive …