OSI Model Layers
| Layer | Name | Protocol/Function | PDU |
| 7 | Application | HTTP, DNS, SMTP, FTP | Data |
| 6 | Presentation | TLS/SSL, ASCII, JPEG | Data |
| 5 | Session | NetBIOS, RPC, Sockets | Data |
| 4 | Transport | TCP, UDP | Segment/Datagram |
| 3 | Network | IP, ICMP, OSPF | Packet |
| 2 | Data Link | Ethernet, ARP, MAC | Frame |
| 1 | Physical | Cables, Radio, Fiber | Bits |
TCP vs UDP
| Feature | TCP | UDP |
| Connection | Connection-oriented | Connectionless |
| Reliability | Guaranteed delivery | Best-effort (no guarantee) |
| Ordering | In-order delivery | No ordering guarantee |
| Overhead | Higher (20-byte header) | Lower (8-byte header) |
| Flow Control | Yes (sliding window) | None |
| Use Cases | Web, email, file transfer | Streaming, VoIP, DNS, gaming |
| Handshake | 3-way (SYN, SYN-ACK, ACK) | None |
Common Ports
| Item | Description |
20/21 | FTP (File Transfer Protocol) — data/control |
22 | SSH (Secure Shell) — encrypted remote access |
23 | Telnet — unencrypted remote access (avoid!) |
25 | SMTP — email sending between servers |
53 | DNS — domain name resolution |
80 | HTTP — unencrypted web traffic |
110 | POP3 — email retrieval |
143 | IMAP — email retrieval with server-side folders |
443 | HTTPS — encrypted web traffic (TLS) |
3306 | MySQL/MariaDB database default port |
5432 | PostgreSQL database default port |
6379 | Redis in-memory data store |
27017 | MongoDB database default port |
IP Addressing Basics
| Item | Description |
IPv4 | 32-bit address (4 octets), e.g., 192.168.1.1 |
Subnet Mask | Defines network vs host portion, e.g., 255.255.255.0 |
CIDR | Classless Inter-Domain Routing, e.g., 192.168.1.0/24 |
Private IPv4 | 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16 |
Loopback | 127.0.0.1 (localhost) — always points to self |
APIPA | 169.254.0.0/16 — auto-assigned when DHCP fails |
Default Gateway | Router that connects local network to other networks |
Broadcast | 255.255.255.255 — sends to all hosts on LAN |
Pro Tip: Remember the OSI mnemonic: 'Please Do Not Throw Sausage Pizza Away' — Physical, Data Link, Network, Transport, Session, Presentation, Application.