Computer Networks
Explain the OSI and TCP/IP models, TCP vs UDP, IP addressing and subnetting, DNS, HTTP and HTTPS, and what happens when you type a URL.
Intermediate · about 8 hours · difficulty 3/5
Learn first: Operating Systems
Computer Networks questions are common in technical rounds, and "what happens when you type google.com in a browser?" is one of the most asked fresher questions in India.
Core concepts
- OSI (7 layers) vs TCP/IP (4 layers): what each layer does, with a protocol example for each.
- TCP vs UDP: connection-oriented vs connectionless, three-way handshake, four-way teardown, flow control (sliding window), congestion control (slow start), and where each is used.
- IP addressing: IPv4 classes, private ranges, CIDR and subnetting (compute network, broadcast and host count), IPv6 basics, NAT.
- Application layer: DNS resolution (recursive and iterative), HTTP methods and status codes, HTTP vs HTTPS and the TLS handshake at a high level, cookies and sessions.
- Devices: hub vs switch vs router; MAC vs IP address; ARP; DHCP.
- Basics of sockets and ports (80, 443, 22, 53).
The URL question
Walk through: browser cache, DNS lookup, TCP handshake, TLS handshake, HTTP request, server processing, response, rendering. Mention load balancers and CDNs for bonus points.
Pitfalls
- Mixing up which layer handles routing (network) vs reliable delivery (transport).
- Getting the subnet host count wrong by forgetting to subtract network and broadcast addresses.
You are ready to move on when you can walk through the URL question for 3 minutes without notes and subnet 192.168.1.0/26 correctly.
Key concepts
- OSI and TCP/IP models
- TCP vs UDP and the handshake
- Flow and congestion control
- IP addressing and subnetting
- DNS, DHCP, ARP
- HTTP, HTTPS and TLS
- Switches, routers, NAT
- What happens when you type a URL
Mini project
Use Wireshark or browser DevTools to capture a visit to a website, and write a one-page annotated walkthrough of DNS, TCP handshake, TLS and HTTP in that capture. Then solve 10 subnetting questions and check them with an online calculator.
Check yourself
Why does a video call usually use UDP while a file download uses TCP?
Free resources
- Cloudflare Learning Center (Cloudflare)
- Kurose and Ross: Computer Networking resources (UMass)
- MDN: An overview of HTTP (MDN)