The 50 computer networks questions interviewers actually ask, with direct answers, protocol details, layered-model comparisons, and what the interviewer is listening for. Grouped for freshers, intermediate, and experienced rounds.
50 questions with answersKey Takeaways
Computer networks is the branch of computer science that deals with how devices talk to each other and move data reliably across links, from a cable between two machines to the global internet. It's built on layered thinking: each layer solves one job and hands off to the next, so the physical medium, the way bytes get framed and addressed, how packets are routed, how a connection stays reliable, and how applications like the web and email speak are all separable concerns. The OSI model gives you seven layers for reasoning and teaching; the TCP/IP model gives you the four layers that the real internet runs on. In interviews, networking questions probe whether you can trace what actually happens: what occurs when you type a URL and hit enter, why TCP is reliable and UDP isn't, how DNS turns a name into an address, and what a subnet mask really does. The MDN overview of HTTP is a solid canonical reference for the application-layer half of that story. This page collects the 50 questions that come up most, each with a direct answer plus the protocol detail an interviewer expects; pair it with our AI interview preparation guides for the live-round format, since the first technical screen is increasingly an AI-driven one.
Watch: Computer Networking in 100 Seconds
Video: Computer Networking in 100 Seconds (Fireship, YouTube)
Test yourself and earn a certificate
10 quick questions. Score 70%+ to download your Computer Networks certificate.
The fundamentals every entry-level round checks: the layered models, TCP vs UDP, IP addressing, DNS, and the basic devices. If any answer here surprises you, that's your study list.
A computer network is a set of devices connected so they can share data and resources. The connection can be wired or wireless, and the devices range from two laptops to millions of machines on the internet.
Networks let devices exchange messages, share files and printers, and reach services like websites and email. They're organized in layers so each concern, the physical link, addressing, routing, and the application, can be handled separately.
Key point: Keep the opening answer plain and correct. Interviewers use it to check you can define a concept cleanly before they go deeper.
Watch a deeper explanation
Video: Computer Networking Course: Network Engineering (CompTIA Network+ Exam Prep) (freeCodeCamp.org, YouTube)
They're networks classified by geographic size. A LAN (Local Area Network) covers a small area like a home, office, or building. A MAN (Metropolitan Area Network) spans a city or campus. A WAN (Wide Area Network) covers large distances, potentially countries; the internet is the largest WAN.
The practical difference is scale and ownership: a LAN is usually owned by one organization and is fast and cheap over short distances, while a WAN links separate networks over long distances, often over links you lease rather than own.
| Type | Scope | Typical example |
|---|---|---|
| LAN | One building or office | Home or office network |
| MAN | A city or large campus | City-wide fiber network |
| WAN | Countries or the globe | The internet |
Key point: Anchor each one to size and a real example, and call the internet the biggest WAN. That concrete mapping is all this warm-up question is checking.
From bottom to top the seven layers are physical, data link, network, transport, session, presentation, and application. Each layer handles one job and passes data to the next, so a change at one layer doesn't force changes everywhere else and each can be reasoned about on its own.
Physical moves raw bits, data link frames them and handles MAC addressing, network routes packets by IP, transport gives end-to-end delivery (TCP or UDP), session manages dialogs, presentation handles formatting and encryption, and application is where protocols like HTTP live.
Key point: Don't just recite the names. Naming one job and one protocol per layer is what convinces the interviewer you understand the model, not a mnemonic.
Watch a deeper explanation
Video: OSI Model Explained: Open System Interconnection, the 7 layers (TechTerms, YouTube)
OSI is a seven-layer reference model built for teaching and for reasoning about where a problem lives. TCP/IP is a four-layer model that the actual internet runs on, so it maps directly to real protocols.
TCP/IP combines OSI's physical and data link into one link layer, and it merges session, presentation, and application into a single application layer. Use OSI to explain and locate problems; TCP/IP is the stack that's really implemented.
| OSI | TCP/IP | |
|---|---|---|
| Layers | 7 | 4 |
| Role | Reference and teaching | Real internet stack |
| Application side | 3 layers | 1 combined layer |
Key point: Say 'OSI is the map, TCP/IP is the terrain'. That one line shows you understand why both models exist.
TCP is connection-oriented and reliable: it sets up a connection with a handshake, numbers and acknowledges bytes, retransmits what's lost, and delivers data in order. That reliability adds overhead and latency, since every segment has to be tracked and confirmed before the stream is considered complete.
UDP is connectionless and unreliable by design: it just sends datagrams with no handshake, no acknowledgment, and no ordering. That makes it fast and lightweight, which is why real-time video, voice, gaming, and DNS lookups often use UDP where a lost packet matters less than speed.
| Aspect | TCP | UDP |
|---|---|---|
| Connection | Connection-oriented (handshake) | Connectionless |
| Reliability | Guaranteed, ordered delivery | No delivery guarantee |
| Overhead | Higher | Lower |
| Good for | Web, email, file transfer | Video, voice, gaming, DNS |
Key point: each protocol maps to a real use: TCP for web and files, UDP for streaming and DNS. Matching the protocol to the workload is the mature answer.
Watch a deeper explanation
Video: Computer Networking Full Course: OSI Model Deep Dive with Real Life Examples (Kunal Kushwaha, YouTube)
An IP address is a numeric label that identifies a device on a network so packets can be routed to it. IPv4 addresses are 32 bits, written as four decimal octets like 192.168.1.10, giving about 4.3 billion addresses.
IPv6 uses 128-bit addresses written in hexadecimal, giving a practically unlimited pool, which is why it exists: IPv4 ran out. IPv6 also simplifies the header and builds in features that were add-ons in IPv4. Both still coexist today.
Key point: The 'why IPv6' answer is address exhaustion. Naming that, plus 32 vs 128 bits, is enough to pass this one cleanly.
A public IP is globally routable on the internet and must be unique. A private IP comes from reserved ranges (like 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16) used inside local networks and is not routable on the public internet.
Many devices on a home or office LAN share one public IP using NAT: the router translates private addresses to the single public one on the way out. That's why your laptop's 192.168.x.x address is private while the internet sees your router's public address.
Key point: private IPs connects to NAT. Explaining how many private addresses share one public IP shows you understand why the split exists.
A subnet mask splits an IP address into a network portion and a host portion. The bits set to 1 mark the network part; the bits set to 0 mark the host part. For 255.255.255.0, the first three octets are the network and the last is the host.
Its job is to let a device decide whether a destination is on the same local network (deliver directly) or on a different one (send to the router). CIDR notation like /24 is just a shorthand for how many leading bits are the network part.
Key point: Explain the practical use: the mask decides local-vs-remote delivery. That's more useful than reciting bit counts alone.
DNS (Domain Name System) is the internet's directory: it translates human-readable names like example.com into the IP addresses machines use to connect. Without it, you'd have to remember numeric addresses for every site, and any server changing its IP would break every link pointing at it.
It's a distributed hierarchy of servers, so no single machine holds every name. When you look up a name, the resolution walks from a root server to the top-level domain server to the domain's authoritative server, and results get cached along the way to keep it fast.
Key point: Call DNS 'the internet's phone book' and mention caching. Both come up as follow-ups and show you know it's distributed, not one server.
DHCP (Dynamic Host Configuration Protocol) automatically assigns IP configuration to devices when they join a network: an IP address, subnet mask, default gateway, and DNS servers. Without it, every device would need manual configuration, which doesn't scale past a handful of machines and invites duplicate-address mistakes.
When a device connects, it broadcasts a request, a DHCP server offers an address from its pool, the device accepts, and the server leases it for a set time. The classic sequence is discover, offer, request, acknowledge, often called DORA.
Key point: Naming the DORA steps (discover, offer, request, acknowledge) is a quick way to show you know the actual exchange, not just the acronym.
HTTP is the protocol browsers and servers use to exchange web pages, and it sends data in plaintext. HTTPS is HTTP running over TLS, so the connection is encrypted, the data can't be read or tampered with in transit, and the server's identity is verified with a certificate.
HTTP uses port 80, HTTPS uses port 443. The MDN overview of HTTP is the standard reference here. In practice everything uses HTTPS now, because plaintext HTTP leaks credentials and content to anyone on the path.
Key point: Say HTTPS is 'HTTP over TLS', not a separate protocol. That precise phrasing is what the interviewer is listening for.
A hub is a dumb repeater at the physical layer: it copies every incoming frame out of every other port, which wastes bandwidth and causes collisions. A switch works at the data link layer: it learns MAC addresses and forwards a frame only to the port where its destination lives.
A router works at the network layer: it connects different networks and forwards packets between them based on IP addresses, choosing a path toward the destination. In short: hub floods, switch forwards within a network by MAC, router routes between networks by IP.
| Device | OSI layer | Forwards by |
|---|---|---|
| Hub | Physical (1) | Nothing; repeats to all ports |
| Switch | Data link (2) | MAC address, to one port |
| Router | Network (3) | IP address, between networks |
Key point: The clean summary is 'hub floods, switch forwards by MAC, router routes by IP'. Mapping each to its layer seals the answer.
Watch a deeper explanation
Video: Hub, Switch, and Router Explained: What's the difference? (PowerCert Animated Videos, YouTube)
A MAC address is a hardware identifier burned into a network interface, unique to that device, and used for delivery on the local network segment at the data link layer. An IP address is a logical address at the network layer, used to route packets across networks and it can change depending on the network you join.
The analogy: the IP address is like the street address that gets a letter to the right building across the world, while the MAC address is like the specific mailbox that gets it to the right device on the final local hop. ARP is what links the two.
Key point: The 'IP routes across networks, MAC delivers on the local link' distinction, plus naming ARP as the link, is exactly what this checks.
A protocol is an agreed set of rules for how devices format, transmit, and interpret data so they can communicate. Both sides follow the same rules, which is what lets machines from different vendors talk to each other.
Protocols define things like message format, the order of exchanges, error handling, and addressing. Examples by layer: Ethernet at the link layer, IP at the network layer, TCP and UDP at the transport layer, and HTTP, DNS, and SMTP at the application layer.
Key point: Give one example per layer, not just a definition. Naming a protocol at each layer proves you see protocols as a stack, which is what the question needs.
They're the same data described at different layers, each wrapping the one above it. A segment is the transport-layer unit (TCP segment or UDP datagram). Wrap it with an IP header and it's a packet at the network layer. Wrap that with a link-layer header and trailer and it's a frame on the wire.
This wrapping is called encapsulation: as data goes down the stack, each layer adds its own header; as it goes up on the receiving side, each layer strips its header off. Using the right term for the right layer signals you actually understand the model.
Key point: Getting the terms right per layer (segment, packet, frame) and naming encapsulation is a small detail that indicates real understanding.
Bandwidth is how much data a link can carry per unit of time, measured in bits per second. Latency is how long a single bit takes to travel from source to destination, measured in milliseconds. They're independent: a link can be high-bandwidth but high-latency.
The common analogy is a highway: bandwidth is how many lanes it has (how much can flow at once), while latency is how long the drive takes end to end. A satellite link can move lots of data (high bandwidth) yet feel slow because each bit travels a long way (high latency).
Key point: Keep bandwidth and latency separate: 'lanes vs travel time'. Conflating them is the classic slip this question is designed to catch.
Topology is the shape of how devices are connected. Star connects every device to a central switch or hub, which is the standard for modern LANs because one failed link only drops one device. Bus runs everything on one shared cable, mesh links devices directly to many others, and ring passes traffic around a loop.
Each trades cost against resilience. Star is cheap and easy to troubleshoot but depends on the central device. Mesh is expensive to wire but survives many link failures, which is why the internet's backbone is roughly a partial mesh. Bus and ring are mostly historical now.
| Topology | Strength | Weakness |
|---|---|---|
| Star | Easy to manage, one failure is isolated | Central device is a single point of failure |
| Mesh | Very resilient, many redundant paths | Expensive, lots of links to wire |
| Bus / Ring | Simple, low cabling | One break can disrupt the whole segment |
Key point: Anchor on why star won for LANs: cheap, and one bad link drops only one device. That reasoning matters more than listing every shape.
These describe how many recipients a message targets. Unicast is one sender to one receiver, the normal case for most traffic like loading a web page. Broadcast is one sender to every device on the local network, which is how ARP and some discovery protocols work.
Multicast is one sender to a specific group of interested receivers, which is far more efficient than broadcasting to everyone when only some devices care. Streaming a video feed to many subscribers at once is a classic multicast use. Broadcast doesn't cross routers; it stays inside the local segment.
Key point: Note that broadcast stays local and doesn't cross routers. That boundary detail is a frequent follow-up and ties back to broadcast domains.
Mapping protocols to layers is a standard drill, so it helps to have a few anchors ready. the question needs to see you a protocol name connects to the job its layer does, not just recite a list. Getting a couple wrong signals shaky fundamentals.
The reliable anchors: Ethernet and ARP at the data link layer, IP and ICMP at the network layer, TCP and UDP at the transport layer, and HTTP, DNS, SMTP, and FTP up at the application layer. When unsure, reason from the job: if it addresses hosts across networks it's layer 3, if it delivers end to end it's layer 4.
| Layer | Example protocols |
|---|---|
| Application (7) | HTTP, DNS, SMTP, FTP |
| Transport (4) | TCP, UDP |
| Network (3) | IP, ICMP |
| Data link (2) | Ethernet, ARP |
Key point: When you blank on a protocol's layer, reason from its job out loud. Showing that method beats memorization and is what the interviewer actually rewards.
For candidates with coursework or hands-on time: the TCP handshake, subnetting, routing, NAT, and the judgment questions that separate people who memorized protocols from people who understand them.
It's how TCP opens a reliable connection. The client sends a SYN with its initial sequence number. The server replies with a SYN-ACK: its own SYN plus an acknowledgment of the client's. The client sends a final ACK, and the connection is established so data can flow.
The point of the exchange is that both sides agree on starting sequence numbers and confirm each other can send and receive. Closing the connection uses a similar FIN/ACK exchange, usually described as a four-way handshake.
The TCP three-way handshake
Connection teardown mirrors this with a FIN/ACK exchange, commonly called a four-way handshake.
Key point: Say why it's three steps: both sides must confirm send and receive and agree on sequence numbers. Reciting SYN, SYN-ACK, ACK without the 'why' is weaker.
Subnetting divides a larger network into smaller ones by borrowing bits from the host portion of an address to create more network segments. The subnet mask (or CIDR prefix like /26) decides how many bits are network and how many are host, which sets how many subnets and how many hosts per subnet you get.
We subnet to reduce broadcast traffic, improve security by isolating segments, and use address space efficiently instead of wasting a huge flat range. For example, a /24 has 256 addresses; splitting it into four /26 subnets gives four segments of 64 addresses each.
Key point: Be ready to compute usable hosts for a given prefix. Knowing a /30 gives two usable hosts (point-to-point links) is a common quick check.
First the resolver checks caches: the browser, the OS, then the configured DNS resolver. On a miss, the recursive resolver walks the hierarchy: it asks a root server, which points to the top-level domain server (like .com), which points to the domain's authoritative name server, which returns the actual IP.
The resolver caches the answer with a TTL so repeat lookups are instant until it expires. This hierarchy and caching is what makes DNS scale to the whole internet without any single server knowing every name.
Key point: Mention TTL and caching, not just the root/TLD/authoritative chain. The caching layer is what interviewers probe when they ask why DNS is fast.
The browser resolves the domain to an IP via DNS, then opens a TCP connection to the server (a three-way handshake), and for HTTPS performs a TLS handshake to set up encryption. Then it sends an HTTP request, usually a GET for the page.
The server responds with HTML, and the browser parses it, discovers linked assets (CSS, JavaScript, images), fetches those over more requests, builds the DOM and render tree, and paints the page. Under the hood, IP routing moves every one of those packets across networks to the server and back.
What happens when you type a URL and press enter
This one walkthrough touches DNS, TCP, TLS, HTTP, and rendering, which is why interviewers love it.
Key point: This is the classic full-stack networking question. Hit every layer in order, DNS, TCP, TLS, HTTP, render, and you demonstrate the whole stack in one answer.
NAT (Network Address Translation) rewrites IP addresses as packets pass through a router. The most common form maps many private addresses on a LAN to one public address, tracking connections so replies get back to the right internal device.
It exists mainly to conserve scarce IPv4 addresses: a whole home or office shares one public IP. A side effect is a basic layer of privacy and isolation, since internal addresses aren't directly reachable from outside, though NAT isn't a real firewall.
Key point: Frame NAT's main purpose as IPv4 conservation, and note it's not a firewall. Overselling NAT as security is a common mistake here.
Flow control protects the receiver: it stops a fast sender from overwhelming a slow receiver's buffer, managed with the receiver's advertised window. Congestion control protects the network: it stops senders from overwhelming the links and routers between them.
They solve different problems with different signals. Flow control uses the receive window the receiver advertises. Congestion control uses algorithms like slow start and congestion avoidance that react to signs of loss or delay in the network, adjusting how much the sender puts in flight.
| Flow control | Congestion control | |
|---|---|---|
| Protects | The receiver's buffer | The network's capacity |
| Signal | Receiver's advertised window | Packet loss / delay |
| Mechanism | Sliding window | Slow start, congestion avoidance |
Key point: The one-line distinction is 'flow control protects the receiver, congestion control protects the network'. Mixing them up is the trap.
The router looks at the packet's destination IP and consults its routing table, which lists networks and the next hop to reach each. It picks the most specific matching route (longest prefix match) and forwards the packet to that next hop, decrementing the TTL as it goes.
Routing tables are built either statically (an admin configures routes) or dynamically with routing protocols. If no route matches, the packet goes to the default route (the gateway of last resort), and if even that's missing, it's dropped.
Key point: Naming 'longest prefix match' and the default route shows you know how forwarding actually decides, not just that a table exists.
OSPF (Open Shortest Path First) is an interior gateway protocol: it routes within a single organization's network (an autonomous system), building a map of the topology and computing shortest paths. It converges fast and reacts to link changes inside your network.
BGP (Border Gateway Protocol) is the exterior protocol that routes between autonomous systems, and it's what stitches the whole internet together. BGP chooses paths based on policy and the sequence of networks a route passes through, not just shortest distance, because it deals with business relationships between providers.
| OSPF | BGP | |
|---|---|---|
| Scope | Within one network (interior) | Between networks (exterior) |
| Decides by | Shortest path / link cost | Policy and AS path |
| Used for | Internal routing | Routing the internet |
Key point: The split is 'OSPF inside an organization, BGP between organizations'. Adding that BGP is policy-driven is the intermediate-level nuance.
A port is a number that identifies a specific service or process on a device, so one machine with one IP can run many services at once (web on 443, SSH on 22, DNS on 53). The transport layer uses ports to deliver data to the right application.
A socket is the combination of an IP address and a port, plus the protocol, that identifies one endpoint of a connection. A TCP connection is uniquely identified by the four-tuple of source IP, source port, destination IP, and destination port.
Key point: Knowing a connection is identified by the four-tuple (source and destination IP and port) is the detail that separates a solid answer from a vague one.
A handful of well-known ports come up constantly, so it's worth having them memorized cold. They span the application-layer services you interact with every day, from web traffic to remote login to name resolution to sending mail, and each one identifies a specific service on a host.
Interviewers sometimes rapid-fire these to check your fluency, so know at least HTTP, HTTPS, SSH, DNS, and SMTP without hesitation.
| Port | Protocol | Use |
|---|---|---|
| 22 | SSH | Secure remote login |
| 53 | DNS | Name resolution |
| 80 | HTTP | Web (plaintext) |
| 443 | HTTPS | Web (encrypted) |
| 25 / 587 | SMTP | Sending email |
Key point: Have HTTP (80), HTTPS (443), SSH (22), and DNS (53) instant. Fumbling the everyday ports indicates someone who hasn't touched real networking.
The UDP header is tiny, just source port, destination port, length, and checksum, eight bytes total. That's all UDP needs because it doesn't track connections or guarantee delivery, so there's nothing to record between packets and no state to carry from one datagram to the next.
The TCP header is larger (20 bytes minimum) because it carries what reliability needs: sequence and acknowledgment numbers for ordering and retransmission, a window size for flow control, and control flags like SYN, ACK, and FIN for connection state. The header size difference is a direct reflection of what each protocol promises.
Key point: the header size maps to the guarantee: TCP's bigger header carries sequence numbers, window, and flags. That cause-and-effect framing is what makes the answer stronger.
ICMP (Internet Control Message Protocol) carries control and error messages for IP, like 'destination unreachable' or 'time exceeded'. It's not for carrying application data; it's how the network reports problems back to senders and answers the diagnostic probes that tools like ping and traceroute rely on.
Ping sends ICMP echo requests and times the echo replies to measure reachability and round-trip time. Traceroute sends packets with increasing TTL values: each router that decrements TTL to zero returns an ICMP time-exceeded message, which reveals each hop along the path.
# is the host reachable, and how fast?
ping example.com
# what path do packets take to get there?
traceroute example.comKey point: Explaining the TTL trick behind traceroute (each hop replies when TTL hits zero) shows you understand the mechanism, not just the command name.
ARP (Address Resolution Protocol) finds the MAC address for a known IP on the local network. When a device wants to send to a local IP but doesn't know its MAC, it broadcasts an ARP request asking who has that IP; the owner replies with its MAC address.
The result is cached in an ARP table for a while so the device doesn't ask again for every packet. ARP only works within a single local network segment; to reach a device on another network, the sender uses ARP to find the router's MAC, and the router takes it from there.
Key point: The key insight is ARP resolves IP to MAC only on the local segment, and for remote hosts you ARP for the router. That routing nuance is what's being tested.
A collision domain is the set of devices whose frames can collide on a shared medium. Hubs put everything in one collision domain; switches break it up because each switch port is its own collision domain, which is why switches replaced hubs.
A broadcast domain is the set of devices that receive each other's broadcast frames. A switch forwards broadcasts to all its ports, so a plain switched network is one broadcast domain. Routers and VLANs are what separate broadcast domains, which is one reason we subnet and use VLANs.
Key point: Say switches break up collision domains but not broadcast domains, and routers/VLANs break up broadcast domains. That precise pairing is the whole point of the question.
TLS sets up an encrypted, authenticated connection before any HTTP data flows. The client and server agree on a protocol version and cipher, the server presents its certificate so the client can verify its identity against a trusted authority, and they exchange keying material to derive a shared session key.
Once the handshake finishes, both sides use fast symmetric encryption with that session key for the actual data. Modern TLS uses key exchange methods that give forward secrecy, so capturing traffic today and stealing the server's key later still can't decrypt past sessions.
Key point: Mention certificate verification for identity and forward secrecy for the key exchange. Those two points show you understand what TLS actually protects against.
GET requests a resource and puts its parameters in the URL query string, so it should only read data, never change it. Because GET is safe and idempotent, browsers and caches can repeat it freely and it shows up in history and logs.
POST sends data in the request body to create or change something on the server, so it's not idempotent: submitting twice can create two records, which is why browsers warn before resending a POST. The rule of thumb is GET to read, POST (or PUT/PATCH/DELETE) to write.
| GET | POST | |
|---|---|---|
| Data location | URL query string | Request body |
| Purpose | Read a resource | Create or change a resource |
| Idempotent | Yes | No |
| Cacheable | Yes | Not by default |
Key point: Frame it as 'GET reads, POST writes' and mention idempotency. Saying POST just hides data in the body while GET shows it misses the real semantic difference.
advanced rounds probe protocol internals, performance, security, and production scars. Expect every answer here to draw a follow-up about trade-offs and failure modes.
TCP keeps a congestion window that limits how much unacknowledged data is in flight. It starts small and uses slow start, doubling the window each round trip until it hits a threshold or sees loss. After that it shifts to congestion avoidance, growing the window slowly and linearly to probe for more capacity gently.
When loss signals congestion, classic TCP cuts the window (fast retransmit and fast recovery for a single loss, a larger cut for a timeout). Newer algorithms like CUBIC scale better on high-bandwidth links, and BBR models bandwidth and round-trip time directly instead of treating loss as the only congestion signal.
Key point: Naming slow start, congestion avoidance, and a modern algorithm like CUBIC or BBR signals you understand congestion control as an evolving system, not one fixed rule.
HTTP/1.1 sends one request at a time per connection and suffers head-of-line blocking, so browsers open many connections to work around it. HTTP/2 multiplexes many streams over one TCP connection and adds header compression, but a single lost TCP packet still stalls all streams because TCP delivers in order.
HTTP/3 moves off TCP onto QUIC, which runs over UDP and handles streams independently, so one lost packet only blocks its own stream, not the others. QUIC also folds the TLS handshake into the connection setup, cutting round trips. The through-line is each version attacking head-of-line blocking at a lower layer.
| Version | Transport | Key change |
|---|---|---|
| HTTP/1.1 | TCP | One request at a time per connection |
| HTTP/2 | TCP | Multiplexed streams, header compression |
| HTTP/3 | QUIC over UDP | Independent streams, faster setup |
Key point: The unifying theme is head-of-line blocking pushed lower each version, ending at QUIC. Framing it as one problem attacked repeatedly beats listing features.
A load balancer spreads incoming traffic across a pool of backend servers and removes unhealthy ones via health checks, so no single server is overwhelmed and one failure doesn't take the service down. It's the front door that makes horizontal scaling and zero-downtime deploys possible.
Layer 4 load balancing routes by IP and port without inspecting the payload, so it's fast and protocol-agnostic. Layer 7 load balancing understands the application protocol (HTTP), so it can route by URL path, host, or headers, terminate TLS, and do content-based decisions, at the cost of more processing per request.
Key point: The L4-vs-L7 trade is speed versus smarts: L4 routes by IP/port, L7 routes by HTTP content. Knowing when each fits is the production signal.
A CDN (Content Delivery Network) is a fleet of servers spread across many locations that cache and serve content close to users. When someone requests an asset, they're routed to a nearby edge server instead of the distant origin, which cuts latency and offloads traffic from the origin.
It solves latency (physics: closer is faster), scale (the edge absorbs traffic spikes so the origin doesn't melt), and availability (content stays served even if the origin is busy). CDNs handle static assets well and increasingly cache dynamic content and run logic at the edge. The hard parts are cache invalidation and keeping cached content fresh.
Key point: Lead with 'serve content close to the user to cut latency', then name cache invalidation as the hard part. That balance of benefit and cost indicates experienced.
A firewall controls traffic by matching packets against rules and allowing or dropping them, based on things like source and destination IP, port, and protocol. It's the boundary control between networks of different trust levels.
A stateless firewall evaluates each packet in isolation against its rules, with no memory of prior packets. A stateful firewall tracks active connections, so it can allow return traffic for a connection it already permitted without a separate rule, which is both more convenient and more secure. Modern next-generation firewalls add application-aware inspection on top.
| Stateless | Stateful | |
|---|---|---|
| Tracks connections | No | Yes |
| Return traffic | Needs explicit rules | Allowed automatically |
| Overhead | Lower | Higher (keeps state) |
Key point: The stateful firewall's edge is tracking connections so return traffic is handled automatically. Explaining why that's safer, not just different, is The production-ready answer.
A VPN (Virtual Private Network) creates an encrypted tunnel between a client and a VPN server over the public internet. Traffic inside the tunnel is encrypted and encapsulated, so anyone on the path sees only the outer packets to the VPN server, not the actual destinations or contents.
It's used to reach a private network remotely as if you were local (site-to-site or remote-access) and to shield traffic on untrusted networks. The trade-offs are the extra latency of routing through the VPN server and the trust you place in whoever runs it, since they can see your decrypted traffic at the exit.
Key point: Note the trust and latency cost of routing through the VPN provider. Acknowledging that the exit point sees decrypted traffic shows you understand the real threat model.
The everyday set: A maps a name to an IPv4 address, AAAA to an IPv6 address, and CNAME aliases one name to another. MX names the mail servers for a domain, TXT holds arbitrary text often used for verification and email security (SPF, DKIM), and NS delegates a zone to its authoritative name servers.
Knowing these matters for real work: a misconfigured MX breaks email, a wrong CNAME or missing AAAA breaks reachability, and TXT records are where SPF, DKIM, and domain verification live. Each record also carries a TTL controlling how long resolvers cache it.
| Record | Maps / holds |
|---|---|
| A / AAAA | Name to IPv4 / IPv6 address |
| CNAME | Name to another name (alias) |
| MX | Mail servers for the domain |
| TXT | Text: SPF, DKIM, verification |
| NS | Authoritative name servers for the zone |
Key point: Being able to say which record breaks which service (MX for mail, A/AAAA for reachability) proves you've actually operated DNS, not just defined it.
The recurring ones: a DDoS floods a target with traffic to exhaust its capacity, a man-in-the-middle intercepts traffic between two parties, DNS spoofing feeds a resolver false answers, and ARP spoofing poisons a local network's IP-to-MAC mapping to redirect traffic.
Defenses layer up: TLS everywhere defeats passive interception and detects tampering, DNSSEC signs DNS answers to block spoofing, rate limiting and upstream scrubbing absorb DDoS, and network segmentation plus monitoring limit the blast radius of a local attack. The principle is defense in depth, because any single control can be bypassed.
Key point: Pair each attack with its defense (TLS for MITM, DNSSEC for spoofing) rather than listing threats. Matching problem to mitigation is what a security-minded interviewer wants.
QUIC is a transport protocol built on UDP that underpins HTTP/3. It provides reliable, multiplexed, encrypted streams, essentially reimplementing TCP's reliability plus TLS's security in user space on top of UDP, which lets it evolve without waiting on operating-system kernel changes.
It was created to fix TCP's limits for the modern web: TCP's in-order delivery causes head-of-line blocking across independent streams, and its handshake plus a separate TLS handshake costs round trips. QUIC handles streams independently so one lost packet doesn't stall the rest, and it folds encryption into connection setup, cutting startup latency, with connection migration that survives a network change like Wi-Fi to cellular.
Key point: The strong points are user-space evolvability, independent streams, and connection migration. Naming why TCP couldn't just be patched shows deep transport-layer understanding.
Start by cutting distance and round trips, because those dominate. Put content close to users with a CDN or edge nodes, reuse connections instead of opening new ones per request, and reduce the number of round trips (connection reuse, HTTP/2 or HTTP/3, TLS session resumption). Distance is bounded by the speed of light, so serving from nearby is the biggest lever.
Then trim the rest: compress responses, cache aggressively with sensible invalidation, batch small requests, and move work closer to the user or precompute it. Measure with real percentiles (p95, p99), not averages, because tail latency is what users actually feel, and one slow dependency or an extra handshake round trip is often the culprit.
Where a request spends time: relative latency by source
Orders of magnitude, not exact figures. A cross-continent round trip dominates, which is why moving content closer (a CDN) and cutting round trips matters most.
Key point: Anchor the answer in 'cut distance and round trips first, measure with p99'. Jumping to micro-optimizations before addressing round trips is the junior instinct.
A socket is the programming interface to the transport layer. A TCP server creates a socket, binds it to an address and port, listens, and accepts incoming connections, each accept returning a new socket for that client. The client creates a socket and connects to the server's address and port, then both read and write bytes over their sockets.
The key mental model is that a TCP connection is a byte stream, not messages, so the application must frame its own messages (length prefixes or delimiters) because reads can return partial or coalesced data. UDP sockets skip the connection setup and send discrete datagrams instead, which is why UDP code looks simpler but shifts reliability onto the application.
# minimal TCP server
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind(("0.0.0.0", 8080))
s.listen()
conn, addr = s.accept() # blocks until a client connects
data = conn.recv(1024) # a byte stream, not a messageKey point: The insight that scores is 'TCP is a byte stream, so you must frame your own messages'. Candidates who assume one recv equals one message get caught here.
Clarify first: what protocol, are connections long-lived (like websockets) or short, what's the read/write pattern, and what latency does the business need. Then lay out the shape: stateless application servers behind load balancers so you scale horizontally, with connection state pushed into shared stores so any server can handle any request. For huge connection counts, use event-driven, non-blocking I/O (epoll-style) so one server holds many connections without a thread each.
Then handle the parts that don't scale by adding boxes: use a CDN and edge termination to keep long-haul traffic down, shard or replicate the data tier, add caching for hot reads, and spread across availability zones and regions for resilience. The structure that scores is clarify, scale stateless horizontally, offload state and connections, protect the data tier, each choice justified by the requirements you asked for.
Key point: Open by asking clarifying questions and mention non-blocking I/O for the connection count. Jumping straight to 'add more servers' without addressing per-connection cost underperforms on this prompt.
Plain HTTP is request-response: the client asks, the server answers, and the connection is done. That's a poor fit for real-time updates, because the client has to keep polling to ask 'anything new yet?'. WebSockets fix that with a single long-lived, full-duplex connection where either side can send a message any time.
The connection starts as an HTTP request with an Upgrade header, then switches protocols and stays open. Reach for WebSockets when you need low-latency two-way updates: chat, live dashboards, collaborative editing, multiplayer games. For occasional server-to-client updates only, Server-Sent Events are a simpler one-way alternative.
Key point: Explain the HTTP Upgrade that starts a WebSocket, and offer Server-Sent Events for one-way updates. Knowing the simpler alternative shows you pick the right tool, not the trendy one.
Work up the stack so you isolate the layer instead of guessing. First confirm local connectivity: does the machine have a valid IP and can it reach its gateway. Then test DNS with nslookup or dig, because a name that won't resolve looks identical to a dead server from the browser.
If the name resolves, ping the IP and run traceroute to see whether packets reach the server and where they stop. Then test the application directly with curl to check the port, the TLS handshake, and the HTTP status code. Each step rules out one layer, so by the end you've located the fault rather than swapping parts at random.
nslookup example.com # does the name resolve?
ping 93.184.216.34 # is the server reachable?
traceroute example.com # where does the path break?
curl -v https://example.com # port, TLS, and HTTP statusTroubleshooting 'the site won't load' from the bottom up
Working layer by layer isolates the fault fast instead of guessing, which is exactly the method the question needs to see.
Key point: Show the bottom-up method (link, DNS, reachability, application), not a random tool list. The systematic isolation is the whole point of this question.
Both models describe networking as layers, but they serve different purposes. OSI is a seven-layer reference model built for teaching and for reasoning cleanly about where a problem lives. TCP/IP is the four-layer model the actual internet was built on, so it maps directly to real protocols. Knowing where they line up, and where OSI splits a job that TCP/IP keeps together, is a standard opening question. The key point to say out loud: OSI is the map you reason with, TCP/IP is the terrain that ships packets.
| Aspect | OSI model | TCP/IP model |
|---|---|---|
| Number of layers | 7 (physical up to application) | 4 (link, internet, transport, application) |
| Purpose | Reference model for teaching and diagnosis | The stack the real internet runs on |
| Application handling | Split into application, presentation, session | One combined application layer |
| Link and physical | Two separate layers | Combined into one link layer |
| Where it's used | Explaining and locating problems | Actual protocol design and implementation |
Prepare in layers, literally, and practice tracing a request end to end out loud. Most networking rounds move from definition questions to a trace-the-packet walkthrough to a scenario or troubleshooting discussion, so rehearse each stage rather than only memorizing definitions.
The typical networking interview flow
Earlier rounds increasingly run as AI-driven technical interviews. The concepts on this page are what gets probed at every stage.
10 questions, about 6 minutes. Score 70% or higher to earn a shareable certificate.
Hyring builds the AI Coding Interviewer that runs live technical rounds in 20+ languages for 5,000+ hiring teams. These Computer Networks questions and scoring notes reflect what actually gets asked and evaluated inside the interviews we host.
See how the AI Coding Interviewer works