Computer Networks · Lesson 7 of 7 · Updated ·
Top Computer Networks Interview Questions — With Short Answers
Revise these before interviews. Give the one-line answer, then an example.
Models and layers
- What is the OSI model? A 7-layer reference model: Application, Presentation, Session, Transport, Network, Data link, Physical.
- OSI vs TCP/IP? OSI is a 7-layer reference; TCP/IP is the 4-layer practical model the internet uses.
- Which layer is TCP / IP / Ethernet? Transport / Network / Data link.
- Segment, packet, frame? Units at the transport, network and data link layers.
Addresses
- IP vs MAC address? IP: logical, can change, used for routing across networks (layer 3). MAC: physical, burned into the card, used on the local link (layer 2).
- What is ARP? Address Resolution Protocol — finds the MAC address for an IP on the local network.
- What is DHCP? Automatically gives devices an IP address, subnet mask, gateway and DNS server (steps: Discover, Offer, Request, Acknowledge — "DORA").
- What is NAT? Lets many private-IP devices share one public IP.
- Private IP ranges? 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16.
- Usable hosts in a /26? 2⁶ − 2 = 62.
- What is a default gateway? The router a device sends traffic to when the destination is outside its own network.
- IPv4 vs IPv6? 32-bit vs 128-bit; IPv6 removes the need for NAT and has built-in features like autoconfiguration.
Transport
- TCP vs UDP? TCP: connection, reliable, ordered, slower. UDP: connectionless, no guarantees, fast.
- Three-way handshake? SYN → SYN-ACK → ACK.
- Flow vs congestion control? Flow protects the receiver; congestion control protects the network.
- What is a port? A socket? A port identifies an application; a socket = IP + port.
Application
- HTTP vs HTTPS? HTTPS = HTTP over TLS: encrypted, integrity-checked, server authenticated; port 443 vs 80.
- GET vs POST? GET reads, data in the URL, cacheable; POST creates/changes, data in the body.
- How does DNS work? Resolver asks root → TLD → authoritative server; answers cached by TTL.
- What is a CDN? Servers around the world that cache content close to users for speed.
- 401 vs 403? 401 = not authenticated; 403 = authenticated but not allowed.
Devices and security
- Hub vs switch vs router? Hub broadcasts (L1); switch forwards by MAC (L2); router routes between networks by IP (L3).
- What is a firewall? It allows or blocks traffic using rules (ports, IPs, applications).
- What is a VPN? An encrypted tunnel over the internet so your traffic appears to come from the VPN network.
- What happens when you type a URL? DNS → TCP → TLS → HTTP request → server → response → render.
Common commands to know
| Command | Use |
|---|---|
ping google.com | is the host reachable? (ICMP) |
tracert / traceroute | which routers the path goes through |
ipconfig / ip addr | your IP, mask and gateway |
nslookup skills101.in | DNS lookup |
netstat / ss | open connections and ports |
Common mistakes
- Saying MAC addresses are used to route across the internet.
- Mixing up DHCP (gives IPs) and DNS (names → IPs).
- Forgetting the − 2 in host counts.
Quick recap
- Layers: OSI 7, TCP/IP 4. TCP transport, IP network, Ethernet data link.
- IP (logical, routing) vs MAC (physical, local); ARP links them; DHCP assigns IPs; NAT shares one public IP.
- TCP vs UDP; HTTP vs HTTPS; DNS resolution; hub vs switch vs router.