Networking
LAN / WAN / WLAN / PAN. - LAN — devices in one location (home, office). - WAN — connects LANs across distance; the internet is the largest WAN. - WLAN — wireless LAN (Wi-Fi). - PAN — Personal Area Network (Bluetooth).
Network devices. - Modem — converts the ISP signal (cable/fiber/DSL) into Ethernet. - Router — forwards traffic between networks. Assigns local IPs via DHCP. - Switch — forwards traffic within a LAN, between Ethernet ports. - Access point (AP) — bridges Wi-Fi clients onto a wired LAN. - Firewall — filters traffic by rule. - Hub — older device; broadcasts traffic to every port. Largely obsolete.
IP addresses.
- IPv4 — 32-bit, written as four decimal octets: 192.168.1.10.
- IPv6 — 128-bit, written in hex with colons: 2001:db8::1. Created because IPv4 ran out.
- Private ranges (used inside LANs, not routed on the internet): 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16.
- NAT (Network Address Translation) — router shares one public IP across many private clients.
- Static IP — manually configured. Dynamic IP — assigned by a DHCP server.
- Loopback address — 127.0.0.1 (IPv4) / ::1 (IPv6) refers to the local machine itself.
MAC address. 48-bit hardware ID burned into each NIC, six hex pairs (AA:BB:CC:11:22:33). Used inside a single network segment; IP is used between networks.
DNS (Domain Name System) — translates names (example.com) into IP addresses.
DHCP (Dynamic Host Configuration Protocol) — hands out IP addresses on a LAN.
Common ports and protocols.
| Protocol | Port | Purpose |
|---|---|---|
| HTTP | 80 | Web (unencrypted) |
| HTTPS | 443 | Web (TLS encrypted) |
| FTP | 21 | File transfer |
| SSH | 22 | Encrypted remote shell |
| Telnet | 23 | Remote shell (unencrypted — obsolete) |
| SMTP | 25 | Sending email |
| DNS | 53 | Name resolution |
| DHCP | 67 / 68 | IP assignment |
| POP3 / IMAP | 110 / 143 | Receiving email |
| RDP | 3389 | Windows remote desktop |
TCP vs. UDP. - TCP — connection-oriented, reliable. Handshake, retransmits, in-order delivery. Used by HTTP, SSH, email. - UDP — connectionless, best-effort. Faster, no retransmits. Used by DNS lookups, voice/video streaming, online gaming.
OSI model — the seven-layer reference model: Physical, Data Link, Network, Transport, Session, Presentation, Application. You usually only need to know it exists, that lower layers handle bits/frames and higher layers handle data/applications, and that TCP/UDP live at Transport (layer 4) and IP lives at Network (layer 3).
Diagnostic commands.
- ping <host> — tests reachability via ICMP echo.
- traceroute <host> / tracert <host> — shows the path packets take.
- ipconfig (Windows) / ifconfig or ip addr (Linux) — shows local IP settings.
- nslookup <host> — DNS lookup.