Cheat SheetsNetworking Fundamentals Learner Cheatsheet

Networking Fundamentals: Learner Cheat Sheet

Topic Summary

Networking enables data to traverse the world. From OSI models to reverse proxies, mastering networking means understanding how packets are routed, domains are resolved, traffic is secured, and requests are balanced.

Memory Aids & Concepts

  • OSI 7 Layers: Please Do Not Throw Sausage Pizza Away (Physical, Data Link, Network, Transport, Session, Presentation, Application).
  • TCP vs UDP: TCP ensures delivery (3-Way Handshake: SYN ──►, ◄── SYN-ACK, ACK ──►); UDP fires and forgets.
  • Subnet Masks (CIDR): /24 locks 24 bits for the network, leaving 256 IPs. Smaller slash = MORE hosts (/16 = 65k IPs).
  • DNS Flow: Check /etc/hosts first, then /etc/resolv.conf.
  • Reverse Proxy: Client talks to proxy (e.g., Nginx), proxy talks to hidden backend (e.g., Python app).

Essential Files & Configurations

PathPurposeRelated Lesson
/etc/resolv.confDNS resolver config (Nameservers)MOD-NET-03
/etc/hostsLocal DNS overrides (Bypasses external DNS)MOD-NET-03
/etc/ssh/sshd_configSSH Daemon hardeningMOD-NET-05
/etc/nginx/nginx.confMaster Nginx configurationMOD-NET-04

Command Reference

Sockets & Routing

# View active listening TCP/UDP sockets
sudo ss -tulpn
 
# Show active network interfaces and IPs
ip addr show
 
# Show routing tables and default gateway (0.0.0.0/0)
ip route show
 
# Check which route Linux will use for an IP
ip route get 8.8.8.8

DNS & HTTP

# Query the 'A' record (IP) cleanly
dig google.com +short
 
# View raw HTTP headers and status codes
curl -I https://example.com
 
# Test Nginx syntax (ALWAYS do this before reloading!)
sudo nginx -t

Encryption & Packets

# Check SSL certificate expiration date
openssl x509 -in cert.pem -noout -enddate
 
# Generate secure ED25519 SSH keys
ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519
 
# Capture live HTTP packets on eth0
sudo tcpdump -i eth0 -nn -A port 80

Common Beginner Mistakes

  • Confusing Port & Protocol: Port 80 doesn’t have to be HTTP. You can run SSH on Port 80! (MOD-NET-01)
  • Private IP on Public DNS: Private IPs (10.x, 192.168.x) cannot cross the internet. Don’t put them in public DNS! (MOD-NET-02)
  • Missing Nginx Semicolons: Forgetting a ; in nginx.conf crashes Nginx. Run nginx -t before restarting. (MOD-NET-04)
  • tcpdump Without BPF/Numeric Flags: Running tcpdump without -nn or omitting not port 22 can cause massive DNS storms and infinite SSH feedback loops. (MOD-NET-06)