# Top Computer Networks Interview Questions — With Short Answers

Source: https://skills101.in/learn/computer-networks/computer-networks-interview-questions — Skills101 free tutorial (Computer Networks). Updated 2026-11-09.

Revise these before interviews. Give the one-line answer, then an example.

![OSI's 7 layers next to TCP/IP's 4 layers with example protocols — the base of many questions](https://skills101.in/learn-img/computer-networks/osi-tcpip.svg)

## Models and layers

1. **What is the OSI model?** A 7-layer reference model: Application, Presentation, Session, Transport, Network, Data link, Physical.
2. **OSI vs TCP/IP?** OSI is a 7-layer reference; TCP/IP is the 4-layer practical model the internet uses.
3. **Which layer is TCP / IP / Ethernet?** Transport / Network / Data link.
4. **Segment, packet, frame?** Units at the transport, network and data link layers.

## Addresses

5. **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).
6. **What is ARP?** Address Resolution Protocol — finds the MAC address for an IP on the local network.
7. **What is DHCP?** Automatically gives devices an IP address, subnet mask, gateway and DNS server (steps: Discover, Offer, Request, Acknowledge — "DORA").
8. **What is NAT?** Lets many private-IP devices share one public IP.
9. **Private IP ranges?** 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16.
10. **Usable hosts in a /26?** 2⁶ − 2 = 62.
11. **What is a default gateway?** The router a device sends traffic to when the destination is outside its own network.
12. **IPv4 vs IPv6?** 32-bit vs 128-bit; IPv6 removes the need for NAT and has built-in features like autoconfiguration.

## Transport

13. **TCP vs UDP?** TCP: connection, reliable, ordered, slower. UDP: connectionless, no guarantees, fast.
14. **Three-way handshake?** SYN → SYN-ACK → ACK.
15. **Flow vs congestion control?** Flow protects the receiver; congestion control protects the network.
16. **What is a port? A socket?** A port identifies an application; a socket = IP + port.

## Application

17. **HTTP vs HTTPS?** HTTPS = HTTP over TLS: encrypted, integrity-checked, server authenticated; port 443 vs 80.
18. **GET vs POST?** GET reads, data in the URL, cacheable; POST creates/changes, data in the body.
19. **How does DNS work?** Resolver asks root → TLD → authoritative server; answers cached by TTL.
20. **What is a CDN?** Servers around the world that cache content close to users for speed.
21. **401 vs 403?** 401 = not authenticated; 403 = authenticated but not allowed.

## Devices and security

22. **Hub vs switch vs router?** Hub broadcasts (L1); switch forwards by MAC (L2); router routes between networks by IP (L3).
23. **What is a firewall?** It allows or blocks traffic using rules (ports, IPs, applications).
24. **What is a VPN?** An encrypted tunnel over the internet so your traffic appears to come from the VPN network.
25. **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.


Practice quiz and free certificate: https://skills101.in/learn/computer-networks/computer-networks-interview-questions