COMPUTER NETWORKS / OVERVIEW

Computer Networks — The Full Map

How every byte travels from your keyboard to a server across the world


EXPLANATION

A computer network is a system of interconnected devices that can communicate and share resources. Every time you open a browser, the network stack on your machine performs dozens of precisely coordinated operations in milliseconds.

The key mental model: communication is hard, so we split the problem into layers. Each layer solves one problem and presents a clean interface to the layer above. This is the OSI and TCP/IP model — the most important design pattern in all of computer science.

The two models:
• OSI (7 layers) — the academic reference model. Used for understanding and exam questions
• TCP/IP (4 layers) — the actual model the internet uses. What your OS implements

Why layers matter: your application doesn't need to know if it's on WiFi or Ethernet or fiber. The network layer handles routing, the data link layer handles the physical medium, and your app just sends bytes through a socket. Abstraction at its finest.

The full journey of a packet: You type google.com
① Browser calls DNS → resolves to IP address (Application layer)
② TCP connection established via 3-way handshake (Transport layer)
③ Packet given source/dest IP, routing table consulted (Network layer)
④ Packet wrapped in Ethernet frame with MAC addresses (Data Link layer)
⑤ Bits sent over wire/air as electrical/radio signals (Physical layer)
⑥ Router strips frame, reads IP, rewraps, forwards (repeated ~10 times)
⑦ Server receives → unwraps layers → app gets your HTTP request

We'll study each layer deeply, then put it all together.

DIAGRAM

OSI MODEL                TCP/IP MODEL       PROTOCOLS
  ─────────────────────    ────────────────   ──────────────────────
  7. Application    ─┐     Application        HTTP, HTTPS, DNS, FTP,
  6. Presentation   ─┤     ───────────────    SMTP, WebSocket, gRPC
  5. Session        ─┘
  ────────────────────     ───────────────
  4. Transport            Transport           TCP, UDP
  ────────────────────     ───────────────
  3. Network              Internet            IP, ICMP, ARP
  ────────────────────     ───────────────
  2. Data Link      ─┐     Network Access     Ethernet, WiFi (802.11),
  1. Physical       ─┘     ───────────────    MAC, PPP

  PACKET JOURNEY: google.com
  Your App → [HTTP] → [TCP] → [IP] → [Ethernet] → Router → ... → Google

CODE

BASH
1# Tools to explore every layer of the network stack
2# Run these to see the internet working in real time
3
4# ── Layer 3: Trace the route (each hop = one router) ──
5traceroute google.com # Linux/Mac
6tracert google.com # Windows
7
8# ── Layer 3: DNS resolution ────────────────────────────
9nslookup google.com # basic
10dig google.com A # full DNS query (A = IPv4 address)
11dig google.com AAAA # IPv6 address
12dig google.com MX # mail servers
13dig @8.8.8.8 google.com # query Google's DNS directly
14
15# ── Layer 3: IP & routing ─────────────────────────────
16ip addr # your IP addresses (Linux)
17ip route show # routing table
18ifconfig # Mac/BSD
19
20# ── Layer 4: Open connections ─────────────────────────
21ss -tuln # listening ports (Linux)
22netstat -an # all connections
23lsof -i :8000 # what's on port 8000
24
25# ── Layer 7: Raw HTTP ──────────────────────────────────
26curl -v https://google.com # full HTTP conversation
27curl -I https://google.com # headers only
28wget -q -O- https://httpbin.org/ip # shows your public IP
29
30# ── Capture packets (Wireshark CLI) ───────────────────
31tcpdump -i eth0 port 80 # capture HTTP traffic
32tcpdump -n host 8.8.8.8 # capture DNS traffic
NEXT →1. Physical & Data Link