Computer Networks Lesson 6 of 6 ⏱️ 5 min read

Computer Networks Interview Questions

Common networking interview questions on OSI, TCP/UDP, DNS, HTTP, TLS, subnetting and load balancers, with answers.

Updated Oct 30, 2026

Computer networks interview questions

Networking questions appear in backend, DevOps and system design interviews. Strong answers connect protocols to real problems such as latency, timeouts and security.

1. Explain the OSI model.

A 7-layer conceptual model: physical, data link, network, transport, session, presentation, application. Each layer provides services to the one above. The internet actually uses the 4-layer TCP/IP model (link, internet, transport, application).

2. What is encapsulation?

Each layer adds its own header to data from the layer above as it goes down the stack (HTTP data → TCP segment → IP packet → Ethernet frame). The receiver strips the headers in reverse.

3. TCP vs UDP?

TCP is connection-oriented, reliable and ordered, with flow and congestion control — used for web, databases and SSH. UDP is connectionless with no delivery guarantees but minimal overhead — used for DNS, video calls, gaming and QUIC.

4. Describe the TCP three-way handshake.

The client sends SYN with its initial sequence number, the server replies SYN-ACK with its own sequence number and an acknowledgement, and the client sends ACK. Data can then flow. It costs one round trip, so connections should be reused.

5. How does TCP guarantee reliability?

Sequence numbers, acknowledgements, retransmission on timeout, checksums, flow control via the receive window, and congestion control.

6. What is head-of-line blocking?

When a lost packet forces later data to wait until it's retransmitted, even if that data belongs to other requests. HTTP/2 removed it at the HTTP layer but not at the TCP layer; HTTP/3 over QUIC removes it per stream.

7. What is an IP address and what is CIDR?

An IP address identifies a network interface. CIDR notation like 192.168.1.0/24 gives the number of network bits; a /24 has 2^8 = 256 addresses, 254 usable hosts in IPv4.

8. How many usable hosts are in a /27?

2^(32−27) = 32 addresses, minus network and broadcast = 30 usable hosts.

9. What are private IP addresses and NAT?

Private ranges (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16) aren't routed on the internet. NAT translates private source addresses/ports to a public IP so many devices share one address.

10. How does a router decide where to send a packet?

It looks up the destination in its routing table and uses the longest prefix match, falling back to the default route. Routes are learned via protocols like OSPF and BGP.

11. What is ARP?

Address Resolution Protocol maps an IP address to a MAC address on the local network by broadcasting a request and receiving the owner's reply.

12. How does DNS resolution work?

The stub resolver asks a recursive resolver, which (if not cached) queries a root server, then the TLD server, then the domain's authoritative server, and caches the answer for its TTL.

13. A vs CNAME vs MX records?

A maps a name to an IPv4 address (AAAA for IPv6). CNAME aliases one name to another. MX lists mail servers for the domain.

14. What happens when you type a URL into a browser?

URL parsing → DNS lookup → TCP (or QUIC) connection → TLS handshake and certificate validation → HTTP request → load balancer, web server and application processing → HTTP response → browser parses HTML/CSS, fetches resources, runs JS, lays out and paints. Mention caching at each step.

15. How does HTTPS work?

HTTP runs inside TLS. During the handshake, client and server exchange ephemeral key shares to derive symmetric session keys, and the server proves its identity with a CA-signed certificate. Traffic is then encrypted and integrity-protected.

16. What is forward secrecy?

Using ephemeral key exchange so that compromising the server's long-term private key later doesn't allow decrypting previously recorded sessions. TLS 1.3 requires it.

17. HTTP/1.1 vs HTTP/2 vs HTTP/3?

HTTP/1.1 is text-based with one request at a time per connection. HTTP/2 is binary with multiplexed streams and header compression over one TCP connection. HTTP/3 runs over QUIC (UDP), removing TCP head-of-line blocking, combining the transport and TLS handshakes, and supporting connection migration.

18. Which HTTP methods are idempotent?

GET, HEAD, PUT, DELETE and OPTIONS. POST is not; PATCH usually isn't.

19. Layer 4 vs layer 7 load balancer?

A layer 4 load balancer routes by IP and port without reading the content — fast and protocol-agnostic. A layer 7 load balancer understands HTTP, so it can route by path, host or headers, terminate TLS and add features like rate limiting.

20. What is a CDN?

A Content Delivery Network caches content in edge locations close to users, reducing latency and origin load, and often provides TLS termination and DDoS protection.

21. What is CORS?

Cross-Origin Resource Sharing is a browser mechanism where servers use headers like Access-Control-Allow-Origin to permit pages from other origins to read their responses. It's enforced by browsers, not servers.

22. How would you debug "the API is slow"?

Measure each phase: DNS time, TCP connect, TLS handshake, time to first byte and download (e.g. curl -w timings or browser dev tools). Then check server-side latency, database queries, connection reuse and payload size.

Practice tip

Explain "what happens when you type a URL" out loud in under three minutes, naming each protocol and one thing that could fail at each step. It's one of the most common networking interview questions.

Finished this lesson?
Tick it off to track your Computer Networks progress.