Interview Q&A / Computer Networks
Computer Networks interview questions
What happens when you open a website, TCP vs UDP, DNS and HTTP.
Prefer rapid revision? Practise Computer Networks short interview answers →
- How does a router choose between several matching routes? Explain longest prefix match.
The router picks, among all table entries that contain the destination address, the one with the longest prefix (most specific). A /24 beats a /16, which beats a /8, and 0.0.0.0/0 is the last-resort default route.
IntermediateQuick answer1 min read - What changes in a packet as it passes through routers?
The IP source and destination stay the same (without NAT), but each router decrements the TTL by 1 and the Ethernet frame is rebuilt with new source and destination MAC addresses for the next link.
IntermediateQuick answer1 min read - What is route summarization? Summarize 192.168.0.0/24 and 192.168.1.0/24.
Summarization replaces several contiguous routes with one shorter-prefix route. 192.168.0.0/24 and 192.168.1.0/24 combine into 192.168.0.0/23, which covers 192.168.0.0 to 192.168.1.255, so routers keep one entry instead of two.
IntermediateQuick answer1 min read - What is the difference between distance vector and link state routing protocols?
Distance vector protocols like RIP share their routing table with neighbours and trust what they hear (routing by rumour). Link state protocols like OSPF flood the full network map to everyone, and each router computes shortest paths itself with Dijkstra's algorithm.
IntermediateQuick answer1 min read