Networking Cheat Sheet
Subnetting, CIDR, common ports, and the OSI model on one page—quick reference for engineers and interview prep.
2 min read·By Arun R Kaushik
OSI Model
| Layer | Name | Examples |
|---|---|---|
| 7 | Application | HTTP, DNS, SMTP, FTP |
| 6 | Presentation | TLS, encoding, compression |
| 5 | Session | sessions, sockets |
| 4 | Transport | TCP, UDP |
| 3 | Network | IP, ICMP, routing |
| 2 | Data Link | Ethernet, switches, MAC |
| 1 | Physical | cables, fiber, radio |
CIDR Quick Reference
| CIDR | Subnet Mask | Hosts |
|---|---|---|
| /24 | 255.255.255.0 | 254 |
| /25 | 255.255.255.128 | 126 |
| /26 | 255.255.255.192 | 62 |
| /27 | 255.255.255.224 | 30 |
| /28 | 255.255.255.240 | 14 |
| /29 | 255.255.255.248 | 6 |
| /30 | 255.255.255.252 | 2 |
Usable hosts = 2^(32 - prefix) - 2
Private IP Ranges (RFC 1918)
10.0.0.0/8172.16.0.0/12192.168.0.0/16
Common Ports
| Port | Protocol | Service |
|---|---|---|
| 20/21 | TCP | FTP |
| 22 | TCP | SSH |
| 23 | TCP | Telnet |
| 25 | TCP | SMTP |
| 53 | TCP/UDP | DNS |
| 67/68 | UDP | DHCP |
| 80 | TCP | HTTP |
| 110 | TCP | POP3 |
| 123 | UDP | NTP |
| 143 | TCP | IMAP |
| 161/162 | UDP | SNMP |
| 179 | TCP | BGP |
| 389 | TCP | LDAP |
| 443 | TCP | HTTPS |
| 445 | TCP | SMB |
| 514 | UDP | Syslog |
| 3389 | TCP | RDP |
TCP vs UDP
| TCP | UDP | |
|---|---|---|
| Connection | Connection-oriented | Connectionless |
| Reliability | Guaranteed delivery, ordering | Best effort |
| Overhead | Higher (handshake, ACKs) | Lower |
| Use cases | HTTP, SSH, databases | DNS, VoIP, streaming |
TCP Three-Way Handshake
- Client → Server:
SYN - Server → Client:
SYN-ACK - Client → Server:
ACK
VLSM Quick Tip
When subnetting for multiple sized networks, allocate the largest subnets first, then carve smaller ones from the remaining space to avoid fragmentation.
Useful Commands
# Show interfaces and IPs
ip addr show
# Show routing table
ip route show
# Trace path to a host
traceroute example.com
# DNS lookup
dig example.com
nslookup example.com
# Test a TCP port
nc -zv example.com 443