OSI Model
Beginner| Layer | Name | DevOps Relevance |
|---|---|---|
| 7 | Application | HTTP, DNS, SMTP — where your apps live |
| 6 | Presentation | TLS/SSL encryption, data formatting |
| 5 | Session | Maintaining connections between apps |
| 4 | Transport | TCP/UDP — port numbers, load balancing |
| 3 | Network | IP addressing, routing, subnetting, VPC |
| 2 | Data Link | MAC addresses, switches, VLANs |
| 1 | Physical | Cables, NICs, physical hardware |
IP Addressing & Subnetting
Beginner# Private IP Ranges (RFC 1918)
10.0.0.0/8 # 10.0.0.0 - 10.255.255.255 (16M+ addresses)
172.16.0.0/12 # 172.16.0.0 - 172.31.255.255 (1M+ addresses)
192.168.0.0/16 # 192.168.0.0 - 192.168.255.255 (65K addresses)
# CIDR Notation Cheat Sheet
/16 = 255.255.0.0 = 65,534 hosts (VPC)
/20 = 255.255.240.0 = 4,094 hosts (Large subnet)
/24 = 255.255.255.0 = 254 hosts (Typical subnet)
/28 = 255.255.255.240 = 14 hosts (Small subnet)
/32 = 255.255.255.255 = 1 host (Single host)
# Typical VPC layout
VPC: 10.0.0.0/16
Public-1a: 10.0.1.0/24 (web servers, load balancers)
Public-1b: 10.0.2.0/24
Private-1a: 10.0.10.0/24 (app servers, databases)
Private-1b: 10.0.11.0/24
DNS
BeginnerRecord Types
| Type | Purpose | Example |
|---|---|---|
A | Maps name to IPv4 | app.example.com → 1.2.3.4 |
AAAA | Maps name to IPv6 | app.example.com → 2001:db8::1 |
CNAME | Alias to another name | www → app.example.com |
MX | Mail servers | 10 mail.example.com |
TXT | Text records (SPF, verification) | v=spf1 include:_spf.google.com |
NS | Name servers | ns1.example.com |
HTTP/HTTPS
BeginnerImportant Status Codes
| Code | Meaning | Common Cause |
|---|---|---|
200 | OK | Success |
301 | Moved Permanently | URL redirect |
400 | Bad Request | Invalid input |
401 | Unauthorized | Missing/invalid auth |
403 | Forbidden | Insufficient permissions |
404 | Not Found | Wrong URL |
500 | Internal Server Error | Application crash |
502 | Bad Gateway | Upstream server down |
503 | Service Unavailable | Server overloaded |
504 | Gateway Timeout | Upstream too slow |
Load Balancing
IntermediateLoad Balancing Algorithms
- Round Robin — Distributes sequentially
- Least Connections — Sends to server with fewest active connections
- IP Hash — Routes based on client IP (session persistence)
- Weighted — Distributes based on server capacity weights
# Nginx as a load balancer
upstream backend {
least_conn;
server app1:3000 weight=3;
server app2:3000 weight=2;
server app3:3000 weight=1;
}
server {
listen 80;
server_name app.example.com;
location / {
proxy_pass http://backend;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
TLS/SSL Certificates
Intermediate# Generate a self-signed certificate (dev only)
openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -nodes
# Use Let's Encrypt with Certbot (production)
sudo apt install certbot python3-certbot-nginx
sudo certbot --nginx -d example.com -d www.example.com
# Auto-renewal
sudo certbot renew --dry-run
# Check certificate expiry
echo | openssl s_client -connect example.com:443 2>/dev/null | openssl x509 -noout -dates
Firewalls & Security Groups
Intermediate Principle of Least Privilege
Only open the ports that are strictly necessary. Default deny everything, then explicitly allow what's needed.
# AWS Security Group (Terraform)
resource "aws_security_group" "web" {
name = "web-sg"
vpc_id = aws_vpc.main.id
# Allow HTTPS from anywhere
ingress {
from_port = 443
to_port = 443
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}
# Allow SSH from office only
ingress {
from_port = 22
to_port = 22
protocol = "tcp"
cidr_blocks = ["203.0.113.0/24"] # Office IP range
}
# Allow all outbound
egress {
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
}
}
Service Mesh
AdvancedA service mesh handles service-to-service communication with mTLS, observability, and traffic management.
- Istio — Most feature-rich, uses Envoy proxy sidecars
- Linkerd — Lightweight, easy to set up, CNCF graduated
- Consul Connect — HashiCorp's service mesh solution
Zero-Trust Networking
Advanced"Never trust, always verify." Zero-trust assumes no implicit trust based on network location.
- Verify identity — Authenticate every request
- Least privilege — Minimal access permissions
- Micro-segmentation — Fine-grained network policies
- Encrypt everything — mTLS between all services
- Continuous monitoring — Log and inspect all traffic