Computer Networking Basics
A Student Handbook on TCP/IP, DNS, and Load Balancing
Introduction to Computer Networking
Welcome to your comprehensive guide on computer networking basics. This handbook will walk you through the fundamental concepts that power the internet and modern digital communication.
Learning Objectives
By the end of this handbook, you will understand:
- How the TCP/IP protocol suite enables internet communication
- The role of DNS in translating domain names to IP addresses
- How load balancing distributes traffic across multiple servers
- Real-world applications of these technologies
Basic Network Components
This simple diagram shows the basic flow of data from a client through a router to a server.
Real-World Analogy
Think of computer networking like a postal system:
- IP Addresses are like street addresses
- DNS is like a phone book that maps names to addresses
- TCP ensures your package arrives intact and in order
- Load Balancers are like multiple post offices working together to handle high volumes of mail
TCP/IP Protocol Suite
The TCP/IP protocol suite is the foundation of modern internet communication. It consists of four layers that work together to transmit data across networks.
Application Layer
HTTP, FTP, SMTP – Protocols for specific applications
Transport Layer
TCP, UDP – Manages end-to-end communication
Internet Layer
IP, ICMP – Handles addressing and routing
Network Interface Layer
Ethernet, Wi-Fi – Physical connection to the network
TCP vs UDP
| Feature | TCP | UDP |
|---|---|---|
| Connection | Connection-oriented | Connectionless |
| Reliability | High (acknowledgments, retransmissions) | Low (no guarantees) |
| Speed | Slower due to overhead | Faster with less overhead |
| Use Cases | Web browsing, email, file transfer | Video streaming, DNS, gaming |
TCP Three-Way Handshake
When establishing a TCP connection, your computer and the server perform a “three-way handshake”:
- SYN: Client sends a synchronization packet to the server
- SYN-ACK: Server responds with synchronization-acknowledgment
- ACK: Client sends final acknowledgment
This process ensures both devices are ready to communicate before data transfer begins.
Domain Name System (DNS)
DNS is often called the “phonebook of the internet” because it translates human-friendly domain names (like google.com) into IP addresses that computers use to identify each other.
DNS Resolution Process
DNS resolution involves multiple servers working together to find the correct IP address.
DNS Record Types
| Record Type | Purpose | Example |
|---|---|---|
| A | Maps domain to IPv4 address | example.com → 192.0.2.1 |
| AAAA | Maps domain to IPv6 address | example.com → 2001:db8::1 |
| CNAME | Alias of one domain to another | www.example.com → example.com |
| MX | Directs email to mail servers | example.com → mail.example.com |
DNS in Action: Visiting a Website
When you type “www.amazon.com” in your browser:
- Your computer checks its local DNS cache
- If not found, it queries your ISP’s DNS resolver
- The resolver queries root servers to find .com TLD servers
- TLD servers direct to Amazon’s authoritative name servers
- Authoritative servers provide the actual IP address
- Your browser connects to the IP address to load the website
This entire process typically happens in milliseconds!
Load Balancing
Load balancing distributes network traffic across multiple servers to ensure no single server becomes overwhelmed, improving reliability and performance.
Load Balancer Architecture
A load balancer distributes incoming requests across multiple backend servers.
Load Balancing Algorithms
| Algorithm | How It Works | Best For |
|---|---|---|
| Round Robin | Cycles through servers in sequence | Servers with similar specifications |
| Least Connections | Sends traffic to server with fewest active connections | Long-lasting connections (e.g., database, FTP) |
| IP Hash | Uses client IP to determine server assignment | Maintaining user sessions |
| Weighted Round Robin | Round Robin with capacity-based weighting | Servers with different capabilities |
Load Balancing in E-commerce
During Black Friday sales, e-commerce sites experience massive traffic spikes:
- A load balancer distributes thousands of simultaneous users across multiple web servers
- If one server fails, the load balancer redirects traffic to healthy servers
- Session persistence ensures users stay on the same server during checkout
- Geographic load balancing directs users to the nearest data center
This ensures the website remains responsive even under extreme load.
TCP Three-Way Handshake Demo
This interactive demonstration shows how TCP establishes a connection using the three-way handshake.
TCP Connection Establishment
DNS Resolution Demo
See how DNS translates a domain name to an IP address through multiple steps.
DNS Lookup Process
Load Balancing Demo
Visualize how a load balancer distributes requests across multiple servers.
Request Distribution
Scenario 1: E-commerce Website
An online store needs to handle thousands of concurrent users, especially during peak shopping seasons.
The Challenge
During Black Friday, the website experiences:
- 10x normal traffic volume
- Spikes of 50,000+ concurrent users
- Critical need for 99.99% uptime
- Secure handling of payment information
Networking Solution
The e-commerce platform implements:
- Global Load Balancing: Distributes users to nearest data centers
- TCP Optimization: Fast connection establishment and keep-alives
- DNS-based Failover: Automatic rerouting if a data center fails
- SSL Offloading: Load balancers handle encryption to reduce server load
Architecture Diagram
Each data center has its own local load balancer distributing traffic to multiple application servers.
Scenario 2: Video Streaming Service
A platform like Netflix needs to deliver high-quality video to millions of users simultaneously.
The Challenge
Streaming services must handle:
- Massive bandwidth requirements
- Varied connection speeds (mobile vs broadband)
- Global content delivery with low latency
- Adaptive bitrate streaming
Networking Solution
The streaming service uses:
- Content Delivery Network (CDN): Caches videos at edge locations
- UDP-based Protocols: For real-time video delivery
- Anycast DNS: Directs users to nearest CDN node
- TCP for Control: Manages authentication and browsing
Data Flow
- User opens the streaming app and authenticates (TCP)
- App requests video manifest file (HTTP/TCP)
- DNS directs to nearest CDN edge server
- Video segments stream via UDP-based protocol
- Adaptive bitrate algorithms adjust quality based on network conditions
Scenario 3: Global Company Network
A multinational corporation with offices worldwide needs secure, reliable connectivity.
The Challenge
The company faces:
- Secure communication between offices
- Centralized access to corporate resources
- Reliable connectivity for remote workers
- Consistent performance across continents
Networking Solution
The IT infrastructure includes:
- VPN Connections: Secure tunnels between offices
- Global Load Balancers: For internal applications
- Split-horizon DNS: Internal vs external resolution
- Quality of Service (QoS): Prioritizing business traffic
Network Architecture
All offices connect through a secure cloud network with centralized authentication and policy enforcement.
Computer Networking Basics — TCP/IP, DNS, Load Balancing
A practical, visual handbook that turns core networking concepts into job-ready intuition. Learn the stack, name systems, and how modern sites stay fast and resilient.
Overview
Goal: Build a rock-solid mental model of how devices talk (TCP/IP), how names become IPs (DNS), and how traffic is shared for speed and reliability (load balancing).
- TCP/IP – Protocols/rules for communication across networks.
- DNS – The phonebook of the internet mapping names to IPs.
- Load Balancing – Distributing requests across multiple servers.
Request Journey
- User enters
shop.example.com. - DNS resolves name → IP address.
- Client opens TCP connection to IP:port.
- Load balancer routes to a healthy backend.
- Server returns response over the same connection.
TCP/IP Layers — From Wire to Webpage
1. Link
Local delivery inside a network (Ethernet, Wi‑Fi). Frames hop between network interfaces and switches.
- Unit: Frame; Address: MAC
- Common tools:
ip link,ethtool, Wi‑Fi settings
2. Internet
Global addressing and routing with IP (IPv4/IPv6). Routers forward packets between networks.
- Unit: Packet; Protocols: IP, ICMP
- Tools:
ping,traceroute/tracert
3. Transport
Ports and end‑to‑end flows. TCP (reliable, ordered) vs UDP (faster, best‑effort).
- Unit: Segment (TCP), Datagram (UDP)
- Tools:
netstat,ss,tcpdump
4. Application
Human‑friendly protocols: HTTP(S), DNS, SMTP, SSH, etc. Your apps live here, using lower layers transparently.
- Ports: HTTP 80, HTTPS 443, DNS 53, SSH 22
- Tooling: browsers,
curl,dig,nslookup
TCP vs UDP — When to Use
- TCP: Web pages, APIs, logins — where correctness matters
- UDP: Streaming, VoIP, DNS queries — when speed/low‑latency matters
IP Addressing, Subnets & Ports
IPv4 vs IPv6
- IPv4: 32‑bit (e.g., 203.0.113.5). Scarce → NAT is common.
- IPv6: 128‑bit (e.g., 2001:db8::1). Huge space, built‑in features.
Ports
One IP can host many services using ports (e.g., 203.0.113.5:443 for HTTPS).
Subnets in One Bite
A subnet groups IPs. CIDR /24 ≈ 256 addresses (0–255). Routers use the network portion to forward packets efficiently.
# See your addresses
# Linux/macOS
ip addr # or: ifconfig
# Windows
ipconfig
DNS Essentials — Turning Names into Numbers
Key Record Types
- A → name → IPv4
- AAAA → name → IPv6
- CNAME → alias → canonical name
- NS → who is authoritative
- MX → mail servers for a domain
- TXT → arbitrary text (SPF, ownership)
Resolution Flow
- Client asks the recursive resolver (often your ISP or 1.1.1.1/8.8.8.8).
- Resolver walks from root → TLD (e.g., .com) → authoritative nameserver.
- Authoritative server replies with the record. Resolver caches per TTL.
# Query DNS
# Linux/macOS
$ dig A example.com +trace
# Windows
> nslookup example.com
Load Balancing — Speed, Scale, and Resilience
Concepts
- L4 (Transport) LB: balances TCP/UDP by IP:port (e.g., TCP 443).
- L7 (Application) LB: understands HTTP/HTTPS — routes by path/host, adds headers, TLS, etc.
- Health checks remove unhealthy backends; session stickiness keeps user on the same node if needed.
Algorithms
- Round‑robin — simple rotation
- Least connections — send to the least busy
- Weighted — prefer stronger servers
- IP hash — keep clients sticky by IP
# Example: NGINX (L7 reverse proxy)
upstream api_pool {
server 10.0.0.11:8080;
server 10.0.0.12:8080;
}
server {
listen 443 ssl;
server_name api.example.com;
location / { proxy_pass http://api_pool; }
}
Real‑Life Use Cases & Scenarios
1) Small Business Wi‑Fi + Internet
Problem: A café needs guest Wi‑Fi without exposing the POS system.
- Create two VLANs/subnets: Guest and POS.
- Router does NAT to the ISP; firewall blocks Guest → POS.
- DNS set to a safe resolver; content filter for Guest.
Outcome: Secure separation, simple troubleshooting (ping gateway, check DNS).
2) E‑commerce Peak Traffic
Problem: Black Friday spikes overwhelm a single web server.
- Place an L7 load balancer in front of multiple web nodes.
- Use weighted round‑robin to prefer larger nodes.
- DNS TTL 60s to support quick failover of LB IPs.
Outcome: Scales horizontally; zero‑downtime node rotation with health checks.
3) DNS Outage Playbook
Problem: Users report “site not found.” App servers are healthy.
- Check
dig yourdomain.comfrom multiple networks. - Verify authoritative NS and zone expiry; look for expired domain/DS mismatch.
- Lower TTL before planned changes to speed propagation.
Outcome: Faster diagnosis, clear rollback/propagation plan.
4) Global Performance with CDN
Problem: Users in Europe/Asia see slow image loads.
- Serve static assets via CDN (edge POPs close to users).
- Keep dynamic API behind regional L7 load balancers.
- Use DNS Geo‑routing to send users to nearest region.
Outcome: Lower latency and bandwidth costs; better Core Web Vitals.
5) Blue‑Green Deployment
Problem: New app version risks downtime.
- Run Blue (current) and Green (new) behind LB.
- Send 10% traffic to Green (canary), watch errors/latency.
- Flip 100% when healthy; instant rollback by pointer switch.
Outcome: Safer releases with measurable risk control.
6) Corporate Split‑Horizon DNS
Problem: Internal app must be accessible with the same name inside and outside.
- Public DNS
app.company.com→ public LB IP. - Internal DNS (split‑horizon) → private LB IP.
- Access controls ensure internal data stays private.
Outcome: Unified URLs without exposing internal topology.
Hands‑On Labs (Bash, PowerShell & GUI)
Lab A — Trace a Request
- Open Terminal/PowerShell.
- ping itlearning.ng — confirm reachability.
- traceroute itlearning.ng (Linux/macOS) or tracert itlearning.ng (Windows) — note hops.
- curl -I https://itlearning.ng — inspect HTTP headers.
# Linux/macOS
ping -c 4 itlearning.ng
traceroute itlearning.ng
curl -I https://itlearning.ng
# Windows (PowerShell)
ping itlearning.ng -n 4
tracert itlearning.ng
Invoke-WebRequest https://itlearning.ng -Method Head | Select-Object -ExpandProperty Headers
Lab B — Explore DNS
- Query A/AAAA/MX/TXT for a domain using
digornslookup. - Change your resolver to 1.1.1.1 and retry — compare results/latency.
- Set a low TTL in a test zone and observe cache behaviour.
# dig examples
dig A example.com
dig AAAA example.com
dig MX example.com
dig TXT example.com
dig +short NS example.com
# nslookup examples
nslookup -type=A example.com
nslookup -type=MX example.com
Lab C — Quick NGINX Load Balancer (Local)
- Run two simple web servers on ports 8081 and 8082.
- Configure NGINX to proxy
localhost:8080→ both backends. - Refresh browser repeatedly to watch round‑robin.
# Simple Python servers
python3 -m http.server 8081 &
python3 -m http.server 8082 &
# /etc/nginx/conf.d/demo.conf
upstream demo_pool {
server 127.0.0.1:8081;
server 127.0.0.1:8082;
}
server {
listen 8080;
location / { proxy_pass http://demo_pool; }
}
Lab D — Packet Peeking (Bonus)
- Install Wireshark or run
tcpdumpto capture traffic while loading a web page. - Filter by
tcp.port==443and inspect the TCP handshake and TLS ClientHello.
# tcpdump (requires sudo)
sudo tcpdump -i any tcp port 443 -vv
Glossary
Internet Protocol. Global addressing and routing.
Name system mapping domains → IP addresses.
Time cache entries live before refresh.
Load balancer, spreads traffic across servers.
Edge cache network for static/streamed content.
Network Address Translation, shares one public IP.
Quick Checklist — Networking Readiness
- ✅ I can explain the 4 TCP/IP layers in plain English.
- ✅ I know when to choose TCP vs UDP.
- ✅ I can read a DNS record set and understand TTL.
- ✅ I can configure a simple L7 load balancer and test health checks.
- ✅ I can troubleshoot: ping, traceroute, dig/nslookup, curl.
- ✅ I have a playbook for DNS changes and traffic spikes.